SparseFieldVector<Fraction> v2_t = new SparseFieldVector<Fraction>(field,vec2);
//octave = v1 + v2
FieldVector<Fraction> v_add = v1.add(v2);
Fraction[] result_add = {new Fraction(5), new Fraction(7), new Fraction(9)};
assertEquals("compare vect" ,v_add.getData(),result_add);
SparseFieldVector<Fraction> vt2 = new SparseFieldVector<Fraction>(field,vec2);
FieldVector<Fraction> v_add_i = v1.add(vt2);
Fraction[] result_add_i = {new Fraction(5), new Fraction(7), new Fraction(9)};
assertEquals("compare vect" ,v_add_i.getData(),result_add_i);
//octave = v1 - v2
SparseFieldVector<Fraction> v_subtract = v1.subtract(v2);
Fraction[] result_subtract = {new Fraction(-3), new Fraction(-3), new Fraction(-3)};
assertClose("compare vect" ,v_subtract.getData(),result_subtract,normTolerance);
FieldVector<Fraction> v_subtract_i = v1.subtract(vt2);
Fraction[] result_subtract_i = {new Fraction(-3), new Fraction(-3), new Fraction(-3)};
assertClose("compare vect" ,v_subtract_i.getData(),result_subtract_i,normTolerance);
// octave v1 .* v2
FieldVector<Fraction> v_ebeMultiply = v1.ebeMultiply(v2);
Fraction[] result_ebeMultiply = {new Fraction(4), new Fraction(10), new Fraction(18)};
assertClose("compare vect" ,v_ebeMultiply.getData(),result_ebeMultiply,normTolerance);
FieldVector<Fraction> v_ebeMultiply_2 = v1.ebeMultiply(v2_t);
Fraction[] result_ebeMultiply_2 = {new Fraction(4), new Fraction(10), new Fraction(18)};
assertClose("compare vect" ,v_ebeMultiply_2.getData(),result_ebeMultiply_2,normTolerance);
// octave v1 ./ v2
FieldVector<Fraction> v_ebeDivide = v1.ebeDivide(v2);
Fraction[] result_ebeDivide = {new Fraction(0.25d), new Fraction(0.4d), new Fraction(0.5d)};
assertClose("compare vect" ,v_ebeDivide.getData(),result_ebeDivide,normTolerance);
FieldVector<Fraction> v_ebeDivide_2 = v1.ebeDivide(v2_t);
Fraction[] result_ebeDivide_2 = {new Fraction(0.25d), new Fraction(0.4d), new Fraction(0.5d)};
assertClose("compare vect" ,v_ebeDivide_2.getData(),result_ebeDivide_2,normTolerance);
// octave dot(v1,v2)
Fraction dot = v1.dotProduct(v2);
assertEquals("compare val ",new Fraction(32), dot);
// octave dot(v1,v2_t)
Fraction dot_2 = v1.dotProduct(v2_t);
assertEquals("compare val ",new Fraction(32), dot_2);
FieldMatrix<Fraction> m_outerProduct = v1.outerProduct(v2);
assertEquals("compare val ",new Fraction(4), m_outerProduct.getEntry(0,0));
FieldMatrix<Fraction> m_outerProduct_2 = v1.outerProduct(v2_t);
assertEquals("compare val ",new Fraction(4), m_outerProduct_2.getEntry(0,0));
}