예제 #1
0
 //	public void testRowsIndexed2() {
 //		SparseMatrixLil A = new SparseMatrixLil("1 5 3; 2 8 5; 1 9 4; 2 5 3");
 //		DenseMatrix indexes = new DenseMatrix("2; 1; 1");
 //		SparseMatrixLil B = A.rows2(indexes);
 //		System.out.println(B.toDense());
 //		assertTrue(B.equals(new SparseMatrixLil("1 9 4; 2 8 5; 2 8 5")));
 //	}
 public void testRowsIndexeddense() {
   DenseMatrix A = new DenseMatrix("1 5 3; 2 8 5; 1 9 4; 2 5 3");
   DenseMatrix indexes = new DenseMatrix("2; 1; 1");
   DenseMatrix B = A.rows(indexes);
   System.out.println(B);
   assertTrue(B.equals(new DenseMatrix("1 9 4; 2 8 5; 2 8 5")));
 }
예제 #2
0
 public void testSlice() {
   DenseMatrix A = rand(5, 8);
   DenseMatrix B = rand(5, 12);
   DenseMatrix C = rand(4, 8);
   DenseMatrix AB = A.concatRight(B);
   assertTrue(A.equals(AB.cols(0, 8)));
   assertTrue(B.equals(AB.cols(8, 20)));
   DenseMatrix AC = A.concatDown(C);
   assertTrue(A.equals(AC.rows(0, 5)));
   assertTrue(C.equals(AC.rows(5, 9)));
 }