yat
0.20.3pre
|
This is the yat interface to GSL vector. More...
#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. | |
typedef VectorBase | derived_type |
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. More... | |
Vector (const Vector &other) | |
The copy constructor. More... | |
template<class T > | |
Vector (const VectorExpression< T > &other) | |
Constructor from a vector expression. | |
Vector (Vector &&other) noexcept | |
The move constructor. More... | |
template<class T > | |
Vector (VectorExpression< T > &&other) | |
Move constructor from Vector expression. More... | |
Vector (const VectorBase &other) | |
Copy a VectorBase. More... | |
Vector (std::istream &, char sep='\0') | |
The istream constructor. More... | |
~Vector (void) | |
bool | isview (void) const |
void | resize (size_t, double init_value=0) |
Resize Vector. More... | |
const Vector & | operator= (const Vector &) |
The assignment operator. More... | |
template<class T > | |
Vector & | operator= (const VectorExpression< T > &rhs) |
assignment from vector expression More... | |
Vector & | operator= (Vector &&) |
The move assignment operator. More... | |
template<class T > | |
Vector & | operator= (VectorExpression< T > &&rhs) |
move assignment from vector expression More... | |
const Vector & | operator= (const VectorBase &) |
The assignment operator. More... | |
void | all (double value) |
iterator | begin (void) |
const_iterator | begin (void) const |
const_iterator | begin (void) const |
void | div (const VectorBase &other) |
This function performs element-wise division, . More... | |
iterator | end (void) |
const_iterator | end (void) const |
const_iterator | end (void) const |
gsl_vector * | gsl_vector_p (void) |
const gsl_vector * | gsl_vector_p (void) const |
const gsl_vector * | gsl_vector_p (void) const |
void | mul (const VectorBase &other) |
This function performs element-wise multiplication, . More... | |
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. More... | |
const double & | operator() (size_t i) const |
Element access operator. More... | |
const VectorMutable & | operator+= (const VectorBase &) |
Addition and assign operator. VectorBase addition, . More... | |
template<class T > | |
VectorMutable & | operator+= (const VectorExpression< T > &rhs) |
Addition and assign operator. More... | |
const VectorMutable & | operator+= (double d) |
Add a constant to a VectorBase, . More... | |
const VectorMutable & | operator-= (const VectorBase &) |
Subtract and assign operator. VectorBase subtraction, . More... | |
template<class T > | |
VectorMutable & | operator-= (const VectorExpression< T > &rhs) |
Subtraction and assign operator. More... | |
const VectorMutable & | operator-= (double d) |
Subtract a constant to a VectorBase, . More... | |
const VectorMutable & | operator*= (double d) |
Multiply with scalar and assign operator, . More... | |
bool | equal (const VectorBase &, const double precision=0) const |
Check whether VectorBases are equal within a user defined precision, set by precision. More... | |
size_t | size (void) const |
bool | operator== (const VectorBase &) const |
Comparison operator. Takes linear time. More... | |
bool | operator!= (const VectorBase &) const |
Comparison operator. Takes linear time. More... | |
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.) | |
void | swap (Vector &, Vector &) |
Swap Vector elements by copying. More... | |
template<class Derived1 , class Derived2 > | |
double | operator* (const BasicVector< Derived1 > &lhs, const BasicVector< Derived2 > &rhs) |
template<typename T > | |
expression::ScaledVector< T > | operator* (double k, const BasicVector< T > &vec) |
scale a vector expression More... | |
template<typename T > | |
expression::ScaledVector< T > | operator* (const BasicVector< T > &vec, double k) |
scale a vector expression More... | |
template<class MATRIX , class VECTOR > | |
expression::MatrixVector< MATRIX, VECTOR > | operator* (const BasicMatrix< MATRIX > &lhs, const BasicVector< VECTOR > &rhs) |
template<class MATRIX , class VECTOR > | |
expression::MatrixVector< MatrixExpression< expression::TransposedMatrix< MATRIX > >, VECTOR > | operator* (const BasicVector< VECTOR > &lhs, const BasicMatrix< MATRIX > &rhs) |
template<class Derived1 , class Derived2 > | |
expression::VectorBinary< Derived1, Derived2, expression::Plus > | operator+ (const BasicVector< Derived1 > &lhs, const BasicVector< Derived2 > &rhs) |
template<class Derived1 , class Derived2 > | |
expression::VectorBinary< Derived1, Derived2, expression::Minus > | operator- (const BasicVector< Derived1 > &lhs, const BasicVector< Derived2 > &rhs) |
template<typename T > | |
expression::ScaledVector< T > | operator- (const BasicVector< T > &vec) |
negation operator More... | |
bool | isnull (const VectorBase &) |
Check if all elements of the VectorBase are zero. More... | |
double | max (const VectorBase &) |
Get the maximum value of the VectorBase. More... | |
size_t | max_index (const VectorBase &) |
Locate the maximum value in the VectorBase. More... | |
double | min (const VectorBase &) |
Get the minimum value of the VectorBase. More... | |
size_t | min_index (const VectorBase &) |
Locate the minimum value in the VectorBase. More... | |
bool | nan (const VectorBase &templat, Vector &flag) |
Create a VectorBase flag indicating NaN's in another VectorBase templat. More... | |
double | norm2_squared (const VectorBase &v) |
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. More... | |
std::ostream & | operator<< (std::ostream &s, const VectorBase &v) |
The output operator for the VectorBase class. More... | |
This is the yat interface to GSL vector.
|
inherited |
const_reference type is const double&
|
inherited |
Class that inherits from BasicVector
|
inherited |
reference type is double&
|
inherited |
value_type is double
|
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 | ) |
The copy constructor.
A | GSL_error is indirectly thrown if memory allocation fails. |
|
noexcept |
The move constructor.
|
inline |
Move constructor from Vector expression.
|
explicit |
Copy a VectorBase.
A | GSL_error is indirectly thrown if memory allocation fails. |
|
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.
|
inherited |
Set all elements to value.
|
inherited |
|
inherited |
|
inherited |
|
inherited |
This function performs element-wise division, .
GSL_error | if dimensions mis-match. |
|
inherited |
|
inherited |
|
inherited |
|
inherited |
Check whether VectorBases are equal within a user defined precision, set by precision.
|
inherited |
|
inherited |
|
inherited |
|
virtual |
Implements theplu::yat::utility::VectorMutable.
|
inherited |
This function performs element-wise multiplication, .
GSL_error | if dimensions mis-match. |
|
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.
|
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. |
|
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. |
|
inherited |
|
inherited |
Multiply with scalar and assign operator, .
|
inherited |
Addition and assign operator. VectorBase addition, .
GSL_error | if dimensions mis-match. |
|
inlineinherited |
Addition and assign operator.
|
inherited |
Add a constant to a VectorBase, .
|
inherited |
Subtract and assign operator. VectorBase subtraction, .
GSL_error | if dimensions mis-match. |
|
inlineinherited |
Subtraction and assign operator.
|
inherited |
Subtract a constant to a VectorBase, .
|
inline |
assignment from vector expression
|
inline |
move assignment from vector expression
const Vector& theplu::yat::utility::Vector::operator= | ( | const VectorBase & | ) |
|
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.
void theplu::yat::utility::Vector::resize | ( | size_t | , |
double | init_value = 0 |
||
) |
|
inherited |
|
related |
Check if all elements of the VectorBase are zero.
|
related |
Get the maximum value of the VectorBase.
|
related |
Locate the maximum value in the VectorBase.
|
related |
Get the minimum value of the VectorBase.
|
related |
Locate the minimum value in the VectorBase.
|
related |
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.
|
related |
|
related |
|
related |
|
related |
|
related |
scale a vector expression
|
related |
scale a vector expression
|
related |
Element-wise addition of vectors
|
related |
Element-wise subtraction of vectors
|
related |
negation operator
|
related |
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;
|
related |
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.
|
related |
Similar to sort_index but creates a VectorBase with indices to the k largest elements in invec.
|
related |
Similar to sort_index but creates a VectorBase with indices to the k smallest elements in invec.
|
related |
Calculate the sum of all VectorBase elements.
|
protectedinherited |
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.