defaults.put("basis", basis);
defaults.put("engine", econf);
settings.put("defaults", defaults);
SimConfig config = new SimConfig(settings);
SimEngineImpl engine = new SimEngineImpl(config.getSub("engine"));
String[] components = new String[1024];
for (int i = 0; i < components.length; i++) {
components[i] = "B" + String.valueOf(i);
}
try {
engine.bmk(TestableCallback.noop(), "base", components);
Thread.sleep(100);
engine.vmk(TestableCallback.noop(), "base", "article");
Thread.sleep(100);
engine.rmk(TestableCallback.noop(), "article", "article", "jensenshannon");
Thread.sleep(100);
VectorSetListener listener = new TestMemListener();
engine.listen("article", listener);
} catch (InterruptedException e) {
e.printStackTrace();
}
start = new Date().getTime();
for (int i = 1; i <= 10000; i++) {
float total = 0;
float[] distr = new float[1024];
for (int j = 0; j < 1024; j++) {
distr[j] = (float) Math.random();
total += distr[j];
}
for (int j = 0; j < 1024; j++) {
distr[j] = distr[j] / total;
}
engine.iadd(TestableCallback.noop(), "article", i, Basis.sparsify(4096, distr));
}
}