public static MyMatrix operator *(MyMatrix firstMatrix, MyMatrix secondMatrix) { if (firstMatrix.Height != secondMatrix.Width) { throw new ArgumentException("The number of first matrix columns unequal to the number of second matrix rows"); } MyMatrix result = new MyMatrix(firstMatrix.Height, secondMatrix.Width); for (int row = 0; row < firstMatrix.Height; row++) { for (int column = 0; column < secondMatrix.Width; column++) { for (int k = 0; k < firstMatrix.Width; k++) { result[row, column] += firstMatrix[row, k] * secondMatrix[k, column]; } } } return(result); }
public MyMatrix(MyMatrix matrixToCopy) : this(matrixToCopy.Matrix.Clone() as double[, ]) { }