Skip to content
This repository has been archived by the owner on Nov 19, 2020. It is now read-only.

Update MatrixH.cs #2211

Open
wants to merge 3 commits into
base: development
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Sources/Accord.Imaging/MatrixH.cs
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ public MatrixH(float[] elements)
else if (elements.Length == 9)
{
this.elements = new float[8];
for (int i = 0; i < elements.Length; i++)
for (int i = 0; i < this.elements.Length; i++)
this.elements[i] = (float)(elements[i] / elements[8]);
}
else
Expand Down
9 changes: 9 additions & 0 deletions Unit Tests/Accord.Tests.Imaging/MatrixHTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,15 @@ public void MultiplyTest()
Assert.IsTrue(Accord.Math.Matrix.IsEqual(
expected.Elements, actual.Elements));

try
{
A = new MatrixH(new float[8] {1, 0, 0, 0, 1, 0, 0, 1});
B = new MatrixH(new float[9] {1, 0, 0, 0, 1, 0, 0, 0, 1});
}
catch (System.Exception e)
{
Assert.Fail(e.Message);
}

double[,] a =
{
Expand Down