Esempio n. 1
0
        public override void Fill(SuperArray x, float value)
        {
            Array data = null;

            if (x.ElementType == DType.Single)
            {
                data = x.Data <float>();
                floatExec.ndarr_fill_float(data, value);
            }
            else
            {
                data = x.Data <double>();
                doubleExec.ndarr_fill_double(data, value);
            }

            x.LoadFrom(data);
        }
Esempio n. 2
0
        public static SampleArray FromArray(SuperArray x)
        {
            SampleArray result = new SampleArray()
            {
                Data     = x.Data <float>(),
                Shape    = x.Shape,
                DataType = x.ElementType
            };

            return(result);
        }
Esempio n. 3
0
        private SuperArray ExecuteReturn(string name, SuperArray x, SuperArray y)
        {
            Array r = null;

            if (x.ElementType == DType.Single)
            {
                r = new float[x.Elements];
                Global.Compiler.Execute <float>(name, x.Data <float>(), y.Data <float>(), r);
            }
            else
            {
                r = new double[x.Elements];
                Global.Compiler.Execute <double>(name, x.Data <double>(), y.Data <double>(), r);
            }

            SuperArray result = new SuperArray(x.Shape);

            result.LoadFrom(r);

            return(result);
        }