SLIP  1.4
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Public Types | Public Member Functions | Static Public Attributes | Friends | Related Functions | List of all members
slip::Vector< T > Class Template Reference

Numerical Vector class. This container statisfies the RandomAccessContainer concepts of the Standard Template Library (STL). It extends the interface of Array adding arithmetical: +=, -=, *=, /=,+,-,/,*... and mathematical operators : min, max, abs, sqrt, cos, acos, sin, asin, tan, atan, exp, log, cosh, sinh, tanh, log10, sum, apply... More...

#include <Vector.hpp>

Inheritance diagram for slip::Vector< T >:
Inheritance graph

Public Types

typedef T value_type
 
typedef Vector< T > self
 
typedef const Vector< T > const_self
 
typedef value_typepointer
 
typedef const value_typeconst_pointer
 
typedef value_typereference
 
typedef const value_typeconst_reference
 
typedef ptrdiff_t difference_type
 
typedef std::size_t size_type
 
typedef pointer iterator
 
typedef const_pointer const_iterator
 
typedef slip::stride_iterator
< pointer
iterator_range
 
typedef slip::stride_iterator
< const_pointer
const_iterator_range
 
typedef std::reverse_iterator
< iterator
reverse_iterator
 
typedef std::reverse_iterator
< const_iterator
const_reverse_iterator
 
typedef std::reverse_iterator
< iterator_range
reverse_iterator_range
 
typedef std::reverse_iterator
< const_iterator_range
const_reverse_iterator_range
 
typedef slip::lin_alg_traits
< value_type >::value_type 
norm_type
 
typedef iterator default_iterator
 
typedef const_iterator const_default_iterator
 

Public Member Functions

void resize (const size_type new_n, const T &val=T())
 Resizes a Vector. More...
 
std::string name () const
 Returns the name of the class. More...
 
size_type size () const
 Returns the number of elements in the Vector. More...
 
size_type max_size () const
 Returns the maximal size (number of elements) in the Vector. More...
 
bool empty () const
 Returns true if the Vector is empty. (Thus size() == 0) More...
 
void swap (self &M)
 Swaps data with another Vector. More...
 
T & min () const
 Returns the min element of the Vector according to the operator < if T is std::complex, it returns the element of minimum magnitude. More...
 
T & max () const
 Returns the max element of the Vector according to the operator >, if T is std::complex, it returns the element of maximum magnitude. More...
 
sum () const
 Returns the sum of the elements of the Vector. More...
 
norm_type Euclidean_norm () const
 Returns the Euclidean norm $\left(\sum_i x_i\bar{x_i} \right)^{\frac{1}{2}}$ of the elements of the Vector. More...
 
norm_type L2_norm () const
 Returns the Euclidean norm $\left(\sum_i x_i\bar{x_i} \right)^{\frac{1}{2}}$ of the elements of the Vector. More...
 
norm_type L1_norm () const
 Returns the L1 norm ( $\sum_i |xi|$) of the elements of the Vector. More...
 
norm_type L22_norm () const
 Returns the L22 norm ( $\sum_i xi\bar{x_i}$) of the elements of the Vector. More...
 
norm_type infinite_norm () const
 Returns the infinite norm ( $\max_i\{|xi|\}$) of the elements of the Vector. More...
 
Vector< T > & apply (T(*fun)(T))
 Applys the one-parameter C-function fun to each element of the Vector. More...
 
Vector< T > & apply (T(*fun)(const T &))
 Applys the one-parameter C-function fun to each element of the Vector. More...
 
template<typename T>
 Vector (typename Vector< T >::size_type n)
 
template<typename T>
 Vector (typename Vector< T >::size_type n, const T &val)
 
template<typename T>
 Vector (typename Vector< T >::size_type n, const T *val)
 
Constructors & Destructors
 Vector ()
 Constructs a Vector. More...
 
 Vector (const size_type n)
 Constructs a Vector. More...
 
 Vector (const size_type n, const T &val)
 Constructs a Vector initialized by the scalar value val. More...
 
 Vector (const size_type n, const T *val)
 Constructs a Vector initialized by an array val. More...
 
template<typename InputIterator >
 Vector (InputIterator first, InputIterator last)
 Contructs a Vector from a range. More...
 
 Vector (const self &rhs)
 Constructs a copy of the Vector rhs. More...
 
 ~Vector ()
 Destructor of the Vector. More...
 
iterators
iterator begin ()
 Returns a read/write iterator that points to the first element in the Vector. Iteration is done in ordinary element order. More...
 
const_iterator begin () const
 Returns a read-only (constant) iterator that points to the first element in the Vector. Iteration is done in ordinary element order. More...
 
iterator end ()
 Returns a read/write iterator that points one past the last element in the Vector. Iteration is done in ordinary element order. More...
 
const_iterator end () const
 Returns a read-only (constant) iterator that points one past the last element in the Vector. Iteration is done in ordinary element order. More...
 
reverse_iterator rbegin ()
 Returns a read/write reverse iterator that points to the last element in the Vector. Iteration is done in reverse element order. More...
 
const_reverse_iterator rbegin () const
 Returns a read-only (constant) reverse iterator that points to the last element in the Vector. Iteration is done in reverse element order. More...
 
reverse_iterator rend ()
 Returns a read/write reverse iterator that points to one before the first element in the Vector. Iteration is done in reverse element order. More...
 
const_reverse_iterator rend () const
 Returns a read-only (constant) reverse iterator that points to one before the first element in the Vector. Iteration is done in reverse element order. More...
 
iterator_range begin (const slip::Range< int > &range)
 Returns a read/write iterator_range that points the first element within the Range. Iteration is done in ordinary element order according to the Range. More...
 
const_iterator_range begin (const slip::Range< int > &range) const
 Returns a read-only (constant) iterator_range that points the first element within the Range. Iteration is done in ordinary element order according to the Range. More...
 
iterator_range end (const slip::Range< int > &range)
 Returns a read/write iterator_range that points one past the last element in the Vector. Iteration is done in ordinary element order according to the Range. More...
 
const_iterator_range end (const slip::Range< int > &range) const
 Returns a read-only (constant) iterator_range that points one past the last element in the Vector. Iteration is done in ordinary element order according to the Range. More...
 
