ArrayFieldVector<Fraction> v4 = new ArrayFieldVector<Fraction>(vec4);
FieldVectorTestImpl<Fraction> v2_t = new FieldVectorTestImpl<Fraction>(vec2);
FieldVector<Fraction> v_append_1 = v1.append(v2);
assertEquals(6, v_append_1.getDimension());
assertEquals(new Fraction(4), v_append_1.getEntry(3));
FieldVector<Fraction> v_append_2 = v1.append(new Fraction(2));
assertEquals(4, v_append_2.getDimension());
assertEquals(new Fraction(2), v_append_2.getEntry(3));
FieldVector<Fraction> v_append_3 = v1.append(vec2);
assertEquals(6, v_append_3.getDimension());
assertEquals(new Fraction(4), v_append_3.getEntry(3));
FieldVector<Fraction> v_append_4 = v1.append(v2_t);
assertEquals(6, v_append_4.getDimension());
assertEquals(new Fraction(4), v_append_4.getEntry(3));
FieldVector<Fraction> v_copy = v1.copy();
assertEquals(3, v_copy.getDimension());
assertNotSame("testData not same object ", v1.data, v_copy.getData());
Fraction[] a_frac = v1.toArray();
assertEquals(3, a_frac.length);
assertNotSame("testData not same object ", v1.data, a_frac);
// ArrayFieldVector<Fraction> vout4 = (ArrayFieldVector<Fraction>) v1.clone();
// assertEquals(3, vout4.getDimension());
// assertEquals(v1.data, vout4.data);
FieldVector<Fraction> vout5 = v4.getSubVector(3, 3);
assertEquals(3, vout5.getDimension());
assertEquals(new Fraction(5), vout5.getEntry(1));
try {
v4.getSubVector(3, 7);
fail("MatrixIndexException expected");
} catch (MatrixIndexException ex) {
// expected behavior
} catch (Exception e) {
fail("wrong exception caught");
}
ArrayFieldVector<Fraction> v_set1 = (ArrayFieldVector<Fraction>) v1.copy();
v_set1.setEntry(1, new Fraction(11));
assertEquals(new Fraction(11), v_set1.getEntry(1));
try {
v_set1.setEntry(3, new Fraction(11));
fail("MatrixIndexException expected");
} catch (MatrixIndexException ex) {
// expected behavior
} catch (Exception e) {
fail("wrong exception caught");
}
ArrayFieldVector<Fraction> v_set2 = (ArrayFieldVector<Fraction>) v4.copy();
v_set2.set(3, v1);
assertEquals(new Fraction(1), v_set2.getEntry(3));
assertEquals(new Fraction(7), v_set2.getEntry(6));
try {
v_set2.set(7, v1);
fail("MatrixIndexException expected");
} catch (MatrixIndexException ex) {
// expected behavior
} catch (Exception e) {
fail("wrong exception caught");
}
ArrayFieldVector<Fraction> v_set3 = (ArrayFieldVector<Fraction>) v1.copy();
v_set3.set(new Fraction(13));
assertEquals(new Fraction(13), v_set3.getEntry(2));
try {
v_set3.getEntry(23);
fail("ArrayIndexOutOfBoundsException expected");
} catch (ArrayIndexOutOfBoundsException ex) {
// expected behavior
} catch (Exception e) {
fail("wrong exception caught");
}
ArrayFieldVector<Fraction> v_set4 = (ArrayFieldVector<Fraction>) v4.copy();
v_set4.setSubVector(3, v2_t);
assertEquals(new Fraction(4), v_set4.getEntry(3));
assertEquals(new Fraction(7), v_set4.getEntry(6));
try {
v_set4.setSubVector(7, v2_t);
fail("MatrixIndexException expected");
} catch (MatrixIndexException ex) {
// expected behavior
} catch (Exception e) {
fail("wrong exception caught");
}
ArrayFieldVector<Fraction> vout10 = (ArrayFieldVector<Fraction>) v1.copy();
ArrayFieldVector<Fraction> vout10_2 = (ArrayFieldVector<Fraction>) v1.copy();
assertEquals(vout10, vout10_2);
vout10_2.setEntry(0, new Fraction(11, 10));
assertNotSame(vout10, vout10_2);
}