psteitz 2004/04/03 14:19:24
Modified: math/src/test/org/apache/commons/math/linear
RealMatrixImplTest.java
Log:
Add tests to verify InvalidMatrixException is thrown by inverse() for singular or
non-square matrices.
Revision Changes Path
1.12 +19 -1
jakarta-commons/math/src/test/org/apache/commons/math/linear/RealMatrixImplTest.java
Index: RealMatrixImplTest.java
===================================================================
RCS file:
/home/cvs/jakarta-commons/math/src/test/org/apache/commons/math/linear/RealMatrixImplTest.java,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -r1.11 -r1.12
--- RealMatrixImplTest.java 21 Feb 2004 21:35:17 -0000 1.11
+++ RealMatrixImplTest.java 3 Apr 2004 22:19:24 -0000 1.12
@@ -200,6 +200,24 @@
RealMatrix mInv = new RealMatrixImpl(testDataInv);
assertClose("inverse",mInv,m.inverse(),normTolerance);
assertClose("inverse^2",m,m.inverse().inverse(),10E-12);
+
+ // Not square
+ m = new RealMatrixImpl(testData2);
+ try {
+ m.inverse();
+ fail("Expecting InvalidMatrixException");
+ } catch (InvalidMatrixException ex) {
+ // expected
+ }
+
+ // Singular
+ m = new RealMatrixImpl(singular);
+ try {
+ m.inverse();
+ fail("Expecting InvalidMatrixException");
+ } catch (InvalidMatrixException ex) {
+ // expected
+ }
}
/** test solve */
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]