KJB
|
#include <m_sequence.h>
Public Member Functions | |
Interval_sequence (double start, double interval, double end) | |
virtual double | operator[] (size_t index) const |
std::vector< double > | to_vector () const |
A sequence of numbers defined by a starting value, ending value and an interval.
kjb::Interval_sequence::Interval_sequence | ( | double | start, |
double | interval, | ||
double | end | ||
) |
define a sequence {start, start + interval, start + 2 * interval, ..., start + N * interval} where end - interval < N * interval <= end
This is simlar to matlab's "start:interval:end" notation for generating sequences
It also provides a concise way to populate a vector with a sequence: vec = Interval_sequence(0,2,100).to_vector()
Storage is constant, so any size sequence is possible (up to the limits of double).
|
virtual |
std::vector< double > kjb::Interval_sequence::to_vector | ( | ) | const |