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

Method testSwapRows

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

Test of swapRows method, of class DenseMatrix.

()

Source from the content-addressed store, hash-verified

682 * Test of swapRows method, of class DenseMatrix.
683 */
684 @Test
685 public void testSwapRows()
686 {
687 System.out.println("swapRows");
688
689 Matrix Expected = new DenseMatrix(new double[][]
690 {
691 {5, 5, 3, 7, 2, 10, 0},
692 {1, 2, 6, 5, 8, 1, 9},
693 {8, 0, 5, 7, 9, 1, 8},
694 {9, 3, 2, 7, 2, 4, 8},
695 {1, 6, 8, 3, 1, 5, 10}
696 } );
697
698 Matrix test = C.clone();
699
700
701 test.swapRows(1, 0);
702 test.swapRows(1, 0);
703 assertEquals(C, test);
704 test.swapRows(0, 1);
705 test.swapRows(0, 1);
706 assertEquals(C, test);
707 test.swapRows(3, 3);
708 assertEquals(C, test);
709
710
711 test.swapRows(0, 4);
712 test.swapRows(0, 1);
713 assertEquals(Expected, test);
714
715
716 test = C.clone();
717 test.swapRows(4, 0);
718 test.swapRows(1, 0);
719 assertEquals(Expected, test);
720 }
721
722 /**
723 * 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