@Test
public void testPlus() throws Exception {

    Vector plusResult1 = MatVecOp.plus(dv, sv);
    Vector plusResult2 = MatVecOp.plus(sv, dv);
    Vector plusResult3 = MatVecOp.plus(sv, sv);
    Vector plusResult4 = MatVecOp.plus(dv, dv);
    Assert.assertTrue(plusResult1 instanceof DenseVector);
    Assert.assertTrue(plusResult2 instanceof DenseVector);
    Assert.assertTrue(plusResult3 instanceof SparseVector);
    Assert.assertTrue(plusResult4 instanceof DenseVector);
    Assert.assertArrayEquals(((DenseVector) plusResult1).getData(), new double[]{2, 2, 4, 4}, TOL);
    Assert.assertArrayEquals(((DenseVector) plusResult2).getData(), new double[]{2, 2, 4, 4}, TOL);
    Assert.assertArrayEquals(((SparseVector) plusResult3).getIndices(), new int[]{0, 2});
    Assert.assertArrayEquals(((SparseVector) plusResult3).getValues(), new double[]{2., 2.}, TOL);
    Assert.assertArrayEquals(((DenseVector) plusResult4).getData(), new double[]{2, 4, 6, 8}, TOL);
}