Skip to content

Determinant fix #167

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 11 commits into
base: develop
Choose a base branch
from
Prev Previous commit
Next Next commit
Added unit-test.
Added a unit-test that checks if the determinant of a Matrix is equal to
the determinant of its transpose. This test will break without the
determinant-fix.
  • Loading branch information
wcmatthysen committed Apr 10, 2019
commit 1e5d3dad77d2f645dd325353053e0b03b6c3aa2e
20 changes: 20 additions & 0 deletions test/gov/nasa/worldwind/geom/MatrixTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,26 @@ public void testInverseOfNearSingular()
Matrix identity = m.multiply(mInv);
assertTrue("Matrix inverse is incorrect", equals(identity, Matrix.IDENTITY, NEAR_SINGULAR_EQUALITY_TOLERANCE));
}

@Test
public void testDeterminantEqualToDeterminantOfTranspose()
{
// Create sample matrix.
Matrix matrix = new Matrix(
1, 0, 0, 1,
1, 1, 0, 0,
0, 0, 1, 0,
0, 0, 0, 1);

// Calculate the determinant.
double determinant = matrix.getDeterminant();

// Transpose the matrix.
Matrix transpose = matrix.getTranspose();

// The determinant and the determinant of the transpose should be equal.
assertEquals(determinant, transpose.getDeterminant(), EQUALITY_TOLERANCE);
}

//**************************************************************//
//******************** Helper Methods ************************//
Expand Down