Exemplo n.º 1
0
        public static MyMatrix operator *(MyMatrix matrixA, MyMatrix matrixB)
        {
            if (matrixA.matrix.Length != matrixB.matrix.Length)
            {
                throw new Exception("Умножение невозможно");
            }

            MyMatrix matrixC = new MyMatrix(matrixA.height, matrixB.width);

            for (var i = 0; i < matrixA.height; i++)
            {
                for (var j = 0; j < matrixB.width; j++)
                {
                    matrixC[i, j] = 0;

                    for (var k = 0; k < matrixA.width; k++)
                    {
                        matrixC[i, j] += matrixA[i, k] * matrixB[k, j];
                    }
                }
            }

            return(matrixC);
        }
Exemplo n.º 2
0
 public MyMatrix(MyMatrix ob)
 {
     matrix      = ob.matrix;
     this.height = ob.height;
     this.width  = ob.width;
 }
Exemplo n.º 3
0
 public void TransponeMe(MyMatrix ob)
 {
     this.matrix = GetTransponedArray(ob);
 }
Exemplo n.º 4
0
 public MyMatrix GetTransponedCopy(MyMatrix ob)
 {
     double[,] resultArr = GetTransponedArray(ob);
     return(new MyMatrix(resultArr));
 }