@Test public void testMultiply() { VectorN vec1 = VectorN.from(4, 7, -2); double factor = 4.5; vec1.multiply(factor); assertEquals(VectorN.from(18, 31.5, -9), vec1); vec1 = VectorN.from(1, 1, 1); factor = AngleMath.PI; vec1.multiply(factor); assertEquals(vec1.x(), factor, ACCURACY); assertEquals(vec1.y(), factor, ACCURACY); vec1 = VectorN.from(3, -5, 5); factor = -2.1f; vec1.multiply(factor); assertEquals(vec1.x(), -6.3f, ACCURACY); assertEquals(vec1.y(), 10.5, ACCURACY); factor = 0; vec1.multiply(factor); assertThat(VectorN.from(0, 0, 0).isCloseTo(vec1)).isTrue(); }
public VectorN multiply(final double factor) { for (int i = 0; i < getNumDimensions(); i++) { data[i] *= factor; } return this; }
VectorN extends AVectorN { public VectorN multiply(final double factor) { for (int i = 0; i < getNumDimensions(); i++) { data[i] *= factor; } return this; } }
VectorN extends AVectorN { public VectorN multiply(final double factor) { for (int i = 0; i < getNumDimensions(); i++) { data[i] *= factor; } return this; } private  VectorN(final int dim); private  VectorN(final double... data); private  VectorN(final IVector vector); }
VectorN extends AVectorN { public VectorN multiply(final double factor) { for (int i = 0; i < getNumDimensions(); i++) { data[i] *= factor; } return this; } 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 VectorN multiply(final double factor) { for (int i = 0; i < getNumDimensions(); i++) { data[i] *= factor; } return this; } 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();  }