/** Test of copyColumnVectors method, of class MatrixFactory. */ public void testCopyColumnVectors_VectorizableArr() { System.out.println("copyColumnVectors"); Matrix m = this.createRandomMatrix(); int M = m.getNumRows(); int N = m.getNumColumns(); Vector[] cols = new Vector[N]; for (int j = 0; j < N; j++) { cols[j] = m.getColumn(j); } MatrixFactory<?> factory = this.createFactory(); @SuppressWarnings("unchecked") Matrix mr = factory.copyColumnVectors(cols); assertNotNull(mr); assertNotSame(m, mr); assertEquals(m, mr); for (int j = 0; j < N; j++) { assertEquals(m.getColumn(j), mr.getColumn(j)); } }
/** Test of copyColumnVectors method, of class MatrixFactory. */ public void testCopyColumnVectors_Collection() { System.out.println("copyColumnVectors"); Matrix m = this.createRandomMatrix(); int M = m.getNumRows(); int N = m.getNumColumns(); ArrayList<Vector> cols = new ArrayList<Vector>(M); for (int j = 0; j < N; j++) { cols.add(m.getColumn(j)); } MatrixFactory<?> factory = this.createFactory(); @SuppressWarnings("unchecked") Matrix mr = factory.copyColumnVectors(cols); assertNotNull(mr); assertNotSame(m, mr); assertEquals(m, mr); for (int j = 0; j < N; j++) { assertEquals(m.getColumn(j), mr.getColumn(j)); } }