A collection of accepted and discarded evolution steps which contain some reason to stop. More...
#include <StopHistoryInterval.h>
Public Member Functions | |
StopHistoryInterval (size_t num_points=0, std::list< double >::const_iterator first_age=std::list< double >::const_iterator(), std::list< double >::const_iterator history_age_end=std::list< double >::const_iterator(), std::list< double >::const_iterator discarded_age_begin=std::list< double >::const_iterator(), std::list< std::valarray< double > >::const_iterator first_stop_cond=std::list< std::valarray< double > >::const_iterator(), std::list< std::valarray< double > >::const_iterator stop_cond_history_end=std::list< std::valarray< double > >::const_iterator(), std::list< std::valarray< double > >::const_iterator stop_cond_discarded_begin=std::list< std::valarray< double > >::const_iterator(), std::list< std::valarray< double > >::const_iterator first_stop_deriv=std::list< std::valarray< double > >::const_iterator(), std::list< std::valarray< double > >::const_iterator stop_deriv_history_end=std::list< std::valarray< double > >::const_iterator(), std::list< std::valarray< double > >::const_iterator stop_deriv_discarded_begin=std::list< std::valarray< double > >::const_iterator()) | |
Construct an interval of steps with some reason to stop the evolution. More... | |
StopHistoryInterval (const StopHistoryInterval &orig) | |
Copy orig to *this. More... | |
void | reset () |
Makes the current point the first point in the interval. More... | |
StopHistoryInterval & | operator++ () |
Advances to the next point in the interval. More... | |
StopHistoryInterval | operator++ (int) |
Advances to the next point in the interval. More... | |
StopHistoryInterval & | operator-- () |
Advances to the next point in the interval. More... | |
StopHistoryInterval | operator-- (int) |
Advances to the next point in the interval. More... | |
StopHistoryInterval & | operator<< (size_t n) |
Moves the entire interval, along with the current point left n points. More... | |
StopHistoryInterval & | operator>> (size_t n) |
Moves the entire interval, along with the current point right n points. More... | |
StopHistoryInterval & | operator= (const StopHistoryInterval &rhs) |
Copies rhs to this. More... | |
bool | operator== (const StopHistoryInterval &rhs) |
Checks if the RHS is the same interval and is at the same point in it. More... | |
void | grow_left (size_t n=1) |
Adds the n points before the first point to the interval. More... | |
void | grow_right (size_t n=1) |
Adds the n points before the first point to the interval. More... | |
size_t | num_points () |
Returns the number of points in the interval. More... | |
size_t | current_point_index () |
Returns the index of the current point within the interval. More... | |
size_t | number_conditions () |
Returns the number of conditions at the first point. More... | |
bool | end () |
Returns true iff this is the invalid point marking the end of the interval. More... | |
double | first_age () const |
Returns the age of the first point in the interval. More... | |
double | last_age () const |
Returns the age of the last point in the interval. More... | |
double | age () const |
Returns the age of the current point. More... | |
double | first_stop_condition_value (size_t condition_index) const |
Returns the value of the stop condition with the given index for the first point in the interval. More... | |
double | last_stop_condition_value (size_t condition_index) const |
Returns the value of the stop condition with the given index for the last point in the interval. More... | |
double | stop_condition_value (size_t condition_index) const |
Returns the value of the stop condition with the given index for the current point. More... | |
double | first_stop_condition_deriv (size_t condition_index) const |
Returns the derivative of the stop condition with the given index for the first point in the interval. More... | |
double | last_stop_condition_deriv (size_t condition_index) const |
Returns the derivative of the stop condition with the given index for the last point in the interval. More... | |
double | stop_condition_deriv (size_t condition_index) const |
Returns the derivative of the stop condition with the given index for the current point. More... | |
Private Member Functions | |
void | advance_iterator_set (std::list< double >::const_iterator &age_i, std::list< std::valarray< double > >::const_iterator &cond_i, std::list< std::valarray< double > >::const_iterator &deriv_i) |
Increments all the iterators passed as arguments. More... | |
void | retreat_iterator_set (std::list< double >::const_iterator &age_i, std::list< std::valarray< double > >::const_iterator &cond_i, std::list< std::valarray< double > >::const_iterator &deriv_i) |
Decrements all the iterators passed as arguments. More... | |
Private Attributes | |
size_t | __num_points |
Number of points in the interval. More... | |
size_t | __point_i |
The index of the current point. More... | |
std::list< double >::const_iterator | __first_age |
The first age in the interval. More... | |
std::list< double >::const_iterator | __last_age |
The last age in the interval. More... | |
std::list< double >::const_iterator | __history_age_end |
The one past last element of the history of stoppnig condition ages. More... | |
std::list< double >::const_iterator | __discarded_age_begin |
The first age in the discarded stopping conditions. More... | |
std::list< double >::const_iterator | __age_i |
The age of the current point. More... | |
std::list< std::valarray< double > >::const_iterator | __first_stop_cond |
The first stopping condition value in the interval. More... | |
std::list< std::valarray< double > >::const_iterator | __last_stop_cond |
The last stopping condition value in the interval. More... | |
std::list< std::valarray< double > >::const_iterator | __stop_cond_history_end |
The one past last element of the history of stoppnig conditions. More... | |
std::list< std::valarray< double > >::const_iterator | __stop_cond_discarded_begin |
The first of the discarded stopping condition values. More... | |
std::list< std::valarray< double > >::const_iterator | __stop_cond_i |
The current stopping condition value. More... | |
std::list< std::valarray< double > >::const_iterator | __first_stop_deriv |
The first stopping condition derivative in the interval. More... | |
std::list< std::valarray< double > >::const_iterator | __last_stop_deriv |
The last stopping condition derivative in the interval. More... | |
std::list< std::valarray< double > >::const_iterator | __stop_deriv_history_end |
The one past last element of the history of stoppnig conditions. More... | |
std::list< std::valarray< double > >::const_iterator | __stop_deriv_discarded_begin |
The first of the discarded stopping condition values. More... | |
std::list< std::valarray< double > >::const_iterator | __stop_deriv_i |
The current stop condition derivative. More... | |
A collection of accepted and discarded evolution steps which contain some reason to stop.
Generally tracks iterators over the stored evolution history and discarded values during the evolution calculations. One particular wrinkle is that this class deals with the possibility that step sizes can be driven to very small values by some other precision requirements leading to stopping condition values that differ only by numerical errors in their calculations causing real extrema to be missed or creating fake ones. To handle this, values that differ by less than some precsibed amount (see numerical_roundoff_factor argument to the constructor) are treated as a single value equal to their average.
Definition at line 35 of file StopHistoryInterval.h.
Evolve::StopHistoryInterval::StopHistoryInterval | ( | size_t | num_points = 0 , |
std::list< double >::const_iterator | first_age = std::list<double>::const_iterator() , |
||
std::list< double >::const_iterator | history_age_end = std::list<double>::const_iterator() , |
||
std::list< double >::const_iterator | discarded_age_begin = std::list<double>::const_iterator() , |
||
std::list< std::valarray< double > >::const_iterator | first_stop_cond = std::list< std::valarray<double> >::const_iterator() , |
||
std::list< std::valarray< double > >::const_iterator | stop_cond_history_end = std::list< std::valarray<double> >::const_iterator() , |
||
std::list< std::valarray< double > >::const_iterator | stop_cond_discarded_begin = std::list< std::valarray<double> >::const_iterator() , |
||
std::list< std::valarray< double > >::const_iterator | first_stop_deriv = std::list< std::valarray<double> >::const_iterator() , |
||
std::list< std::valarray< double > >::const_iterator | stop_deriv_history_end = std::list< std::valarray<double> >::const_iterator() , |
||
std::list< std::valarray< double > >::const_iterator | stop_deriv_discarded_begin = std::list< std::valarray<double> >::const_iterator() |
||
) |
Construct an interval of steps with some reason to stop the evolution.
num_points | The number of points in the interval. |
first_age | An iterator pointing to the first age in the interval. |
history_age_end | An iterator pointing to one past the last age in the history. |
discarded_age_begin | An iterator pointing to the first age in the discarded list. |
first_stop_cond | An iterator pointing to the first stopping condition in the interval. |
stop_cond_history_end | An iterator pointing to one past the last stopping condition in the history. |
stop_cond_discarded_begin | An iterator pointing to the first stopping condition in the discarded list. |
first_stop_deriv | An iterator pointing to the first stopping derivative in the interval. |
stop_deriv_history_end | An iterator pointing to one past the last stopping derivative in the history. |
stop_deriv_discarded_begin | An iterator pointing to the first stopping derivative in the discarded list. |
Definition at line 45 of file StopHistoryInterval.cpp.
Evolve::StopHistoryInterval::StopHistoryInterval | ( | const StopHistoryInterval & | orig | ) |
Copy orig to *this.
Definition at line 90 of file StopHistoryInterval.cpp.
|
private |
Increments all the iterators passed as arguments.
Takes care of the switch from history to discarded if necessary.
Definition at line 13 of file StopHistoryInterval.cpp.
|
inline |
Returns the age of the current point.
Definition at line 229 of file StopHistoryInterval.h.
|
inline |
Returns the index of the current point within the interval.
Definition at line 213 of file StopHistoryInterval.h.
|
inline |
Returns true iff this is the invalid point marking the end of the interval.
Definition at line 220 of file StopHistoryInterval.h.
|
inline |
Returns the age of the first point in the interval.
Definition at line 223 of file StopHistoryInterval.h.
|
inline |
Returns the derivative of the stop condition with the given index for the first point in the interval.
Definition at line 248 of file StopHistoryInterval.h.
|
inline |
Returns the value of the stop condition with the given index for the first point in the interval.
Definition at line 233 of file StopHistoryInterval.h.
void Evolve::StopHistoryInterval::grow_left | ( | size_t | n = 1 | ) |
Adds the n points before the first point to the interval.
Definition at line 220 of file StopHistoryInterval.cpp.
void Evolve::StopHistoryInterval::grow_right | ( | size_t | n = 1 | ) |
Adds the n points before the first point to the interval.
Definition at line 230 of file StopHistoryInterval.cpp.
|
inline |
Returns the age of the last point in the interval.
Definition at line 226 of file StopHistoryInterval.h.
|
inline |
Returns the derivative of the stop condition with the given index for the last point in the interval.
Definition at line 253 of file StopHistoryInterval.h.
|
inline |
Returns the value of the stop condition with the given index for the last point in the interval.
Definition at line 238 of file StopHistoryInterval.h.
|
inline |
Returns the number of points in the interval.
Definition at line 210 of file StopHistoryInterval.h.
|
inline |
Returns the number of conditions at the first point.
Definition at line 216 of file StopHistoryInterval.h.
StopHistoryInterval & Evolve::StopHistoryInterval::operator++ | ( | ) |
Advances to the next point in the interval.
Definition at line 118 of file StopHistoryInterval.cpp.
StopHistoryInterval Evolve::StopHistoryInterval::operator++ | ( | int | ) |
Advances to the next point in the interval.
Definition at line 130 of file StopHistoryInterval.cpp.
StopHistoryInterval & Evolve::StopHistoryInterval::operator-- | ( | ) |
Advances to the next point in the interval.
Definition at line 137 of file StopHistoryInterval.cpp.
StopHistoryInterval Evolve::StopHistoryInterval::operator-- | ( | int | ) |
Advances to the next point in the interval.
Definition at line 148 of file StopHistoryInterval.cpp.
StopHistoryInterval & Evolve::StopHistoryInterval::operator<< | ( | size_t | n | ) |
Moves the entire interval, along with the current point left n points.
Gains n new points at the front and loses n at the back.
If there are not enough points in the history undefined behavior results.
Definition at line 155 of file StopHistoryInterval.cpp.
StopHistoryInterval & Evolve::StopHistoryInterval::operator= | ( | const StopHistoryInterval & | rhs | ) |
Copies rhs to this.
Definition at line 176 of file StopHistoryInterval.cpp.
bool Evolve::StopHistoryInterval::operator== | ( | const StopHistoryInterval & | rhs | ) |
Checks if the RHS is the same interval and is at the same point in it.
Definition at line 199 of file StopHistoryInterval.cpp.
StopHistoryInterval & Evolve::StopHistoryInterval::operator>> | ( | size_t | n | ) |
Moves the entire interval, along with the current point right n points.
Gains n new points at the back and loses n at the front.
If there are not enough points in the discarded list undefined behavior results.
Definition at line 166 of file StopHistoryInterval.cpp.
void Evolve::StopHistoryInterval::reset | ( | ) |
Makes the current point the first point in the interval.
Definition at line 110 of file StopHistoryInterval.cpp.
|
private |
Decrements all the iterators passed as arguments.
Takes care of the switch from discarded to history if necessary.
Definition at line 29 of file StopHistoryInterval.cpp.
|
inline |
Returns the derivative of the stop condition with the given index for the current point.
Definition at line 258 of file StopHistoryInterval.h.
|
inline |
Returns the value of the stop condition with the given index for the current point.
Definition at line 243 of file StopHistoryInterval.h.
|
private |
The age of the current point.
Definition at line 41 of file StopHistoryInterval.h.
|
private |
The first age in the discarded stopping conditions.
Definition at line 41 of file StopHistoryInterval.h.
|
private |
The first age in the interval.
Definition at line 41 of file StopHistoryInterval.h.
|
private |
The first stopping condition value in the interval.
Definition at line 57 of file StopHistoryInterval.h.
|
private |
The first stopping condition derivative in the interval.
Definition at line 57 of file StopHistoryInterval.h.
|
private |
The one past last element of the history of stoppnig condition ages.
Definition at line 41 of file StopHistoryInterval.h.
|
private |
The last age in the interval.
Definition at line 41 of file StopHistoryInterval.h.
|
private |
The last stopping condition value in the interval.
Definition at line 57 of file StopHistoryInterval.h.
|
private |
The last stopping condition derivative in the interval.
Definition at line 57 of file StopHistoryInterval.h.
|
private |
Number of points in the interval.
Definition at line 37 of file StopHistoryInterval.h.
|
private |
The index of the current point.
Definition at line 37 of file StopHistoryInterval.h.
|
private |
The first of the discarded stopping condition values.
Definition at line 57 of file StopHistoryInterval.h.
|
private |
The one past last element of the history of stoppnig conditions.
Definition at line 57 of file StopHistoryInterval.h.
|
private |
The current stopping condition value.
Definition at line 57 of file StopHistoryInterval.h.
|
private |
The first of the discarded stopping condition values.
Definition at line 57 of file StopHistoryInterval.h.
|
private |
The one past last element of the history of stoppnig conditions.
Definition at line 57 of file StopHistoryInterval.h.
|
private |
The current stop condition derivative.
Definition at line 57 of file StopHistoryInterval.h.