@Test(timeout=50000)
public void testTimesSparseEfficiency() {
Random raw = RandomUtils.getRandom();
Gamma gen = new Gamma(0.1, 0.1, raw);
// build two large sequential sparse matrices and multiply them
Matrix x = new SparseRowMatrix(1000, 2000, false);
for (int i = 0; i < 1000; i++) {
int[] values = new int[1000];
for (int k = 0; k < 1000; k++) {
int j = (int) Math.min(1000, gen.nextDouble());
values[j]++;
}
for (int j = 0; j < 1000; j++) {
if (values[j] > 0) {
x.set(i, j, values[j]);
}
}
}
Matrix y = new SparseRowMatrix(2000, 1000, false);
for (int i = 0; i < 2000; i++) {
int[] values = new int[1000];
for (int k = 0; k < 1000; k++) {
int j = (int) Math.min(1000, gen.nextDouble());
values[j]++;
}
for (int j = 0; j < 1000; j++) {
if (values[j] > 0) {
y.set(i, j, values[j]);