Esempio n. 1
0
 public static Matrix Subtract(Matrix leftMatrix, Matrix rightMatrix)
 {
     if (leftMatrix.columns == rightMatrix.columns && leftMatrix.rows == rightMatrix.rows)
     {
         double[,] C = MatrixMath.SubtractMatrices(leftMatrix.matrix, rightMatrix.matrix);
         return(new Matrix(C));
     }
     else
     {
         throw new IndexOutOfRangeException("Both matrices must be the same size.");
     }
 }
Esempio n. 2
0
 public static Matrix operator -(Matrix A, Matrix B)
 {
     if (A.columns == B.columns && A.rows == B.rows)
     {
         double[,] C = MatrixMath.SubtractMatrices(A.matrix, B.matrix);
         return(new Matrix(C));
     }
     else
     {
         throw new IndexOutOfRangeException("Both matrices must be the same size.");
     }
 }