iterator begin (const slip::Box1d< int > &box)
 Returns a read/write iterator that points the first element within the Box1d. Iteration is done in ordinary element order. More...
 
const_iterator begin (const slip::Box1d< int > &box) const
 Returns a read-only (constant) iterator that points the first element within the Box1d. Iteration is done in ordinary element order. More...
 
iterator end (const slip::Box1d< int > &box)
 Returns a read/write iterator that points one past the last element in the Vector. Iteration is done in ordinary element order. More...
 
const_iterator end (const slip::Box1d< int > &box) const
 Returns a read-only (constant) iterator that points one past the last element within the Box1d. Iteration is done in ordinary element order. More...
 
reverse_iterator_range rbegin (const slip::Range< int > &range)
 Returns a read/write reverse_iterator_range that points the end element within the Range. Iteration is done in reverse element order according to the Range. More...
 
const_reverse_iterator_range rbegin (const slip::Range< int > &range) const
 Returns a read-only (constant) reverse_iterator_range that points the end element within the Range. Iteration is done in reverse element order according to the Range. More...
 
reverse_iterator_range rend (const slip::Range< int > &range)
 Returns a read/write reverse_iterator_range that points one previous the first element in the Range. Iteration is done in reverse element order according to the Range. More...
 
const_reverse_iterator_range rend (const slip::Range< int > &range) const
 Returns a read-only (constant) reverse_iterator_range that points one previous the first element in the Range. Iteration is done in reverse element order according to the Range. More...
 
reverse_iterator rbegin (const slip::Box1d< int > &box)
 Returns a read/write reverse_iterator that points the last element within the Box1d. Iteration is done in reverse element order. More...
 
const_reverse_iterator rbegin (const slip::Box1d< int > &box) const
 Returns a read-only (constant) reverse_iterator that points the last element within the Box1d. Iteration is done in reverse element order. More...
 
reverse_iterator rend (const slip::Box1d< int > &box)
 Returns a read/write reverse_iterator that points one previous the first element in the Box1d. Iteration is done in reverse element order. More...
 
const_reverse_iterator rend (const slip::Box1d< int > &box) const
 Returns a read-only (constant) reverse_iterator that points one previous the first element of the Box1d. Iteration is done in reverse element order. More...
 
Assignment operators and methods
selfoperator= (const self &rhs)
 Assign a Vector. More...
 
selfoperator= (const T &val)
 Assigns all the element of the Vector by val. More...
 
void fill (const T &value)
 Fills the container range [begin(),begin()+size()) with copies of value. More...
 
void fill (const T *value)
 Fills the container range [begin(),begin()+size()) with a copy of the value array. More...
 
template<typename InputIterator >
void fill (InputIterator first, InputIterator last)
 Fills the container range [begin(),begin()+size()) with a copy of the range [first,last) More...
 
Element access operators
reference operator[] (const size_type i)
 Subscript access to the data contained in the Vector. More...
 
const_reference operator[] (const size_type i) const
 Subscript access to the data contained in the Vector. More...
 
reference operator() (const size_type i)
 Subscript access to the data contained in the Vector. More...
 
const_reference operator() (const size_type i) const
 Subscript access to the data contained in the Vector. More...
 
reference operator() (const slip::Point1d< size_type > &p)
 Subscript access to the data contained in the Vector. More...
 
const_reference operator() (const slip::Point1d< size_type > &p) const
 Subscript access to the data contained in the Vector. More...
 
self operator() (const slip::Range< int > &range)
 Subscript access to the data contained in the Vector. More...
 
Arithmetic operators
selfoperator+= (const T &val)
 Add val to each element of the Vector. More...
 
selfoperator-= (const T &val)
 
selfoperator*= (const T &val)
 
selfoperator/= (const T &val)
 
self operator- () const
 
selfoperator+= (const self &rhs)
 
selfoperator-= (const self &rhs)
 
selfoperator*= (const self &rhs)
 
selfoperator/= (const self &rhs)
 

Static Public Attributes

static const std::size_t DIM = 1
 

Friends

class boost::serialization::access
 
i/o operators
std::ostream & operator<< (std::ostream &out, const self &v)
 Write the Vector to the ouput stream. More...
 
Comparison operators
bool operator== (const Vector< T > &x, const Vector< T > &y)
 Vector equality comparison. More...
 
bool operator!= (const Vector< T > &x, const Vector< T > &y)
 Vector inequality comparison. More...
 
bool operator< (const Vector< T > &x, const Vector< T > &y)
 Less than comparison operator (Vector ordering relation) More...
 
bool operator> (const Vector< T > &x, const Vector< T > &y)
 More than comparison operator. More...
 
bool operator<= (const Vector< T > &x, const Vector< T > &y)
 Less than equal comparison operator. More...
 
bool operator>= (const Vector< T > &x, const Vector< T > &y)
 More than equal comparison operator. More...
 

Related Functions

(Note that these are not member functions.)

template<typename T >
T & min (const Vector< T > &M1)
 Returns the min element of a Vector, if T is std::complex, it returns the element of minimum magnitude. More...
 
template<typename T >
T & max (const Vector< T > &M1)
 Returns the max element of a Vector, if T is std::complex, it returns the element of maximum magnitude. More...
 
template<typename T >
Vector< typename
slip::lin_alg_traits< T >
::value_type
abs (const Vector< T > &V)
 Returns the abs value of each element of the Vector. More...
 
template<typename T >
Vector< T > sqrt (const Vector< T > &V)
 Returns the sqrt value of each element of the Vector. More...
 
template<typename T >
Vector< T > cos (const Vector< T > &V)
 Returns the cos value of each element of the Vector. More...
 
Vector< float > acos (const Vector< float > &V)
 Returns the acos value of each element of the Vector. More...
 
Vector< double > acos (const Vector< double > &V)
 Returns the acos value of each element of the Vector. More...
 
Vector< long double > acos (const Vector< long double > &V)
 Returns the acos value of each element of the Vector. More...
 
template<typename T >
Vector< T > sin (const Vector< T > &V)
 Returns the sin value of each element of the Vector. More...
 
