Exemple #1
0
        // set ones method
        public static Arrayf Ones(Arrayf a)
        {
            for (int m = 0; m < a.dims.Length; m++)
            {
                if (a.dims[m] == 0)
                {
                    throw new ArgumentException("Can not set arrayf to zeros in some dimension.", nameof(a.dims));
                }
            }

            Arrayf af = new Arrayf();

            for (int i = 0; i < a.dims[0]; i++)
            {
                for (int j = 0; j < a.dims[1]; j++)
                {
                    for (int k = 0; k < a.dims[2]; k++)
                    {
                        af.arrayf[i, j, k] = 1.0f;
                    }
                }
            }

            return(af);
        }
Exemple #2
0
        // divide method
        public static Arrayf operator /(Arrayf a, Arrayf b)
        {
            for (int m = 0; m < a.dims.Length; m++)
            {
                if (a.dims[m] != b.dims[m])
                {
                    throw new ArgumentException("Can not divide two arrayf with different element in some dimension.", nameof(a));
                }
            }

            Arrayf af = new Arrayf();

            for (int i = 0; i < a.dims[0]; i++)
            {
                for (int j = 0; j < a.dims[1]; j++)
                {
                    for (int k = 0; k < a.dims[2]; k++)
                    {
                        af.arrayf[i, j, k] = a.arrayf[i, j, k] / b.arrayf[i, j, k];
                    }
                }
            }

            return(af);
        }
Exemple #3
0
        // TODO: transpose
        // get the transpose method
        public static Arrayf Transpose(Arrayf a, int[] b)
        {
            for (int m = 0; m < a.dims.Length; m++)
            {
                if (a.dims[m] == 0)
                {
                    throw new ArgumentException("Wrong arrayf, can not transpose arrayf with zero element in some dimension.", nameof(a));
                }
            }

            Arrayf af = new Arrayf();

            return(af);
        }
Exemple #4
0
        public static Arrayf operator /(Arrayf a, float b)
        {
            if (b.GetType() != typeof(float))
            {
                throw new ArgumentException("Wrong number, the arrayf must divide float type number.", nameof(b));
            }

            Arrayf af = new Arrayf();

            for (int i = 0; i < a.dims[0]; i++)
            {
                for (int j = 0; j < a.dims[1]; j++)
                {
                    for (int k = 0; k < a.dims[2]; k++)
                    {
                        af.arrayf[i, j, k] = a.arrayf[i, j, k] / b;
                    }
                }
            }

            return(af);
        }
Exemple #5
0
        // TODO: inverse
        // get the inverse method
        public static Arrayf Inverse(Arrayf a)
        {
            Arrayf af = new Arrayf();

            return(af);
        }
Exemple #6
0
        // TODO: div
        public static Arrayf Div(Arrayf a, Arrayf b)
        {
            Arrayf af = new Arrayf();

            return(af);
        }