@@ -136,6 +136,26 @@ public void testInverseOfNearSingular()
136
136
Matrix identity = m .multiply (mInv );
137
137
assertTrue ("Matrix inverse is incorrect" , equals (identity , Matrix .IDENTITY , NEAR_SINGULAR_EQUALITY_TOLERANCE ));
138
138
}
139
+
140
+ @ Test
141
+ public void testDeterminantEqualToDeterminantOfTranspose ()
142
+ {
143
+ // Create random matrix.
144
+ Matrix matrix = new Matrix (
145
+ random .nextDouble (), random .nextDouble (), random .nextDouble (), random .nextDouble (),
146
+ random .nextDouble (), random .nextDouble (), random .nextDouble (), random .nextDouble (),
147
+ random .nextDouble (), random .nextDouble (), random .nextDouble (), random .nextDouble (),
148
+ random .nextDouble (), random .nextDouble (), random .nextDouble (), random .nextDouble ());
149
+
150
+ // Calculate the determinant.
151
+ double determinant = matrix .getDeterminant ();
152
+
153
+ // Transpose the matrix.
154
+ Matrix transpose = matrix .getTranspose ();
155
+
156
+ // The determinant and the determinant of the transpose should be equal.
157
+ assertEquals (determinant , transpose .getDeterminant (), EQUALITY_TOLERANCE );
158
+ }
139
159
140
160
//**************************************************************//
141
161
//******************** Helper Methods ************************//
0 commit comments