diff --git a/src/SparseTransform/DataStructures/DoubleMatrix.cs b/src/SparseTransform/DataStructures/DoubleMatrix.cs index ff39be32c42b6415bed29f91f72ae26aca5a767b..2b61de0444a0925658e99066ce58e2ff18c965b5 100644 --- a/src/SparseTransform/DataStructures/DoubleMatrix.cs +++ b/src/SparseTransform/DataStructures/DoubleMatrix.cs @@ -90,5 +90,28 @@ namespace DataStructures } return result; } + + /// <summary> + /// Multiply this matrix with another matrix + /// </summary> + /// <param name="other">second matrix</param> + /// <returns>product matrix</returns> + public DoubleMatrix Multiply(IntegerMatrix other) + { + DoubleMatrix result = new DoubleMatrix(this.RowCount, other.ColumnCount); + for (int i = 0; i < this.RowCount; i++) + { + for (int j = 0; j < other.ColumnCount; j++) + { + double s = 0; + for (int k = 0; k < this.ColumnCount; k++) + { + s += this[i, k] * other[k, j]; + } + result[i, j] = s; + } + } + return result; + } } } \ No newline at end of file