commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From l..@apache.org
Subject svn commit: r662241 [2/2] - in /commons/proper/math/branches/MATH_2_0/src: java/org/apache/commons/math/linear/ site/xdoc/ test/org/apache/commons/math/linear/
Date Sun, 01 Jun 2008 16:22:20 GMT
Modified: commons/proper/math/branches/MATH_2_0/src/test/org/apache/commons/math/linear/QRDecompositionImplTest.java
URL: http://svn.apache.org/viewvc/commons/proper/math/branches/MATH_2_0/src/test/org/apache/commons/math/linear/QRDecompositionImplTest.java?rev=662241&r1=662240&r2=662241&view=diff
==============================================================================
--- commons/proper/math/branches/MATH_2_0/src/test/org/apache/commons/math/linear/QRDecompositionImplTest.java
(original)
+++ commons/proper/math/branches/MATH_2_0/src/test/org/apache/commons/math/linear/QRDecompositionImplTest.java
Sun Jun  1 09:22:19 2008
@@ -59,21 +59,21 @@
 
     /** test dimensions */
     public void testDimensions() {
-        RealMatrixImpl matrix = new RealMatrixImpl(testData3x3NonSingular);
+        RealMatrixImpl matrix = new RealMatrixImpl(testData3x3NonSingular, false);
         QRDecomposition qr = new QRDecompositionImpl(matrix);
         assertEquals("3x3 Q size", qr.getQ().getRowDimension(), 3);
         assertEquals("3x3 Q size", qr.getQ().getColumnDimension(), 3);
         assertEquals("3x3 R size", qr.getR().getRowDimension(), 3);
         assertEquals("3x3 R size", qr.getR().getColumnDimension(), 3);
 
-        matrix = new RealMatrixImpl(testData4x3);
+        matrix = new RealMatrixImpl(testData4x3, false);
         qr = new QRDecompositionImpl(matrix);
         assertEquals("4x3 Q size", qr.getQ().getRowDimension(), 4);
         assertEquals("4x3 Q size", qr.getQ().getColumnDimension(), 4);
         assertEquals("4x3 R size", qr.getR().getRowDimension(), 4);
         assertEquals("4x3 R size", qr.getR().getColumnDimension(), 3);
 
-        matrix = new RealMatrixImpl(testData3x4);
+        matrix = new RealMatrixImpl(testData3x4, false);
         qr = new QRDecompositionImpl(matrix);
         assertEquals("3x4 Q size", qr.getQ().getRowDimension(), 3);
         assertEquals("3x4 Q size", qr.getQ().getColumnDimension(), 3);
@@ -83,24 +83,24 @@
 
     /** test A = QR */
     public void testAEqualQR() {
-        RealMatrix A = new RealMatrixImpl(testData3x3NonSingular);
+        RealMatrix A = new RealMatrixImpl(testData3x3NonSingular, false);
         QRDecomposition qr = new QRDecompositionImpl(A);
         RealMatrix Q = qr.getQ();
         RealMatrix R = qr.getR();
         double norm = Q.multiply(R).subtract(A).getNorm();
         assertEquals("3x3 nonsingular A = QR", 0, norm, normTolerance);
 
-        RealMatrix matrix = new RealMatrixImpl(testData3x3Singular);
+        RealMatrix matrix = new RealMatrixImpl(testData3x3Singular, false);
         qr = new QRDecompositionImpl(matrix);
         norm = qr.getQ().multiply(qr.getR()).subtract(matrix).getNorm();
         assertEquals("3x3 singular A = QR", 0, norm, normTolerance);
 
-        matrix = new RealMatrixImpl(testData3x4);
+        matrix = new RealMatrixImpl(testData3x4, false);
         qr = new QRDecompositionImpl(matrix);
         norm = qr.getQ().multiply(qr.getR()).subtract(matrix).getNorm();
         assertEquals("3x4 A = QR", 0, norm, normTolerance);
 
-        matrix = new RealMatrixImpl(testData4x3);
+        matrix = new RealMatrixImpl(testData4x3, false);
         qr = new QRDecompositionImpl(matrix);
         norm = qr.getQ().multiply(qr.getR()).subtract(matrix).getNorm();
         assertEquals("4x3 A = QR", 0, norm, normTolerance);
@@ -108,28 +108,28 @@
 
     /** test the orthogonality of Q */
     public void testQOrthogonal() {
-        RealMatrix matrix = new RealMatrixImpl(testData3x3NonSingular);
+        RealMatrix matrix = new RealMatrixImpl(testData3x3NonSingular, false);
         matrix = new QRDecompositionImpl(matrix).getQ();
         RealMatrix eye = MatrixUtils.createRealIdentityMatrix(3);
         double norm = matrix.transpose().multiply(matrix).subtract(eye)
                 .getNorm();
         assertEquals("3x3 nonsingular Q'Q = I", 0, norm, normTolerance);
 
-        matrix = new RealMatrixImpl(testData3x3Singular);
+        matrix = new RealMatrixImpl(testData3x3Singular, false);
         matrix = new QRDecompositionImpl(matrix).getQ();
         eye = MatrixUtils.createRealIdentityMatrix(3);
         norm = matrix.transpose().multiply(matrix).subtract(eye)
                 .getNorm();
         assertEquals("3x3 singular Q'Q = I", 0, norm, normTolerance);
 
-        matrix = new RealMatrixImpl(testData3x4);
+        matrix = new RealMatrixImpl(testData3x4, false);
         matrix = new QRDecompositionImpl(matrix).getQ();
         eye = MatrixUtils.createRealIdentityMatrix(3);
         norm = matrix.transpose().multiply(matrix).subtract(eye)
                 .getNorm();
         assertEquals("3x4 Q'Q = I", 0, norm, normTolerance);
 
-        matrix = new RealMatrixImpl(testData4x3);
+        matrix = new RealMatrixImpl(testData4x3, false);
         matrix = new QRDecompositionImpl(matrix).getQ();
         eye = MatrixUtils.createRealIdentityMatrix(4);
         norm = matrix.transpose().multiply(matrix).subtract(eye)
@@ -139,21 +139,21 @@
 
     /** test that R is upper triangular */
     public void testRUpperTriangular() {
-        RealMatrixImpl matrix = new RealMatrixImpl(testData3x3NonSingular);
+        RealMatrixImpl matrix = new RealMatrixImpl(testData3x3NonSingular, false);
         RealMatrix R = new QRDecompositionImpl(matrix).getR();
         for (int i = 0; i < R.getRowDimension(); i++)
             for (int j = 0; j < i; j++)
                 assertEquals("R lower triangle", R.getEntry(i, j), 0,
                         entryTolerance);
 
-        matrix = new RealMatrixImpl(testData3x4);
+        matrix = new RealMatrixImpl(testData3x4, false);
         R = new QRDecompositionImpl(matrix).getR();
         for (int i = 0; i < R.getRowDimension(); i++)
             for (int j = 0; j < i; j++)
                 assertEquals("R lower triangle", R.getEntry(i, j), 0,
                         entryTolerance);
 
-        matrix = new RealMatrixImpl(testData4x3);
+        matrix = new RealMatrixImpl(testData4x3, false);
         R = new QRDecompositionImpl(matrix).getR();
         for (int i = 0; i < R.getRowDimension(); i++)
             for (int j = 0; j < i; j++)

Modified: commons/proper/math/branches/MATH_2_0/src/test/org/apache/commons/math/linear/RealMatrixImplTest.java
URL: http://svn.apache.org/viewvc/commons/proper/math/branches/MATH_2_0/src/test/org/apache/commons/math/linear/RealMatrixImplTest.java?rev=662241&r1=662240&r2=662241&view=diff
==============================================================================
--- commons/proper/math/branches/MATH_2_0/src/test/org/apache/commons/math/linear/RealMatrixImplTest.java
(original)
+++ commons/proper/math/branches/MATH_2_0/src/test/org/apache/commons/math/linear/RealMatrixImplTest.java
Sun Jun  1 09:22:19 2008
@@ -116,16 +116,19 @@
     
     /** test copy functions */
     public void testCopyFunctions() {
-        RealMatrixImpl m = new RealMatrixImpl(testData);
-        RealMatrixImpl m2 = new RealMatrixImpl(m.getData());
-        assertEquals(m2,m);
+        RealMatrixImpl m1 = new RealMatrixImpl(testData);
+        RealMatrixImpl m2 = new RealMatrixImpl(m1.getData());
+        assertEquals(m2,m1);
+        RealMatrixImpl m3 = new RealMatrixImpl(testData);
+        RealMatrixImpl m4 = new RealMatrixImpl(m3.getData(), false);
+        assertEquals(m4,m3);
     }           
     
     /** test add */
     public void testAdd() {
         RealMatrixImpl m = new RealMatrixImpl(testData);
         RealMatrixImpl mInv = new RealMatrixImpl(testDataInv);
-        RealMatrixImpl mPlusMInv = (RealMatrixImpl)m.add(mInv);
+        RealMatrix mPlusMInv = m.add(mInv);
         double[][] sumEntries = mPlusMInv.getData();
         for (int row = 0; row < m.getRowDimension(); row++) {
             for (int col = 0; col < m.getColumnDimension(); col++) {



Mime
View raw message