@Test
public void testMapFunctions() throws FractionConversionException {
SparseFieldVector<Fraction> v1 = new SparseFieldVector<Fraction>(field,vec1);
//octave = v1 .+ 2.0
FieldVector<Fraction> v_mapAdd = v1.mapAdd(new Fraction(2));
Fraction[] result_mapAdd = {new Fraction(3), new Fraction(4), new Fraction(5)};
Assert.assertArrayEquals("compare vectors" ,result_mapAdd,v_mapAdd.toArray());
//octave = v1 .+ 2.0
FieldVector<Fraction> v_mapAddToSelf = v1.copy();
v_mapAddToSelf.mapAddToSelf(new Fraction(2));
Fraction[] result_mapAddToSelf = {new Fraction(3), new Fraction(4), new Fraction(5)};
Assert.assertArrayEquals("compare vectors" ,result_mapAddToSelf,v_mapAddToSelf.toArray());
//octave = v1 .- 2.0
FieldVector<Fraction> v_mapSubtract = v1.mapSubtract(new Fraction(2));
Fraction[] result_mapSubtract = {new Fraction(-1), new Fraction(0), new Fraction(1)};
Assert.assertArrayEquals("compare vectors" ,result_mapSubtract,v_mapSubtract.toArray());
//octave = v1 .- 2.0
FieldVector<Fraction> v_mapSubtractToSelf = v1.copy();
v_mapSubtractToSelf.mapSubtractToSelf(new Fraction(2));
Fraction[] result_mapSubtractToSelf = {new Fraction(-1), new Fraction(0), new Fraction(1)};
Assert.assertArrayEquals("compare vectors" ,result_mapSubtractToSelf,v_mapSubtractToSelf.toArray());
//octave = v1 .* 2.0
FieldVector<Fraction> v_mapMultiply = v1.mapMultiply(new Fraction(2));
Fraction[] result_mapMultiply = {new Fraction(2), new Fraction(4), new Fraction(6)};
Assert.assertArrayEquals("compare vectors" ,result_mapMultiply,v_mapMultiply.toArray());
//octave = v1 .* 2.0
FieldVector<Fraction> v_mapMultiplyToSelf = v1.copy();
v_mapMultiplyToSelf.mapMultiplyToSelf(new Fraction(2));
Fraction[] result_mapMultiplyToSelf = {new Fraction(2), new Fraction(4), new Fraction(6)};
Assert.assertArrayEquals("compare vectors" ,result_mapMultiplyToSelf,v_mapMultiplyToSelf.toArray());
//octave = v1 ./ 2.0
FieldVector<Fraction> v_mapDivide = v1.mapDivide(new Fraction(2));
Fraction[] result_mapDivide = {new Fraction(.5d), new Fraction(1), new Fraction(1.5d)};
Assert.assertArrayEquals("compare vectors" ,result_mapDivide,v_mapDivide.toArray());
//octave = v1 ./ 2.0
FieldVector<Fraction> v_mapDivideToSelf = v1.copy();
v_mapDivideToSelf.mapDivideToSelf(new Fraction(2));
Fraction[] result_mapDivideToSelf = {new Fraction(.5d), new Fraction(1), new Fraction(1.5d)};
Assert.assertArrayEquals("compare vectors" ,result_mapDivideToSelf,v_mapDivideToSelf.toArray());
//octave = v1 .^-1
FieldVector<Fraction> v_mapInv = v1.mapInv();
Fraction[] result_mapInv = {new Fraction(1),new Fraction(0.5d),new Fraction(3.333333333333333e-01d)};
Assert.assertArrayEquals("compare vectors" ,result_mapInv,v_mapInv.toArray());
//octave = v1 .^-1
FieldVector<Fraction> v_mapInvToSelf = v1.copy();
v_mapInvToSelf.mapInvToSelf();
Fraction[] result_mapInvToSelf = {new Fraction(1),new Fraction(0.5d),new Fraction(3.333333333333333e-01d)};
Assert.assertArrayEquals("compare vectors" ,result_mapInvToSelf,v_mapInvToSelf.toArray());
}