/// <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());
 }
示例#3
0
 /**
  * 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());
 }
示例#4
0
        /**
         * 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());
        }
示例#5
0
 /**
  * Visits (and possibly change) some entries of this vector in optimized
  * order. The order in which the entries are visited is selected so as to
  * lead to the most efficient implementation; it might depend on the
  * concrete implementation of this abstract class.
  *
  * @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 walkInOptimizedOrder(RealVectorChangingVisitor visitor, int start, int end)
 {
     return(walkInDefaultOrder(visitor, start, end));
 }
示例#6
0
 /**
  * Visits (and possibly alters) all entries of this vector in optimized
  * order. The order in which the entries are visited is selected so as to
  * lead to the most efficient implementation; it might depend on the
  * concrete implementation of this abstract class.
  *
  * @param visitor the visitor to be used to process 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 walkInOptimizedOrder(RealVectorChangingVisitor visitor)
 {
     return(walkInDefaultOrder(visitor));
 }