@Test public void testSubtractNew() { VectorN vec1 = VectorN.from(5, 7, 2); VectorN vec2 = VectorN.from(1, 2, -1); VectorN result = vec1.subtractNew(vec2); assertEquals(VectorN.from(4, 5, 3), result); vec1 = VectorN.from(-3, 0, 1); vec2 = VectorN.from(4, 2, 1); result = vec1.subtractNew(vec2); assertEquals(VectorN.from(-7, -2, 0), result); vec1 = VectorN.from(-3, 5, 4); vec2 = VectorN.from(-4, -2, 8); result = vec1.subtractNew(vec2); assertEquals(VectorN.from(1, 7, -4), result); assertEquals(VectorN.from(-3, 5, 4), vec1); }
public static VectorN from(final double... data) { if (data == null) { return VectorN.empty(); } return new VectorN(data); }
VectorN extends AVectorN { public static VectorN from(final double... data) { if (data == null) { return VectorN.empty(); } return new VectorN(data); } }
VectorN extends AVectorN { public static VectorN from(final double... data) { if (data == null) { return VectorN.empty(); } return new VectorN(data); } private  VectorN(final int dim); private  VectorN(final double... data); private  VectorN(final IVector vector); }
VectorN extends AVectorN { public static VectorN from(final double... data) { if (data == null) { return VectorN.empty(); } return new VectorN(data); } private  VectorN(final int dim); private  VectorN(final double... data); private  VectorN(final IVector vector); static VectorN zero(final int dim); static VectorN empty(); static VectorN from(final double... data); static VectorN copy(final IVector vector); static VectorN fromReal(final RealVector rv); void set(final int i, final double value); VectorN add(final IVector vector); VectorN subtract(final IVector vector); VectorN multiply(final double factor); VectorN apply(final Function<Double, Double> function); @Override double x(); @Override double y(); @Override double get(final int i); @Override int getNumDimensions(); }
VectorN extends AVectorN { public static VectorN from(final double... data) { if (data == null) { return VectorN.empty(); } return new VectorN(data); } private  VectorN(final int dim); private  VectorN(final double... data); private  VectorN(final IVector vector); static VectorN zero(final int dim); static VectorN empty(); static VectorN from(final double... data); static VectorN copy(final IVector vector); static VectorN fromReal(final RealVector rv); void set(final int i, final double value); VectorN add(final IVector vector); VectorN subtract(final IVector vector); VectorN multiply(final double factor); VectorN apply(final Function<Double, Double> function); @Override double x(); @Override double y(); @Override double get(final int i); @Override int getNumDimensions();  }