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

Method testSwapRows

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

Test of swapRows method, of class DenseMatrix.

()

Source from the content-addressed store, hash-verified

691 * Test of swapRows method, of class DenseMatrix.
692 */
693 @Test
694 public void testSwapRows()
695 {
696 System.out.println("swapRows");
697
698 Matrix Expected = new DenseMatrix(new double[][]
699 {
700 {5, 5, 3, 7, 2, 10, 0},
701 {1, 2, 6, 5, 8, 1, 9},
702 {8, 0, 5, 7, 9, 1, 8},
703 {9, 3, 2, 7, 2, 4, 8},
704 {1, 6, 8, 3, 1, 5, 10}
705 } );
706
707 Matrix test = C.clone();
708
709
710 test.swapRows(1, 0);
711 test.swapRows(1, 0);
712 assertEquals(C, test);
713 test.swapRows(0, 1);
714 test.swapRows(0, 1);
715 assertEquals(C, test);
716 test.swapRows(3, 3);
717 assertEquals(C, test);
718
719
720 test.swapRows(0, 4);
721 test.swapRows(0, 1);
722 assertEquals(Expected, test);
723
724
725 test = C.clone();
726 test.swapRows(4, 0);
727 test.swapRows(1, 0);
728 assertEquals(Expected, test);
729 }
730
731 /**
732 * Test of zeroOut method, of class DenseMatrix.

Callers

nothing calls this directly

Calls 2

swapRowsMethod · 0.95
cloneMethod · 0.65

Tested by

no test coverage detected