Vector< float > asin (const Vector< float > &V)
 Returns the asin value of each element of the Vector. More...
 
Vector< double > asin (const Vector< double > &V)
 Returns the asin value of each element of the Vector. More...
 
Vector< long double > asin (const Vector< long double > &V)
 Returns the asin value of each element of the Vector. More...
 
template<typename T >
Vector< T > tan (const Vector< T > &V)
 Returns the tan value of each element of the Vector. More...
 
Vector< float > atan (const Vector< float > &V)
 Returns the atan value of each element of the Vector. More...
 
Vector< double > atan (const Vector< double > &V)
 Returns the atan value of each element of the Vector. More...
 
Vector< long double > atan (const Vector< long double > &V)
 Returns the atan value of each element of the Vector. More...
 
template<typename T >
Vector< T > exp (const Vector< T > &V)
 Returns the exp value of each element of the Vector. More...
 
template<typename T >
Vector< T > log (const Vector< T > &V)
 Returns the log value of each element of the Vector. More...
 
template<typename T >
Vector< T > cosh (const Vector< T > &V)
 Returns the cosh value of each element of the Vector. More...
 
template<typename T >
Vector< T > sinh (const Vector< T > &V)
 Returns the sinh value of each element of the Vector. More...
 
template<typename T >
Vector< T > tanh (const Vector< T > &V)
 Returns the tanh value of each element of the Vector. More...
 
template<typename T >
Vector< T > log10 (const Vector< T > &V)
 Returns the log10 value of each element of the Vector. More...
 

Detailed Description

template<typename T>
class slip::Vector< T >

Numerical Vector class. This container statisfies the RandomAccessContainer concepts of the Standard Template Library (STL). It extends the interface of Array adding arithmetical: +=, -=, *=, /=,+,-,/,*... and mathematical operators : min, max, abs, sqrt, cos, acos, sin, asin, tan, atan, exp, log, cosh, sinh, tanh, log10, sum, apply...

Author
Benoit Tremblais <tremblais_AT_sic.univ-poitiers.fr>
Version
0.0.3
Date
2014/03/25
Since
1.0.0
Parameters
T.Type of object in the Vector
Examples:
example_polynomial.cpp, svd_decomp.cpp, and wav_file_io.cpp.

Definition at line 104 of file Vector.hpp.

Member Typedef Documentation

template<typename T>
typedef const_iterator slip::Vector< T >::const_default_iterator

Definition at line 185 of file Vector.hpp.

template<typename T>
typedef const_pointer slip::Vector< T >::const_iterator

Definition at line 170 of file Vector.hpp.

Definition at line 173 of file Vector.hpp.

template<typename T>
typedef const value_type* slip::Vector< T >::const_pointer

Definition at line 162 of file Vector.hpp.

template<typename T>
typedef const value_type& slip::Vector< T >::const_reference

Definition at line 164 of file Vector.hpp.

template<typename T>
typedef std::reverse_iterator<const_iterator> slip::Vector< T >::const_reverse_iterator

Definition at line 176 of file Vector.hpp.

template<typename T>
typedef std::reverse_iterator<const_iterator_range> slip::Vector< T >::const_reverse_iterator_range

Definition at line 179 of file Vector.hpp.

template<typename T>
typedef const Vector<T> slip::Vector< T >::const_self

Definition at line 159 of file Vector.hpp.

template<typename T>
typedef iterator slip::Vector< T >::default_iterator

Definition at line 184 of file Vector.hpp.

template<typename T>
typedef ptrdiff_t slip::Vector< T >::difference_type

Definition at line 166 of file Vector.hpp.

template<typename T>
typedef pointer slip::Vector< T >::iterator

Definition at line 169 of file Vector.hpp.

template<typename T>
typedef slip::stride_iterator<pointer> slip::Vector< T >::iterator_range

Definition at line 172 of file Vector.hpp.

template<typename T>
typedef slip::lin_alg_traits<value_type>::value_type slip::Vector< T >::norm_type

Definition at line 181 of file Vector.hpp.

template<typename T>
typedef value_type* slip::Vector< T >::pointer

Definition at line 161 of file Vector.hpp.

template<typename T>
typedef value_type& slip::Vector< T >::reference

Definition at line 163 of file Vector.hpp.

template<typename T>
typedef std::reverse_iterator<iterator> slip::Vector< T >::reverse_iterator

Definition at line 175 of file Vector.hpp.

template<typename T>
typedef std::reverse_iterator<iterator_range> slip::Vector< T >::reverse_iterator_range

Definition at line 178 of file Vector.hpp.

template<typename T>
typedef Vector<T> slip::Vector< T >::self

Definition at line 158 of file Vector.hpp.

template<typename T>
typedef std::size_t slip::Vector< T >::size_type

Definition at line 167 of file Vector.hpp.

template<typename T>
typedef T slip::Vector< T >::value_type

Definition at line 157 of file Vector.hpp.

Constructor & Destructor Documentation

template<typename T >
slip::Vector< T >::Vector ( )
inline

Constructs a Vector.

Definition at line 1407 of file Vector.hpp.

template<typename T>
slip::Vector< T >::Vector ( const size_type  n)

Constructs a Vector.

Parameters
nnumber of element in the Vector
template<typename T>
slip::Vector< T >::Vector ( const size_type  n,
const T &  val 
)

Constructs a Vector initialized by the scalar value val.

Parameters
nnumber of element in the Vector
valinitialization value of the elements
template<typename T>
slip::Vector< T >::Vector ( const size_type  n,
const T *  val 
)

Constructs a Vector initialized by an array val.

Parameters
nnumber of element in the Vector
valinitialization array value of the elements
template<typename T>
template<typename InputIterator >
slip::Vector< T >::Vector ( InputIterator  first,
InputIterator  last 
)
inline

Contructs a Vector from a range.

Parameters
firstAn input iterator.
lastAn input iterator.

Create a Vector consisting of copies of the elements from [first,last).

Definition at line 232 of file Vector.hpp.

template<typename T>
slip::Vector< T >::Vector ( const self rhs)
inline

Constructs a copy of the Vector rhs.

Definition at line 1433 of file Vector.hpp.

template<typename T >
slip::Vector< T >::~Vector ( )
inline

