Ejemplo n.º 1
0
 /**
  * create matroid with matrix a as element repeated for rows and cols
  *
  * @param a
  * @param rows
  * @param cols
  * @return
  */
 public static int[][] repmat(int[][] a, int rows, int cols) {
   int[][] b = (int[][]) ArrayUtils.copy(a);
   for (int i = 0; i < cols; i++) {
     b = concat(b, a, false);
   }
   int[][] c = (int[][]) ArrayUtils.copy(b);
   for (int i = 0; i < rows; i++) {
     c = concat(c, b, true);
   }
   return c;
 }
Ejemplo n.º 2
0
 @Test
 public void testCopy() {
   String[] from = {"Lorem", "ipsum", "dolor", "sit"};
   String[] to = new String[from.length];
   ArrayUtils.copy(from, to);
   // We should have two different objects
   assertFalse(from == to);
   assertArrayEquals(from, to);
 }