Exemplo n.º 1
0
        public ArrayMat t()
        {
            ArrayMat tMat = new ArrayMat(Cols, Rows);

            for (int r = 0; r < Rows; r++)
            {
                for (int c = 0; c < Cols; c++)
                {
                    if (r != c)
                    {
                        tMat.At(c, r, At(r, c));
                    }
                }
            }
            return(tMat);
        }
Exemplo n.º 2
0
        public static ArrayMat operator +(ArrayMat z, ArrayMat w)
        {
            if (z.Cols != w.Rows)
            {
                throw new OutLookARException("Mat type must bu equal to the number of w.rows and z.cols.");
            }
            ArrayMat v = new ArrayMat(z.Rows, w.Cols);

            for (int r = 0; r < v.Rows; r++)
            {
                for (int c = 0; c < v.Cols; c++)
                {
                    v.At(r, c, z.At(r, c) + w.At(r, c));
                }
            }
            return(v);
        }
Exemplo n.º 3
0
        public static ArrayMat operator *(ArrayMat z, ArrayMat w)
        {
            if (z.Cols != w.Rows)
            {
                throw new OutLookARException("Mat type must bu equal to the number of w.rows and z.cols.");
            }
            ArrayMat v = new ArrayMat(z.Rows, w.Cols);

            for (int r = 0; r < v.Rows; r++)
            {
                for (int c = 0; c < v.Cols; c++)
                {
                    double at = 0;
                    for (int b = 0; b < w.Rows; b++)
                    {
                        at += z.At(r, b) * w.At(b, c);
                    }
                    v.At(r, c, at);
                }
            }
            return(v);
        }