From 02ff9ae147cedd0c4e2962dc03aeefd0f57ffc96 Mon Sep 17 00:00:00 2001 From: Paul Nitzke <14367-paulenit@users.noreply.git.rwth-aachen.de> Date: Mon, 20 Jun 2022 01:00:52 +0200 Subject: [PATCH] Add Multiply method for Double-Integer * This is the important variation that is used when multiplying the input matrix with the seed matrix --- .../DataStructures/DoubleMatrix.cs | 23 +++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/src/SparseTransform/DataStructures/DoubleMatrix.cs b/src/SparseTransform/DataStructures/DoubleMatrix.cs index ff39be3..2b61de0 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 -- GitLab