Destructor of the Vector.

Definition at line 1450 of file Vector.hpp.

template<typename T>
template<typename T>
slip::Vector< T >::Vector ( typename Vector< T >::size_type  n)
inline

Definition at line 1413 of file Vector.hpp.

template<typename T>
template<typename T>
slip::Vector< T >::Vector ( typename Vector< T >::size_type  n,
const T &  val 
)
inline

Definition at line 1419 of file Vector.hpp.

template<typename T>
template<typename T>
slip::Vector< T >::Vector ( typename Vector< T >::size_type  n,
const T *  val 
)
inline

Definition at line 1426 of file Vector.hpp.

Member Function Documentation

template<typename T>
Vector< T > & slip::Vector< T >::apply ( T(*)(T)  fun)
inline

Applys the one-parameter C-function fun to each element of the Vector.

Parameters
funThe one-parameter C function
Returns
the resulting Vector
Example:
//fill V with values from 1 to 7 with step 1
slip::iota(V.begin(),V.end(),1.0,1.0);
//apply std::sqrt to each element of V

Definition at line 1868 of file Vector.hpp.

template<typename T>
Vector< T > & slip::Vector< T >::apply ( T(*)(const T &)  fun)
inline

Applys the one-parameter C-function fun to each element of the Vector.

Parameters
funThe one-const-parameter C function
Returns
the resulting Vector
Example:
//fill V with values from 1 to 7 with step 1
slip::iota(V.begin(),V.end(),1.0,1.0);
//apply std::sqrt to each element of V

Definition at line 1876 of file Vector.hpp.

template<typename T >
Vector< T >::iterator slip::Vector< T >::begin ( )
inline

Returns a read/write iterator that points to the first element in the Vector. Iteration is done in ordinary element order.

Returns
begin iterator value
Remarks
This iterator is compatible with RandomAccessIterator algorithms.

Definition at line 1474 of file Vector.hpp.

template<typename T >
Vector< T >::const_iterator slip::Vector< T >::begin ( ) const
inline

Returns a read-only (constant) iterator that points to the first element in the Vector. Iteration is done in ordinary element order.

Returns
const begin iterator value
Remarks
This iterator is compatible with RandomAccessIterator algorithms.

Definition at line 1488 of file Vector.hpp.

template<typename T >
Vector< T >::iterator_range slip::Vector< T >::begin ( const slip::Range< int > &  range)
inline

Returns a read/write iterator_range that points the first element within the Range. Iteration is done in ordinary element order according to the Range.

Parameters
rangeRange to iterate.
Returns
end iterator_range value
Precondition
The range must be inside the whole range of the Vector.
Remarks
This iterator is compatible with RandomAccessIterator algorithms.
Example:
slip::Range<int> range(1,5,2);
std::copy(A5.begin(range),A5.end(range),std::ostream_iterator<double>(std::cout," "));

Definition at line 1537 of file Vector.hpp.

template<typename T >
Vector< T >::const_iterator_range slip::Vector< T >::begin ( const slip::Range< int > &  range) const
inline

Returns a read-only (constant) iterator_range that points the first element within the Range. Iteration is done in ordinary element order according to the Range.

