/// <inheritdoc/> public new double walkInDefaultOrder(RealVectorChangingVisitor visitor) { visitor.start(data.Length, 0, data.Length - 1); for (int i = 0; i < data.Length; i++) { data[i] = visitor.visit(i, data[i]); } return(visitor.end()); }
/// <inheritdoc/> public new double walkInDefaultOrder(RealVectorChangingVisitor visitor, int start, int end) { checkIndices(start, end); visitor.start(data.Length, start, end); for (int i = start; i <= end; i++) { data[i] = visitor.visit(i, data[i]); } return(visitor.end()); }
/** * Visits (and possibly alters) some entries of this vector in default order * (increasing index). * * @param visitor visitor to be used to process the entries of this vector * @param start the index of the first entry to be visited * @param end the index of the last entry to be visited (inclusive) * @return the value returned by {@link RealVectorChangingVisitor#end()} * at the end of the walk * @throws NumberIsTooSmallException if {@code end < start}. * @throws OutOfRangeException if the indices are not valid. * @since 3.1 */ public virtual double walkInDefaultOrder(RealVectorChangingVisitor visitor, int start, int end) { checkIndices(start, end); visitor.start(getDimension(), start, end); for (int i = start; i <= end; i++) { setEntry(i, visitor.visit(i, getEntry(i))); } return(visitor.end()); }
/** * Visits (and possibly alters) all entries of this vector in default order * (increasing index). * * @param visitor the visitor to be used to process and modify the entries * of this vector * @return the value returned by {@link RealVectorChangingVisitor#end()} * at the end of the walk * @since 3.1 */ public virtual double walkInDefaultOrder(RealVectorChangingVisitor visitor) { int dim = getDimension(); visitor.start(dim, 0, dim - 1); for (int i = 0; i < dim; i++) { setEntry(i, visitor.visit(i, getEntry(i))); } return(visitor.end()); }