/** * Set all elements to a single value. * * @param value Single value to set for all elements. */ public void set(double value) { Iterator<Entry> it = iterator(); while (it.hasNext()) { final Entry e = it.next(); e.setValue(value); } }
/** * Acts as if it is implemented as: * <pre> * Entry e = null; * for(Iterator<Entry> it = iterator(); it.hasNext(); e = it.next()) { * e.setValue(function.value(e.getValue())); * } * </pre> * Entries of this vector are modified in-place by this method. * * @param function Function to apply to each entry. * @return a reference to this vector. */ public RealVector mapToSelf(UnivariateFunction function) { Iterator<Entry> it = iterator(); while (it.hasNext()) { final Entry e = it.next(); e.setValue(function.value(e.getValue())); } return this; }
/** * Set all elements to a single value. * * @param value Single value to set for all elements. */ public void set(double value) { Iterator<Entry> it = iterator(); while (it.hasNext()) { final Entry e = it.next(); e.setValue(value); } }
/** * Acts as if it is implemented as: * <pre> * Entry e = null; * for(Iterator<Entry> it = iterator(); it.hasNext(); e = it.next()) { * e.setValue(function.value(e.getValue())); * } * </pre> * Entries of this vector are modified in-place by this method. * * @param function Function to apply to each entry. * @return a reference to this vector. */ public RealVector mapToSelf(UnivariateFunction function) { Iterator<Entry> it = iterator(); while (it.hasNext()) { final Entry e = it.next(); e.setValue(function.value(e.getValue())); } return this; }
/** * Acts as if it is implemented as: * <pre> * Entry e = null; * for(Iterator<Entry> it = iterator(); it.hasNext(); e = it.next()) { * e.setValue(function.value(e.getValue())); * } * </pre> * Entries of this vector are modified in-place by this method. * * @param function Function to apply to each entry. * @return a reference to this vector. */ public RealVector mapToSelf(UnivariateFunction function) { Iterator<Entry> it = iterator(); while (it.hasNext()) { final Entry e = it.next(); e.setValue(function.value(e.getValue())); } return this; }
/** * Set all elements to a single value. * * @param value Single value to set for all elements. */ public void set(double value) { Iterator<Entry> it = iterator(); while (it.hasNext()) { final Entry e = it.next(); e.setValue(value); } }