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

Method testQr_0args

JSAT/test/jsat/linear/DenseMatrixTest.java:817–846  ·  view source on GitHub ↗

Test of qr method, of class DenseMatrix.

()

Source from the content-addressed store, hash-verified

815 * Test of qr method, of class DenseMatrix.
816 */
817 @Test
818 public void testQr_0args()
819 {
820 System.out.println("qr");
821 Matrix[] qr;
822 //3 properties to test
823 // R is uper triangular
824 // Q*Q' = I
825 // A = Q*R
826
827
828
829 qr = A.clone().qr();
830 assertTrue(A.equals(qr[0].multiply(qr[1]), 1e-14));
831 assertTrue(DenseMatrix.eye(A.rows()).equals(qr[0].multiply(qr[0].transpose()), 1e-14));
832
833
834 qr = B.clone().qr();
835 assertTrue(B.equals(qr[0].multiply(qr[1]), 1e-14));
836 assertTrue(DenseMatrix.eye(B.rows()).equals(qr[0].multiply(qr[0].transpose()), 1e-14));
837
838
839 qr = C.clone().qr();
840 assertTrue(C.equals(qr[0].multiply(qr[1]), 1e-14));
841 assertTrue(DenseMatrix.eye(C.rows()).equals(qr[0].multiply(qr[0].transpose()), 1e-14));
842
843 qr = C.transpose().qr();
844 assertTrue(C.transpose().equals(qr[0].multiply(qr[1]), 1e-14));
845 assertTrue(DenseMatrix.eye(C.transpose().rows()).equals(qr[0].multiply(qr[0].transpose()), 1e-14));
846 }
847
848 /**
849 * 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