Esempio n. 1
0
 public static Matrix Multiply(Matrix leftMatrix, Matrix rightMatrix)
 {
     if (leftMatrix.columns == rightMatrix.rows)
     {
         double[,] result = MatrixMath.MultiplyMatrices(leftMatrix.matrix, rightMatrix.matrix);
         return(new Matrix(result));
     }
     else
     {
         throw new IndexOutOfRangeException("The number of columns of the left matrix must equal the number of rows of the right matrix");
     }
 }
Esempio n. 2
0
 public static Matrix operator *(Matrix A, Matrix B)
 {
     if (A.columns == B.rows)
     {
         double[,] C = MatrixMath.MultiplyMatrices(A.matrix, B.matrix);
         return(new Matrix(C));
     }
     else
     {
         throw new IndexOutOfRangeException("The number of columns of matrix A must equal the number of rows of matrix B");
     }
 }