Parameters
rangeRange to iterate.
Returns
const_iterator_range value
Precondition
The range must be inside the whole range of the Vector.
Remarks
This iterator is compatible with RandomAccessIterator algorithms.
Example:
slip::Range<int> range(1,5,2);
std::copy(A5.begin(range),A5.end(range),std::ostream_iterator<double>(std::cout,"
"));

Definition at line 1553 of file Vector.hpp.

template<typename T >
Vector< T >::iterator slip::Vector< T >::begin ( const slip::Box1d< int > &  box)
inline

Returns a read/write iterator that points the first element within the Box1d. Iteration is done in ordinary element order.

Parameters
boxBox1d to iterate.
Returns
end iterator value
Precondition
The box must be inside the whole range of the Vector.
Remarks
This iterator is compatible with RandomAccessIterator algorithms.
Example:
std::copy(A5.begin(box),A5.end(box),std::ostream_iterator<double>(std::cout," "));

Definition at line 1572 of file Vector.hpp.

template<typename T >
Vector< T >::const_iterator slip::Vector< T >::begin ( const slip::Box1d< int > &  box) const
inline

Returns a read-only (constant) iterator that points the first element within the Box1d. Iteration is done in ordinary element order.

Parameters
boxBox1d to iterate.
Returns
const_iterator value
Precondition
The box must be inside the whole range of the Vector.
Remarks
This iterator is compatible with RandomAccessIterator algorithms.
Example:
std::copy(A5.begin(box),A5.end(box),std::ostream_iterator<double>(std::cout," "));

Definition at line 1588 of file Vector.hpp.

template<typename T >
bool slip::Vector< T >::empty ( ) const
inline

Returns true if the Vector is empty. (Thus size() == 0)

Definition at line 1754 of file Vector.hpp.

template<typename T >
Vector< T >::iterator slip::Vector< T >::end ( )
inline

Returns a read/write iterator that points one past the last element in the Vector. Iteration is done in ordinary element order.

Returns
end iterator value
Remarks
This iterator is compatible with RandomAccessIterator algorithms.

Definition at line 1481 of file Vector.hpp.

template<typename T >
Vector< T >::const_iterator slip::Vector< T >::end ( ) const
inline

Returns a read-only (constant) iterator that points one past the last element in the Vector. Iteration is done in ordinary element order.

Returns
const end iterator value
Remarks
This iterator is compatible with RandomAccessIterator algorithms.

Definition at line 1496 of file Vector.hpp.

template<typename T >
Vector< T >::iterator_range slip::Vector< T >::end ( const slip::Range< int > &  range)
inline

Returns a read/write iterator_range that points one past the last element in the Vector. Iteration is done in ordinary element order according to the Range.

Parameters
rangeRange to iterate.
Returns
end iterator_range value
Precondition
The range must be inside the whole range of the Vector.
Remarks
This iterator is compatible with RandomAccessIterator algorithms.
Example:
slip::Range<int> range(1,5,2);
std::copy(A5.begin(range),A5.end(range),std::ostream_iterator<double>(std::cout," "));

Definition at line 1545 of file Vector.hpp.

template<typename T >
Vector< T >::const_iterator_range slip::Vector< T >::end ( const slip::Range< int > &  range) const
inline

Returns a read-only (constant) iterator_range that points one past the last element in the Vector. Iteration is done in ordinary element order according to the Range.

Parameters
rangeRange to iterate.
Returns
const_iterator_range value
Precondition
The range must be inside the whole range of the Vector.
Remarks
This iterator is compatible with RandomAccessIterator algorithms.
Example:
slip::Range<int> range(1,5,2);
std::copy(A5.begin(range),A5.end(range),std::ostream_iterator<double>(std::cout,"
"));

Definition at line 1562 of file Vector.hpp.

template<typename T >
Vector< T >::iterator slip::Vector< T >::end ( const slip::Box1d< int > &  box)
inline

Returns a read/write iterator that points one past the last element in the Vector. Iteration is done in ordinary element order.

Parameters
boxBox1d to iterate.
Returns
end iterator value
Precondition
The box must be inside the whole range of the Vector.
Remarks
This iterator is compatible with RandomAccessIterator algorithms.
Example:
std::copy(A5.begin(box),A5.end(box),std::ostream_iterator<double>(std::cout," "));

Definition at line 1580 of file Vector.hpp.

template<typename T >
Vector< T >::const_iterator slip::Vector< T >::end ( const slip::Box1d< int > &  box) const
inline

Returns a read-only (constant) iterator that points one past the last element within the Box1d. Iteration is done in ordinary element order.

Parameters
boxBox1d to iterate.
Returns
const_iterator value
Precondition
The box must be inside the whole range of the Vector.
Remarks
This iterator is compatible with RandomAccessIterator algorithms.
Example:
std::copy(A5.begin(box),A5.end(box),std::ostream_iterator<double>(std::cout," "));

Definition at line 1597 of file Vector.hpp.

template<typename T>
norm_type slip::Vector< T >::Euclidean_norm ( ) const
inline

Returns the Euclidean norm $\left(\sum_i x_i\bar{x_i} \right)^{\frac{1}{2}}$ of the elements of the Vector.

Precondition
size() != 0

Definition at line 977 of file Vector.hpp.

template<typename T>
void slip::Vector< T >::fill ( const T &  value)
inline

Fills the container range [begin(),begin()+size()) with copies of value.

Parameters
valueA reference-to-const of arbitrary type.

Definition at line 704 of file Vector.hpp.

template<typename T>
void slip::Vector< T >::fill ( const T *  value)
inline

Fills the container range [begin(),begin()+size()) with a copy of the value array.

Parameters
valueA pointer of arbitrary type.

Definition at line 715 of file Vector.hpp.

template<typename T>
template<typename InputIterator >
void slip::Vector< T >::fill ( InputIterator  first,
InputIterator  last 
)
inline

Fills the container range [begin(),begin()+size()) with a copy of the range [first,last)

Parameters
firstAn input iterator.
lastAn input iterator.

Definition at line 729 of file Vector.hpp.

template<typename T>
norm_type slip::Vector< T >::infinite_norm ( ) const
inline

Returns the infinite norm ( $\max_i\{|xi|\}$) of the elements of the Vector.

Precondition
size() != 0

Definition at line 1017 of file Vector.hpp.

template<typename T>
norm_type slip::Vector< T >::L1_norm ( ) const
inline

Returns the L1 norm ( $\sum_i |xi|$) of the elements of the Vector.

Precondition
size() != 0

Definition at line 997 of file Vector.hpp.

template<typename T>
norm_type slip::Vector< T >::L22_norm ( ) const
inline

Returns the L22 norm ( $\sum_i xi\bar{x_i}$) of the elements of the Vector.

Precondition
size() != 0

Definition at line 1007 of file Vector.hpp.

template<typename T>
norm_type slip::Vector< T >::L2_norm ( ) const
inline

Returns the Euclidean norm $\left(\sum_i x_i\bar{x_i} \right)^{\frac{1}{2}}$ of the elements of the Vector.

Precondition
size() != 0

Definition at line 987 of file Vector.hpp.

template<typename T >
T & slip::Vector< T >::max ( ) const
inline

Returns the max element of the Vector according to the operator >, if T is std::complex, it returns the element of maximum magnitude.

Precondition
size() != 0

Definition at line 1852 of file Vector.hpp.

template<typename T >
Vector< T >::size_type slip::Vector< T >::max_size ( ) const
inline

Returns the maximal size (number of elements) in the Vector.

Definition at line 1747 of file Vector.hpp.

template<typename T >
T & slip::Vector< T >::min ( ) const
inline

Returns the min element of the Vector according to the operator < if T is std::complex, it returns the element of minimum magnitude.

Precondition
size() != 0

Definition at line 1844 of file Vector.hpp.

template<typename T >
std::string slip::Vector< T >::name ( ) const
inline

Returns the name of the class.

Definition at line 1739 of file Vector.hpp.

template<typename T>
reference slip::Vector< T >::operator() ( const size_type  i)

Subscript access to the data contained in the Vector.

Parameters
iThe index of the row for which the data should be accessed.
Returns
Read/write reference to data.
Precondition
i < size()

This operator allows for easy, array-style, data access. Note that data access with this operator is unchecked and out_of_range lookups are not defined.

template<typename T>
const_reference slip::Vector< T >::operator() ( const size_type  i) const

Subscript access to the data contained in the Vector.

Parameters
iThe index of the row for which the data should be accessed.
Returns
Read_only (constant) reference to data.
Precondition
i < size()

This operator allows for easy, array-style, data access. Note that data access with this operator is unchecked and out_of_range lookups are not defined.

template<typename T>
reference slip::Vector< T >::operator() ( const slip::Point1d< size_type > &  p)

Subscript access to the data contained in the Vector.

Parameters
pThe index point corresponding of the element for which data should be accessed.
Returns
Read/write reference to data.
Precondition
p[0] < size()

This operator allows for easy, array-style, data access. Note that data access with this operator is unchecked and out_of_range lookups are not defined.

template<typename T>
const_reference slip::Vector< T >::operator() ( const slip::Point1d< size_type > &  p) const

Subscript access to the data contained in the Vector.

Parameters
pThe index point corresponding of the element for which data should be accessed.
Returns
Read-only (constant) reference to data.
Precondition
p[0] < size()

This operator allows for easy, array-style, data access. Note that data access with this operator is unchecked and out_of_range lookups are not defined.

template<typename T >
Vector< T > slip::Vector< T >::operator() ( const slip::Range< int > &  range)
inline

Subscript access to the data contained in the Vector.

Parameters
rangeThe range of the Vector.
Returns
a copy of the range.
Precondition
range must be valid.
The ranges indices must be inside the ranges of the Vector ones.

This operator allows for easy, 1d array-style, data access. Note that data access with this operator is unchecked and out_of_range lookups are not defined.

Definition at line 1726 of file Vector.hpp.

template<typename T>
Vector< T > & slip::Vector< T >::operator*= ( const T &  val)
inline

Definition at line 1782 of file Vector.hpp.

template<typename T>
Vector< T > & slip::Vector< T >::operator*= ( const self rhs)
inline

Definition at line 1826 of file Vector.hpp.

template<typename T>
Vector< T > & slip::Vector< T >::operator+= ( const T &  val)
inline

Add val to each element of the Vector.

Parameters
valvalue
Returns
reference to the resulting Vector

Definition at line 1766 of file Vector.hpp.

template<typename T>
Vector< T > & slip::Vector< T >::operator+= ( const self rhs)
inline

Definition at line 1808 of file Vector.hpp.

template<typename T >
Vector< T > slip::Vector< T >::operator- ( ) const
inline

Definition at line 1799 of file Vector.hpp.

template<typename T>
Vector< T > & slip::Vector< T >::operator-= ( const T &  val)
inline

Definition at line 1774 of file Vector.hpp.

template<typename T>
Vector< T > & slip::Vector< T >::operator-= ( const self rhs)
inline

Definition at line 1817 of file Vector.hpp.

template<typename T>
Vector< T > & slip::Vector< T >::operator/= ( const T &  val)
inline

Definition at line 1790 of file Vector.hpp.

template<typename T>
Vector< T > & slip::Vector< T >::operator/= ( const self rhs)
inline

Definition at line 1835 of file Vector.hpp.

template<typename T >
Vector< T > & slip::Vector< T >::operator= ( const self rhs)
inline

Assign a Vector.

Assign elements of Vector in rhs

Parameters
rhsVector to get the values from.
Returns

Definition at line 1439 of file Vector.hpp.

template<typename T>
Vector< T > & slip::Vector< T >::operator= ( const T &  val)
inline

Assigns all the element of the Vector by val.

Parameters
valaffectation value
Returns
reference to corresponding Vector

Definition at line 1457 of file Vector.hpp.

template<typename T>
reference slip::Vector< T >::operator[] ( const size_type  i)

Subscript access to the data contained in the Vector.

Parameters
iThe index of the row for which the data should be accessed.
Returns
Read/write reference to data.
Precondition
i < size()

This operator allows for easy, array-style, data access. Note that data access with this operator is unchecked and out_of_range lookups are not defined.

template<typename T>
const_reference slip::Vector< T >::operator[] ( const size_type  i) const

Subscript access to the data contained in the Vector.

Parameters
iThe index of the row for which the data should be accessed.
Returns
Read_only (constant) reference to data.
Precondition
i < size()

This operator allows for easy, array-style, data access. Note that data access with this operator is unchecked and out_of_range lookups are not defined.

template<typename T >
Vector< T >::reverse_iterator slip::Vector< T >::rbegin ( )
inline

Returns a read/write reverse iterator that points to the last element in the Vector. Iteration is done in reverse element order.

Returns
reverse begin iterator value
Remarks
This iterator is compatible with RandomAccessIterator algorithms.

Definition at line 1505 of file Vector.hpp.

template<typename T >
Vector< T >::const_reverse_iterator slip::Vector< T >::rbegin ( ) const
inline

Returns a read-only (constant) reverse iterator that points to the last element in the Vector. Iteration is done in reverse element order.

Returns
const reverse begin iterator value
Remarks
This iterator is compatible with RandomAccessIterator algorithms.

Definition at line 1519 of file Vector.hpp.

template<typename T >
Vector< T >::reverse_iterator_range slip::Vector< T >::rbegin ( const slip::Range< int > &  range)
inline

Returns a read/write reverse_iterator_range that points the end element within the Range. Iteration is done in reverse element order according to the Range.

Parameters
rangeRange to iterate.
Returns
reverse_iterator_range value
Precondition
The range must be inside the whole range of the Vector.
Remarks
This iterator is compatible with RandomAccessIterator algorithms.
Example:
slip::Range<int> range(1,5,2);
std::copy(A5.rbegin(range),A5.rend(range),std::ostream_iterator<double>(std::cout," "));

Definition at line 1639 of file Vector.hpp.

template<typename T >
Vector< T >::const_reverse_iterator_range slip::Vector< T >::rbegin ( const slip::Range< int > &  range) const
inline

Returns a read-only (constant) reverse_iterator_range that points the end element within the Range. Iteration is done in reverse element order according to the Range.

Parameters
rangeRange to iterate.
Returns
cons_treverse__iterator_range value
Precondition
The range must be inside the whole range of the Vector.
Remarks
This iterator is compatible with RandomAccessIterator algorithms.
Example:
slip::Range<int> range(1,5,2);
std::copy(A5.rbegin(range),A5.rend(range),std::ostream_iterator<double>(std::cout,"
"));

Definition at line 1655 of file Vector.hpp.

template<typename T >
Vector< T >::reverse_iterator slip::Vector< T >::rbegin ( const slip::Box1d< int > &  box)
inline

Returns a read/write reverse_iterator that points the last element within the Box1d. Iteration is done in reverse element order.

Parameters
boxBox1d to iterate.
Returns
reverse_iterator value
Precondition
The box must be inside the whole range of the Vector.
Remarks
This iterator is compatible with RandomAccessIterator algorithms.
Example:
std::copy(A5.rbegin(box),A5.rend(box),std::ostream_iterator<double>(std::cout," "));

Definition at line 1606 of file Vector.hpp.

template<typename T >
Vector< T >::const_reverse_iterator slip::Vector< T >::rbegin ( const slip::Box1d< int > &  box) const
inline

Returns a read-only (constant) reverse_iterator that points the last element within the Box1d. Iteration is done in reverse element order.

Parameters
boxBox1d to iterate.
Returns
const_reverse_iterator value
Precondition
The box must be inside the whole range of the Vector.
Remarks
This iterator is compatible with RandomAccessIterator algorithms.
Example:
std::copy(A5.rbegin(box),A5.rend(box),std::ostream_iterator<double>(std::cout," "));

Definition at line 1622 of file Vector.hpp.

template<typename T >
Vector< T >::reverse_iterator slip::Vector< T >::rend ( )
inline

Returns a read/write reverse iterator that points to one before the first element in the Vector. Iteration is done in reverse element order.

Returns
reverse end iterator value
Remarks
This iterator is compatible with RandomAccessIterator algorithms.

Definition at line 1512 of file Vector.hpp.

template<typename T >
Vector< T >::const_reverse_iterator slip::Vector< T >::rend ( ) const
inline

Returns a read-only (constant) reverse iterator that points to one before the first element in the Vector. Iteration is done in reverse element order.

Returns
const reverse end iterator value
Remarks
This iterator is compatible with RandomAccessIterator algorithms.

Definition at line 1527 of file Vector.hpp.

template<typename T >
Vector< T >::reverse_iterator_range slip::Vector< T >::rend ( const slip::Range< int > &  range)
inline

Returns a read/write reverse_iterator_range that points one previous the first element in the Range. Iteration is done in reverse element order according to the Range.

Parameters
rangeRange to iterate.
Returns
reverse_iterator_range value
Precondition
The range must be inside the whole range of the Vector.
Remarks
This iterator is compatible with RandomAccessIterator algorithms.
Example:
slip::Range<int> range(1,5,2);
std::copy(A5.rbegin(range),A5.rend(range),std::ostream_iterator<double>(std::cout," "));

Definition at line 1647 of file Vector.hpp.

template<typename T >
Vector< T >::const_reverse_iterator_range slip::Vector< T >::rend ( const slip::Range< int > &  range) const
inline

Returns a read-only (constant) reverse_iterator_range that points one previous the first element in the Range. Iteration is done in reverse element order according to the Range.

Parameters
rangeRange to iterate.
Returns
const_reverse_iterator_range value
Precondition
The range must be inside the whole range of the Vector.
Remarks
This iterator is compatible with RandomAccessIterator algorithms.
Example:
slip::Range<int> range(1,5,2);
std::copy(A5.rbegin(range),A5.rend(range),std::ostream_iterator<double>(std::cout,"
"));

Definition at line 1664 of file Vector.hpp.

template<typename T >
Vector< T >::reverse_iterator slip::Vector< T >::rend ( const slip::Box1d< int > &  box)
inline

Returns a read/write reverse_iterator that points one previous the first element in the Box1d. Iteration is done in reverse element order.

Parameters
boxBox1d to iterate.
Returns
reverse_iterator value
Precondition
The box must be inside the whole range of the Vector.
Remarks
This iterator is compatible with RandomAccessIterator algorithms.
Example:
std::copy(A5.rbegin(box),A5.rend(box),std::ostream_iterator<double>(std::cout," "));

Definition at line 1614 of file Vector.hpp.

template<typename T >
Vector< T >::const_reverse_iterator slip::Vector< T >::rend ( const slip::Box1d< int > &  box) const
inline

Returns a read-only (constant) reverse_iterator that points one previous the first element of the Box1d. Iteration is done in reverse element order.

Parameters
boxBox1d to iterate.
Returns
const_reverse_iterator value
Precondition
The box must be inside the whole range of the Vector.
Remarks
This iterator is compatible with RandomAccessIterator algorithms.
Example:
std::copy(A5.rbegin(box),A5.rend(box),std::ostream_iterator<double>(std::cout," "));

Definition at line 1631 of file Vector.hpp.

template<typename T>
void slip::Vector< T >::resize ( const size_type  new_n,
const T &  val = T() 
)
inline

Resizes a Vector.

Parameters
new_nnew dimension of the Vector
valnew value for all the elements

Definition at line 1465 of file Vector.hpp.

template<typename T >
Vector< T >::size_type slip::Vector< T >::size ( ) const
inline

Returns the number of elements in the Vector.

Definition at line 1743 of file Vector.hpp.

template<typename T >
T slip::Vector< T >::sum ( ) const
inline

Returns the sum of the elements of the Vector.

Precondition
size() != 0

Definition at line 1860 of file Vector.hpp.

template<typename T >
void slip::Vector< T >::swap ( self M)
inline

Swaps data with another Vector.

Parameters
MA Vector of the same element type

Definition at line 1758 of file Vector.hpp.

Friends And Related Function Documentation

template<typename T >
Vector< typename slip::lin_alg_traits< T >::value_type > abs ( const Vector< T > &  V)
related

Returns the abs value of each element of the Vector.

Parameters
VThe Vector
Returns
the resulting Vector

Definition at line 2013 of file Vector.hpp.

template<typename T>
Vector< float > acos ( const Vector< float > &  V)
related

Returns the acos value of each element of the Vector.

Parameters
VThe Vector
Returns
the resulting Vector

Definition at line 2041 of file Vector.hpp.

template<typename T>
Vector< double > acos ( const Vector< double > &  V)
related

Returns the acos value of each element of the Vector.

Parameters
VThe Vector
Returns
the resulting Vector

Definition at line 2049 of file Vector.hpp.

template<typename T>
Vector< long double > acos ( const Vector< long double > &  V)
related

Returns the acos value of each element of the Vector.

Parameters
VThe Vector
Returns
the resulting Vector

Definition at line 2057 of file Vector.hpp.

template<typename T>
Vector< float > asin ( const Vector< float > &  V)
related

Returns the asin value of each element of the Vector.

Parameters
VThe Vector
Returns
the resulting Vector

Definition at line 2076 of file Vector.hpp.

template<typename T>
Vector< double > asin ( const Vector< double > &  V)
related

Returns the asin value of each element of the Vector.

Parameters
VThe Vector
Returns
the resulting Vector

Definition at line 2084 of file Vector.hpp.

template<typename T>
Vector< long double > asin ( const Vector< long double > &  V)
related

Returns the asin value of each element of the Vector.

Parameters
VThe Vector
Returns
the resulting Vector

Definition at line 2092 of file Vector.hpp.

template<typename T>
Vector< float > atan ( const Vector< float > &  V)
related

Returns the atan value of each element of the Vector.

Parameters
VThe Vector
Returns
the resulting Vector

Definition at line 2109 of file Vector.hpp.

template<typename T>
Vector< double > atan ( const Vector< double > &  V)
related

Returns the atan value of each element of the Vector.

Parameters
VThe Vector
Returns
the resulting Vector

Definition at line 2117 of file Vector.hpp.

template<typename T>
Vector< long double > atan ( const Vector< long double > &  V)
related

Returns the atan value of each element of the Vector.

Parameters
VThe Vector
Returns
the resulting Vector

Definition at line 2125 of file Vector.hpp.

template<typename T>
friend class boost::serialization::access
friend

Definition at line 1060 of file Vector.hpp.

template<typename T >
Vector< T > cos ( const Vector< T > &  V)
related

Returns the cos value of each element of the Vector.

Parameters
VThe Vector
Returns
the resulting Vector

Definition at line 2032 of file Vector.hpp.

template<typename T >
Vector< T > cosh ( const Vector< T > &  V)
related

Returns the cosh value of each element of the Vector.

Parameters
VThe Vector
Returns
the resulting Vector

Definition at line 2152 of file Vector.hpp.

template<typename T >
Vector< T > exp ( const Vector< T > &  V)
related

Returns the exp value of each element of the Vector.

Parameters
VThe Vector
Returns
the resulting Vector

Definition at line 2134 of file Vector.hpp.

template<typename T >
Vector< T > log ( const Vector< T > &  V)
related

Returns the log value of each element of the Vector.

Parameters
VThe Vector
Returns
the resulting Vector

Definition at line 2143 of file Vector.hpp.

template<typename T >
Vector< T > log10 ( const Vector< T > &  V)
related

Returns the log10 value of each element of the Vector.

Parameters
VThe Vector
Returns
the resulting Vector

Definition at line 2179 of file Vector.hpp.

template<typename T >
T & max ( const Vector< T > &  M1)
related

Returns the max element of a Vector, if T is std::complex, it returns the element of maximum magnitude.

Parameters
M1the Vector
Returns
the max element

Definition at line 2006 of file Vector.hpp.

template<typename T >
T & min ( const Vector< T > &  M1)
related

Returns the min element of a Vector, if T is std::complex, it returns the element of minimum magnitude.

Parameters
M1the Vector
Returns
the min element

Definition at line 1999 of file Vector.hpp.

template<typename T>
bool operator!= ( const Vector< T > &  x,
const Vector< T > &  y 
)
friend

Vector inequality comparison.

Parameters
xA Vector
yA Vector of the same type of x
Returns
true if !(x == y)

Definition at line 2198 of file Vector.hpp.

template<typename T>
bool operator< ( const Vector< T > &  x,
const Vector< T > &  y 
)
friend

Less than comparison operator (Vector ordering relation)

Parameters
xA Vector
yA Vector of the same type of x
Returns
true iff x is lexicographically less than y

Definition at line 2208 of file Vector.hpp.

template<typename T>
std::ostream& operator<< ( std::ostream &  out,
const self v 
)
friend

Write the Vector to the ouput stream.

Parameters
outoutput std:ostream
vVector to write to the output stream

Definition at line 1673 of file Vector.hpp.

template<typename T>
bool operator<= ( const Vector< T > &  x,
const Vector< T > &  y 
)
friend

Less than equal comparison operator.

Parameters
xA Vector
yA Vector of the same type of x
Returns
true iff !(y > x)

Definition at line 2224 of file Vector.hpp.

template<typename T>
bool operator== ( const Vector< T > &  x,
const Vector< T > &  y 
)
friend

Vector equality comparison.

Parameters
xA Vector
yA Vector of the same type of x
Returns
true iff the size and the elements of the Arrays are equal

Definition at line 2190 of file Vector.hpp.

template<typename T>
bool operator> ( const Vector< T > &  x,
const Vector< T > &  y 
)
friend

More than comparison operator.

Parameters
xA Vector
yA Vector of the same type of x
Returns
true iff y > x

Definition at line 2216 of file Vector.hpp.

template<typename T>
bool operator>= ( const Vector< T > &  x,
const Vector< T > &  y 
)
friend

More than equal comparison operator.

Parameters
xA Vector
yA Vector of the same type of x
Returns
true iff !(x < y)

Definition at line 2232 of file Vector.hpp.

template<typename T >
Vector< T > sin ( const Vector< T > &  V)
related

Returns the sin value of each element of the Vector.

Parameters
VThe Vector
Returns
the resulting Vector

Definition at line 2066 of file Vector.hpp.

template<typename T >
Vector< T > sinh ( const Vector< T > &  V)
related

Returns the sinh value of each element of the Vector.

Parameters
VThe Vector
Returns
the resulting Vector

Definition at line 2161 of file Vector.hpp.

template<typename T >
Vector< T > sqrt ( const Vector< T > &  V)
related

Returns the sqrt value of each element of the Vector.

Parameters
VThe Vector
Returns
the resulting Vector

Definition at line 2023 of file Vector.hpp.

template<typename T >
Vector< T > tan ( const Vector< T > &  V)
related

Returns the tan value of each element of the Vector.

Parameters
VThe Vector
Returns
the resulting Vector

Definition at line 2101 of file Vector.hpp.

template<typename T >
Vector< T > tanh ( const Vector< T > &  V)
related

Returns the tanh value of each element of the Vector.

Parameters
VThe Vector
Returns
the resulting Vector

Definition at line 2170 of file Vector.hpp.

Member Data Documentation

template<typename T>
const std::size_t slip::Vector< T >::DIM = 1
static

Definition at line 188 of file Vector.hpp.


The documentation for this class was generated from the following file: