#include <yat/utility/VectorMutable.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 | |
VectorMutable (void) | |
default constructor | |
VectorMutable (gsl_vector *) | |
Constructor. | |
VectorMutable (const gsl_vector *) | |
Constructor. | |
virtual | ~VectorMutable (void) |
void | all (double value) |
iterator | begin (void) |
void | div (const VectorBase &other) |
This function performs element-wise division, . | |
iterator | end (void) |
gsl_vector * | gsl_vector_p (void) |
virtual bool | isview (void) const =0 |
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 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, . | |
const_iterator | begin (void) const |
const_iterator | end (void) const |
bool | equal (const VectorBase &, const double precision=0) const |
Check whether VectorBases are equal within a user defined precision, set by precision. | |
const gsl_vector * | gsl_vector_p (void) const |
size_t | size (void) const |
const double & | operator() (size_t i) const |
Element access operator. | |
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 | |
Related Functions | |
(Note that these are not member functions.) | |
Vector | operator* (const VectorBase &, const Matrix &) |
Matrix Vector multiplication. | |
bool | isnull (const VectorBase &) |
Check if all elements of the VectorBase are zero. | |
double | max (const VectorBase &) |
Get the maximum value of the VectorBase. | |
size_t | max_index (const VectorBase &) |
Locate the maximum value in the VectorBase. | |
double | min (const VectorBase &) |
Get the minimum value of the VectorBase. | |
size_t | min_index (const VectorBase &) |
Locate the minimum value in the VectorBase. | |
bool | nan (const VectorBase &templat, Vector &flag) |
Create a VectorBase flag indicating NaN's in another VectorBase templat. | |
void | sort_index (std::vector< size_t > &sort_index, const VectorBase &invec) |
void | sort_smallest_index (std::vector< size_t > &sort_index, size_t k, const VectorBase &invec) |
void | sort_largest_index (std::vector< size_t > &sort_index, size_t k, const VectorBase &invec) |
double | sum (const VectorBase &) |
Calculate the sum of all VectorBase elements. | |
std::ostream & | operator<< (std::ostream &s, const VectorBase &v) |
The output operator for the VectorBase class. |
This class contains the mutable interface to vector classes.
The non-mutable interface is inherited from VectorBase. When dealing with const vectors, it is preferable to use the VectorBase signature because this allows usage of VectorConstView too.
typedef const double& theplu::yat::utility::VectorBase::const_reference [inherited] |
typedef double& theplu::yat::utility::VectorMutable::reference |
typedef double theplu::yat::utility::VectorBase::value_type [inherited] |
virtual theplu::yat::utility::VectorMutable::~VectorMutable | ( | void | ) | [virtual] |
The destructor.
void theplu::yat::utility::VectorMutable::all | ( | double | value | ) |
Set all elements to value.
const_iterator theplu::yat::utility::VectorBase::begin | ( | void | ) | const [inherited] |
iterator theplu::yat::utility::VectorMutable::begin | ( | void | ) |
void theplu::yat::utility::VectorMutable::div | ( | const VectorBase & | other | ) |
const_iterator theplu::yat::utility::VectorBase::end | ( | void | ) | const [inherited] |
iterator theplu::yat::utility::VectorMutable::end | ( | void | ) |
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.
const gsl_vector* theplu::yat::utility::VectorBase::gsl_vector_p | ( | void | ) | const [inherited] |
gsl_vector* theplu::yat::utility::VectorMutable::gsl_vector_p | ( | void | ) |
virtual bool theplu::yat::utility::VectorMutable::isview | ( | void | ) | const [pure virtual] |
Check if the vector object is a view (sub-vector) to another vector.
Implements theplu::yat::utility::VectorBase.
Implemented in theplu::yat::utility::Vector, and theplu::yat::utility::VectorView.
void theplu::yat::utility::VectorMutable::mul | ( | const VectorBase & | other | ) |
This function performs element-wise multiplication, .
GSL_error | if dimensions mis-match. |
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.
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. |
double& theplu::yat::utility::VectorMutable::operator() | ( | size_t | i | ) |
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. |
double theplu::yat::utility::VectorBase::operator* | ( | const VectorBase & | ) | const [inherited] |
const VectorMutable& theplu::yat::utility::VectorMutable::operator*= | ( | double | d | ) |
const VectorMutable& theplu::yat::utility::VectorMutable::operator+= | ( | double | d | ) |
const VectorMutable& theplu::yat::utility::VectorMutable::operator+= | ( | const VectorBase & | ) |
Addition and assign operator. VectorBase addition, .
GSL_error | if dimensions mis-match. |
const VectorMutable& theplu::yat::utility::VectorMutable::operator-= | ( | double | d | ) |
const VectorMutable& theplu::yat::utility::VectorMutable::operator-= | ( | const VectorBase & | ) |
Subtract and assign operator. VectorBase subtraction, .
GSL_error | if dimensions mis-match. |
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.
size_t theplu::yat::utility::VectorBase::size | ( | void | ) | const [inherited] |
bool isnull | ( | const VectorBase & | ) | [related, inherited] |
Check if all elements of the VectorBase are zero.
double max | ( | const VectorBase & | ) | [related, inherited] |
size_t max_index | ( | const VectorBase & | ) | [related, inherited] |
Locate the maximum value in the VectorBase.
double min | ( | const VectorBase & | ) | [related, inherited] |
size_t min_index | ( | const VectorBase & | ) | [related, inherited] |
Locate the minimum value in the VectorBase.
bool nan | ( | const VectorBase & | templat, | |
Vector & | flag | |||
) | [related, inherited] |
Create a VectorBase flag indicating NaN's in another VectorBase templat.
The flag VectorBase is changed to contain 1's and 0's only. A 1 means that the corresponding element in the templat VectorBase is valid and a zero means that the corresponding element is a NaN.
std::ostream & operator<< | ( | std::ostream & | s, | |
const VectorBase & | v | |||
) | [related, inherited] |
The output operator for the VectorBase class.
Elements in VectorBase v are sent to ostream s and separated with the fill character of stream s, s.fill(). If you, for example, want to print the VectorBase v with the elements separated by a ':', you do so by:
s << setfill(':') << v;
void sort_index | ( | std::vector< size_t > & | sort_index, | |
const VectorBase & | invec | |||
) | [related, inherited] |
Create a vector sort_index containing the indeces of elements in a another VectorBase invec. The elements of sort_index give the index of the VectorBase element which would have been stored in that position if the VectorBase had been sorted in place. The first element of sort_index gives the index of the least element in invec, and the last element of sort_index gives the index of the greatest element in invec . The VectorBase invec is not changed.
void sort_largest_index | ( | std::vector< size_t > & | sort_index, | |
size_t | k, | |||
const VectorBase & | invec | |||
) | [related, inherited] |
Similar to sort_index but creates a VectorBase with indices to the k largest elements in invec.
void sort_smallest_index | ( | std::vector< size_t > & | sort_index, | |
size_t | k, | |||
const VectorBase & | invec | |||
) | [related, inherited] |
Similar to sort_index but creates a VectorBase with indices to the k smallest elements in invec.
double sum | ( | const VectorBase & | ) | [related, inherited] |
gsl_vector* theplu::yat::utility::VectorMutable::vec_ [protected] |
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.