MCPcopy Create free account
hub / github.com/EdwardRaff/JSAT / testQr_0args

Method testQr_0args

JSAT/test/jsat/linear/MatrixOfVecsTest.java:826–855  ·  view source on GitHub ↗

Test of qr method, of class DenseMatrix.

()

Source from the content-addressed store, hash-verified

824 * Test of qr method, of class DenseMatrix.
825 */
826 @Test
827 public void testQr_0args()
828 {
829 System.out.println("qr");
830 Matrix[] qr;
831 //3 properties to test
832 // R is uper triangular
833 // Q*Q' = I
834 // A = Q*R
835
836
837
838 qr = A.clone().qr();
839 assertTrue(A.equals(qr[0].multiply(qr[1]), 1e-14));
840 assertTrue(DenseMatrix.eye(A.rows()).equals(qr[0].multiply(qr[0].transpose()), 1e-14));
841
842
843 qr = B.clone().qr();
844 assertTrue(B.equals(qr[0].multiply(qr[1]), 1e-14));
845 assertTrue(DenseMatrix.eye(B.rows()).equals(qr[0].multiply(qr[0].transpose()), 1e-14));
846
847
848 qr = C.clone().qr();
849 assertTrue(C.equals(qr[0].multiply(qr[1]), 1e-14));
850 assertTrue(DenseMatrix.eye(C.rows()).equals(qr[0].multiply(qr[0].transpose()), 1e-14));
851
852 qr = C.transpose().qr();
853 assertTrue(C.transpose().equals(qr[0].multiply(qr[1]), 1e-14));
854 assertTrue(DenseMatrix.eye(C.transpose().rows()).equals(qr[0].multiply(qr[0].transpose()), 1e-14));
855 }
856
857 /**
858 * Test of qr method, of class DenseMatrix.

Callers

nothing calls this directly

Calls 7

eyeMethod · 0.80
cloneMethod · 0.65
equalsMethod · 0.65
qrMethod · 0.45
multiplyMethod · 0.45
rowsMethod · 0.45
transposeMethod · 0.45

Tested by

no test coverage detected