#include <yat/utility/Vector.h>
Public Types | |
typedef double & | reference |
typedef StrideIterator< double * > | iterator |
mutable iterator | |
typedef double | value_type |
typedef const double & | const_reference |
typedef StrideIterator< const double * > | const_iterator |
VectorBase::const_iterator. | |
Public Member Functions | |
Vector (void) | |
The default constructor. | |
Vector (size_t n, double init_value=0) | |
Allocates memory space for n elements, and sets all elements to init_value. | |
Vector (const Vector &other) | |
The copy constructor. | |
Vector (const VectorBase &other) | |
Copy a VectorBase. | |
Vector (std::istream &, char sep='\0') throw (utility::IO_error, std::exception) | |
The istream constructor. | |
~Vector (void) | |
bool | isview (void) const |
void | resize (size_t, double init_value=0) |
Resize Vector. | |
const Vector & | operator= (const Vector &) |
The assignment operator. | |
const Vector & | operator= (const VectorBase &) |
The assignment operator. | |
void | all (double value) |
iterator | begin (void) |
const_iterator | begin (void) const |
void | div (const VectorBase &other) |
This function performs element-wise division, . | |
iterator | end (void) |
const_iterator | end (void) const |
gsl_vector * | gsl_vector_p (void) |
const gsl_vector * | gsl_vector_p (void) const |
void | mul (const VectorBase &other) |
This function performs element-wise multiplication, . | |
void | reverse (void) |
Reverse the order of elements in the VectorMutable. | |
void | swap (size_t i, size_t j) |
Exchange elements i and j. | |
double & | operator() (size_t i) |
Element access operator. | |
const double & | operator() (size_t i) const |
Element access operator. | |
const VectorMutable & | operator+= (const VectorBase &) |
Addition and assign operator. VectorBase addition, . | |
const VectorMutable & | operator+= (double d) |
Add a constant to a VectorBase, . | |
const VectorMutable & | operator-= (const VectorBase &) |
Subtract and assign operator. VectorBase subtraction, . | |
const VectorMutable & | operator-= (double d) |
Subtract a constant to a VectorBase, . | |
const VectorMutable & | operator*= (double d) |
Multiply with scalar and assign operator, . | |
bool | equal (const VectorBase &, const double precision=0) const |
Check whether VectorBases are equal within a user defined precision, set by precision. | |
size_t | size (void) const |
bool | operator== (const VectorBase &) const |
Comparison operator. Takes linear time. | |
bool | operator!= (const VectorBase &) const |
Comparison operator. Takes linear time. | |
double | operator* (const VectorBase &) const |
Protected Attributes | |
gsl_vector * | vec_ |
const gsl_vector * | const_vec_ |
pointer to underlying GSL vector |
typedef double& theplu::yat::utility::VectorMutable::reference [inherited] |
typedef double theplu::yat::utility::VectorBase::value_type [inherited] |
typedef const double& theplu::yat::utility::VectorBase::const_reference [inherited] |
theplu::yat::utility::Vector::Vector | ( | size_t | n, | |
double | init_value = 0 | |||
) | [explicit] |
Allocates memory space for n elements, and sets all elements to init_value.
GSL_error | if memory allocation fails. |
theplu::yat::utility::Vector::Vector | ( | const Vector & | other | ) |
theplu::yat::utility::Vector::Vector | ( | const VectorBase & | other | ) | [explicit] |
theplu::yat::utility::Vector::Vector | ( | std::istream & | , | |
char | sep = '\0' | |||
) | throw (utility::IO_error, std::exception) [explicit] |
The istream constructor.
Either elements should be separated with white space characters (default), or elements should be separated by the delimiter sep. When delimiter sep is used empty elements are stored as NaN's (except that empty lines are ignored). The end of input to the Vector is at end of file marker.
theplu::yat::utility::Vector::~Vector | ( | void | ) |
The destructor.
bool theplu::yat::utility::Vector::isview | ( | void | ) | const [virtual] |
void theplu::yat::utility::Vector::resize | ( | size_t | , | |
double | init_value = 0 | |||
) |
const Vector& theplu::yat::utility::Vector::operator= | ( | const VectorBase & | ) |
The assignment operator.
GSL_error | if assignment fails. |
Reimplemented from theplu::yat::utility::VectorBase.
void theplu::yat::utility::VectorMutable::all | ( | double | value | ) | [inherited] |
Set all elements to value.
iterator theplu::yat::utility::VectorMutable::begin | ( | void | ) | [inherited] |
const_iterator theplu::yat::utility::VectorBase::begin | ( | void | ) | const [inherited] |
void theplu::yat::utility::VectorMutable::div | ( | const VectorBase & | other | ) | [inherited] |
iterator theplu::yat::utility::VectorMutable::end | ( | void | ) | [inherited] |
const_iterator theplu::yat::utility::VectorBase::end | ( | void | ) | const [inherited] |
gsl_vector* theplu::yat::utility::VectorMutable::gsl_vector_p | ( | void | ) | [inherited] |
const gsl_vector* theplu::yat::utility::VectorBase::gsl_vector_p | ( | void | ) | const [inherited] |
void theplu::yat::utility::VectorMutable::mul | ( | const VectorBase & | other | ) | [inherited] |
This function performs element-wise multiplication, .
GSL_error | if dimensions mis-match. |
double& theplu::yat::utility::VectorMutable::operator() | ( | size_t | i | ) | [inherited] |
Element access operator.
If | GSL range checks are enabled in the underlying GSL library a GSL_error exception is thrown if either index is out of range. |
const double& theplu::yat::utility::VectorBase::operator() | ( | size_t | i | ) | const [inherited] |
Element access operator.
If | GSL range checks are enabled in the underlying GSL library a GSL_error exception is thrown if either index is out of range. |
const VectorMutable& theplu::yat::utility::VectorMutable::operator+= | ( | const VectorBase & | ) | [inherited] |
Addition and assign operator. VectorBase addition, .
GSL_error | if dimensions mis-match. |
const VectorMutable& theplu::yat::utility::VectorMutable::operator+= | ( | double | d | ) | [inherited] |
const VectorMutable& theplu::yat::utility::VectorMutable::operator-= | ( | const VectorBase & | ) | [inherited] |
Subtract and assign operator. VectorBase subtraction, .
GSL_error | if dimensions mis-match. |
const VectorMutable& theplu::yat::utility::VectorMutable::operator-= | ( | double | d | ) | [inherited] |
const VectorMutable& theplu::yat::utility::VectorMutable::operator*= | ( | double | d | ) | [inherited] |
bool theplu::yat::utility::VectorBase::equal | ( | const VectorBase & | , | |
const double | precision = 0 | |||
) | const [inherited] |
Check whether VectorBases are equal within a user defined precision, set by precision.
size_t theplu::yat::utility::VectorBase::size | ( | void | ) | const [inherited] |
bool theplu::yat::utility::VectorBase::operator== | ( | const VectorBase & | ) | const [inherited] |
Comparison operator. Takes linear time.
Checks are performed with exact matching, i.e., rounding off effects may destroy comparison. Use the equal function for comparing elements within a user defined precision.
bool theplu::yat::utility::VectorBase::operator!= | ( | const VectorBase & | ) | const [inherited] |
Comparison operator. Takes linear time.
Checks are performed with exact matching, i.e., rounding off effects may destroy comparison. Use the equal function for comparing elements within a user defined precision.
double theplu::yat::utility::VectorBase::operator* | ( | const VectorBase & | ) | const [inherited] |
gsl_vector* theplu::yat::utility::VectorMutable::vec_ [protected, inherited] |
pointer to underlying GSL vector. Should always point to same gsl_vector as const_vec_ in base class does. This pointer should by used for mutable operations. Do not use this in const functions; use const_vec_ inherited from BaseVector.