MultiCholetteDocument extends ActiveDocument<MultiCholetteSpecification, TsVariables, MultiBenchmarkingResults> implements Cloneable { @Override public MultiCholetteDocument clone() { MultiCholetteDocument cl = (MultiCholetteDocument) super.clone(); return cl; } MultiCholetteDocument();  MultiCholetteDocument(ProcessingContext context); void setVariables(TsVariables vars); @Override MultiCholetteDocument clone(); @Override InformationSet write(boolean verbose); @Override boolean read(InformationSet info); @Override String getDescription();  }
@Test public void testRedundantContemporaneous() { int N = 10; Matrix M = new Matrix(240, N * N); M.randomize(); Ts[] s = new Ts[N * N]; TsVariables vars=new TsVariables(); TsPeriod start = new TsPeriod(TsFrequency.Monthly, 1980, 0); for (int i = 0; i < N * N; ++i) { TsData data=new TsData(start, M.column(i)); vars.set("s" + i , new TsVariable(data)); } MultiCholetteSpecification spec = new MultiCholetteSpecification(); for (int i = 0; i < N; ++i) { StringBuilder str=new StringBuilder(); str.append(.5 * N).append('='); int[] ids = new int[N]; for (int j = 0; j < N; ++j) { str.append("+s").append(i + N * j); } spec.addConstraint(str.toString()); } for (int i = 0; i < N ; ++i) { StringBuilder str=new StringBuilder(); str.append(.5 * N).append('='); for (int j = 0; j < N; ++j) { str.append("+s").append(j + N * i); } spec.addConstraint(str.toString()); } spec.addConstraint("0=s2+2*s6-s10-s18"); spec.addConstraint("0=s4+2*s11-s18"); MultiCholetteDocument doc = new MultiCholetteDocument(); doc.setInput(vars); doc.setSpecification(spec); MultiBenchmarkingResults results = doc.getResults(); for (int j = 0; j < N; ++j) { TsData S = null; for (int i = 0; i < N; ++i) { S = TsData.add(S, results.getData("benchmarked.s" + (i + N * j), TsData.class)); } DescriptiveStatistics stat = new DescriptiveStatistics(S); assertTrue(Math.abs(stat.getAverage() - .5 * N) < 1e-6); assertTrue(stat.getStdev() < 1e-9); } for (int j = 0; j < N; ++j) { TsData S = null; for (int i = 0; i < N; ++i) { S = TsData.add(S, results.getData("benchmarked.s" + (N * i + j), TsData.class)); } DescriptiveStatistics stat = new DescriptiveStatistics(S); assertTrue(Math.abs(stat.getAverage() - .5 * N) < 1e-6); assertTrue(stat.getStdev() < 1e-9); } TsData S = results.getData("benchmarked.s2", TsData.class); S = TsData.add(S, results.getData("benchmarked.s6", TsData.class).times(2)); S = TsData.subtract(S, results.getData("benchmarked.s10", TsData.class)); S = TsData.subtract(S, results.getData("benchmarked.s18", TsData.class)); DescriptiveStatistics stat = new DescriptiveStatistics(S); assertTrue(Math.abs(stat.getAverage()) < 1e-6); assertTrue(stat.getStdev() < 1e-9); MultiCholetteDocument clone = doc.clone(); assertTrue(clone.getResults() != null); }