@Test public void testSet() { VectorN vector = VectorN.zero(3); vector.set(0, 42); assertThat(vector.isCloseTo(VectorN.from(42, 0, 0))).isTrue(); vector.set(1, 21); assertThat(vector.isCloseTo(VectorN.from(42, 21, 0))).isTrue(); vector.set(2, 10); assertThat(vector.isCloseTo(VectorN.from(42, 21, 10))).isTrue(); assertThatThrownBy(() -> vector.set(3, 1)).isInstanceOfAny(IllegalArgumentException.class); }
public void set(final int i, final double value) { if (i >= getNumDimensions()) { throw new IllegalArgumentException("index too large: " + i); } data[i] = value; }
VectorN extends AVectorN { public void set(final int i, final double value) { if (i >= getNumDimensions()) { throw new IllegalArgumentException("index too large: " + i); } data[i] = value; } }
VectorN extends AVectorN { public void set(final int i, final double value) { if (i >= getNumDimensions()) { throw new IllegalArgumentException("index too large: " + i); } data[i] = value; } private  VectorN(final int dim); private  VectorN(final double... data); private  VectorN(final IVector vector); }
VectorN extends AVectorN { public void set(final int i, final double value) { if (i >= getNumDimensions()) { throw new IllegalArgumentException("index too large: " + i); } data[i] = value; } 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 void set(final int i, final double value) { if (i >= getNumDimensions()) { throw new IllegalArgumentException("index too large: " + i); } data[i] = value; } 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();  }