@Test public void testMatrix() { PeriodicDummies dummies = new PeriodicDummies(5); for (int len = 3; len < 12; ++len) { Matrix matrix = dummies.matrix(len); for (DataBlock row : matrix.rowList()) { assertTrue(row.sum() == 1); }; } }
public Matrix matrix(int len) { Matrix m = new Matrix(len, period); DataBlockIterator columns = m.columns(); DataBlock col = columns.getData(); int pos = 0; do { int beg=(pos++)-start; if (beg<0) beg+=period; col.extract(beg, -1, period).set(1); } while (columns.next()); return m; }
PeriodicDummies { public Matrix matrix(int len) { Matrix m = new Matrix(len, period); DataBlockIterator columns = m.columns(); DataBlock col = columns.getData(); int pos = 0; do { int beg=(pos++)-start; if (beg<0) beg+=period; col.extract(beg, -1, period).set(1); } while (columns.next()); return m; } }
PeriodicDummies { public Matrix matrix(int len) { Matrix m = new Matrix(len, period); DataBlockIterator columns = m.columns(); DataBlock col = columns.getData(); int pos = 0; do { int beg=(pos++)-start; if (beg<0) beg+=period; col.extract(beg, -1, period).set(1); } while (columns.next()); return m; } PeriodicDummies(int period);  PeriodicDummies(int period, int start); }
PeriodicDummies { public Matrix matrix(int len) { Matrix m = new Matrix(len, period); DataBlockIterator columns = m.columns(); DataBlock col = columns.getData(); int pos = 0; do { int beg=(pos++)-start; if (beg<0) beg+=period; col.extract(beg, -1, period).set(1); } while (columns.next()); return m; } PeriodicDummies(int period);  PeriodicDummies(int period, int start); Matrix matrix(int len); }
PeriodicDummies { public Matrix matrix(int len) { Matrix m = new Matrix(len, period); DataBlockIterator columns = m.columns(); DataBlock col = columns.getData(); int pos = 0; do { int beg=(pos++)-start; if (beg<0) beg+=period; col.extract(beg, -1, period).set(1); } while (columns.next()); return m; } PeriodicDummies(int period);  PeriodicDummies(int period, int start); Matrix matrix(int len);  }