use of org.apache.ignite.ml.math.impls.vector.SparseBlockDistributedVector in project ignite by apache.
the class SparseDistributedBlockMatrixTest method testMatrixVectorTimes.
/**
*/
public void testMatrixVectorTimes() {
IgniteUtils.setCurrentIgniteName(ignite.configuration().getIgniteInstanceName());
SparseBlockDistributedMatrix a = new SparseBlockDistributedMatrix(new double[][] { { 2.0, 4.0, 0.0 }, { -2.0, 1.0, 3.0 }, { -1.0, 0.0, 1.0 } });
SparseBlockDistributedVector b = new SparseBlockDistributedVector(new double[] { 1.0, 2.0, -1.0 });
SparseBlockDistributedVector res = new SparseBlockDistributedVector(new double[] { 10, -3.0, -2.0 });
Vector calculatedRes = a.times(b);
for (int i = 0; i < calculatedRes.size(); i++) assertEquals(UNEXPECTED_VAL + " for " + i, res.get(i), calculatedRes.get(i), PRECISION);
}
Aggregations