Skip to content

Commit

Permalink
✨: add Hadamard method
Browse files Browse the repository at this point in the history
  • Loading branch information
VsIG-official committed Feb 21, 2022
1 parent 24b3b36 commit 56f4751
Showing 1 changed file with 2 additions and 5 deletions.
7 changes: 2 additions & 5 deletions SML/SML/Matrix/Matrix.cs
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@ public Matrix Hadamard(Matrix matrix)
"matrix shouldn't be null");
}

if (Columns != matrix.Rows || Rows != matrix.Columns)
if (Columns != matrix.Columns || Rows != matrix.Rows)
{
throw new MatrixException("Matrixes should have same dimensions");
}
Expand All @@ -174,10 +174,7 @@ public Matrix Hadamard(Matrix matrix)
{
for (int j = 0; j < result.Columns; j++)
{
for (int k = 0; k < matrix.Rows; k++)
{
result[i, j] = Array[i, k] * matrix[k, j];
}
result[i, j] = Array[i, j] * matrix[i, j];
}
}

Expand Down

0 comments on commit 56f4751

Please sign in to comment.