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

This is a linear (one-dimensional) static vector. 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, Euclidean norm, L1 norm, L2 norm... More...

#include <KVector.hpp>

Inheritance diagram for slip::kvector< T, N >:
Inheritance graph

Public Types

typedef T value_type
 
typedef kvector< T, N > self
 
typedef const kvector< T, N > 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

std::string name () const
 Returns the name of the class. More...
 
size_type size () const
 Returns the number of elements in the kvector. More...
 
size_type max_size () const
 Returns the maximal size (number of elements) in the kvector. More...
 
bool empty () const
 Returns true if the kvector is empty. (Thus size == 0) More...
 
void swap (kvector &x)
 Swaps data with another kvector. More...
 
iterators
iterator begin ()
 Returns a read/write iterator that points to the first element in the kvector. 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 kvector. Iteration is done in ordinary element order. More...
 
iterator end ()
 Returns a read/write iterator that points one past the last element in the kvector. 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 kvector. Iteration is done in ordinary 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 kvector. 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 kvector. Iteration is done in ordinary element order according to the Range. More...
 
reverse_iterator rbegin ()
 Returns a read/write reverse iterator that points to the last element in the kvector. 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 kvector. 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 kvector. 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 kvector. Iteration is done in reverse 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...
 
Assignment methods
kvector< T, N > & operator= (const kvector< T, N > &rhs)
 Assigns all the element of the kvector by the kvector rhs. More...
 
kvector< T, N > & operator= (const T &val)
 Assigns all the element of the kvector by val. More...
 
void fill (const T &value)
 Fills the container range [begin(),begin()+N) with copies of value. More...
 
void fill (const T *value)
 Fills the container range [begin(),begin()+N) with a copy of the value array. More...
 
template<typename InputIterator >
void fill (InputIterator first, InputIterator last)
 Fills the container range [begin(),begin()+N) with a copy of the range [first,last) More...
 
Element access operators
reference operator[] (const size_type n)
 Subscript access to the data contained in the kvector. More...
 
const_reference operator[] (const size_type n) const
 Subscript access to the data contained in the kvector. More...
 
reference operator() (const size_type n)
 Subscript access to the data contained in the kvector. More...
 
const_reference operator() (const size_type n) const
 Subscript access to the data contained in the kvector. More...
 
Arithmetic operators
selfoperator+= (const T &val)
 Add val to each element of the kvector. 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)
 
Mathematical operators
T & min ()
 Returns the min element of the kvector according to the operator <, if T is std::complex, it returns the element of minimum magnitude. More...
 
T & max ()
 Returns the max element of the kvector 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 kvector. 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 kvector. 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 kvector. More...
 
norm_type L1_norm () const
 Returns the L1 norm ( $\sum_i |xi|$) of the elements of the kvector. More...
 
norm_type L22_norm () const
 Returns the L22 norm ( $\sum_i xi^2$) of the elements of the kvector. More...
 
norm_type infinite_norm () const
 Returns the infinite norm ( $\max_i\{|xi|\}$) of the elements of the kvector. More...
 
template<typename Real >
Real dot (const self &other)
 Computes the dot product with another kvector other. More...
 
kvector< T, N > & apply (T(*fun)(T))
 Applys the one-parameter C-function fun to each element of the kvector. More...
 
kvector< T, N > & apply (T(*fun)(const T &))
 Applys the one-parameter C-function fun to each element of the kvector. More...
 

Public Attributes

data [N]
 Data array storage of the kvector. More...
 

Static Public Attributes

static const std::size_t SIZE = N
 
static const std::size_t DIM = 1
 

Protected Member Functions

template<class Archive >
void save (Archive &ar, const unsigned int version) const
 
template<class Archive >
void load (Archive &ar, const unsigned int version)
 

Friends

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

Related Functions

(Note that these are not member functions.)

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

Detailed Description

template<class T, std::size_t N>
struct slip::kvector< T, N >

This is a linear (one-dimensional) static vector. 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, Euclidean norm, L1 norm, L2 norm...

Author
Benoit Tremblais tremb.nosp@m.lais.nosp@m.@sic..nosp@m.univ.nosp@m.-poit.nosp@m.iers.nosp@m..fr
Version
0.0.3
Date
2014/03/25
Since
1.0.0
Parameters
TType of the element in the kvector
Nnumber of element in the kvector

Definition at line 100 of file KVector.hpp.

Member Typedef Documentation

template<class T, std::size_t N>
typedef const_iterator slip::kvector< T, N >::const_default_iterator

Definition at line 178 of file KVector.hpp.

template<class T, std::size_t N>
typedef const_pointer slip::kvector< T, N >::const_iterator

Definition at line 163 of file KVector.hpp.

template<class T, std::size_t N>
typedef slip::stride_iterator<const_pointer> slip::kvector< T, N >::const_iterator_range

Definition at line 165 of file KVector.hpp.

template<class T, std::size_t N>
typedef const value_type* slip::kvector< T, N >::const_pointer

Definition at line 155 of file KVector.hpp.

template<class T, std::size_t N>
typedef const value_type& slip::kvector< T, N >::const_reference

Definition at line 157 of file KVector.hpp.

template<class T, std::size_t N>
typedef std::reverse_iterator<const_iterator> slip::kvector< T, N >::const_reverse_iterator

Definition at line 168 of file KVector.hpp.

template<class T, std::size_t N>
typedef std::reverse_iterator<const_iterator_range> slip::kvector< T, N >::const_reverse_iterator_range

Definition at line 171 of file KVector.hpp.

template<class T, std::size_t N>
typedef const kvector<T,N> slip::kvector< T, N >::const_self

Definition at line 152 of file KVector.hpp.

template<class T, std::size_t N>
typedef iterator slip::kvector< T, N >::default_iterator

Definition at line 177 of file KVector.hpp.

template<class T, std::size_t N>
typedef ptrdiff_t slip::kvector< T, N >::difference_type

Definition at line 159 of file KVector.hpp.

template<class T, std::size_t N>
typedef pointer slip::kvector< T, N >::iterator

Definition at line 162 of file KVector.hpp.

template<class T, std::size_t N>
typedef slip::stride_iterator<pointer> slip::kvector< T, N >::iterator_range

Definition at line 164 of file KVector.hpp.

template<class T, std::size_t N>
typedef slip::lin_alg_traits<value_type>::value_type slip::kvector< T, N >::norm_type

Definition at line 173 of file KVector.hpp.

template<class T, std::size_t N>
typedef value_type* slip::kvector< T, N >::pointer

Definition at line 154 of file KVector.hpp.

template<class T, std::size_t N>
typedef value_type& slip::kvector< T, N >::reference

Definition at line 156 of file KVector.hpp.

template<class T, std::size_t N>
typedef std::reverse_iterator<iterator> slip::kvector< T, N >::reverse_iterator

Definition at line 167 of file KVector.hpp.

template<class T, std::size_t N>
typedef std::reverse_iterator<iterator_range> slip::kvector< T, N >::reverse_iterator_range

Definition at line 170 of file KVector.hpp.

template<class T, std::size_t N>
typedef kvector<T,N> slip::kvector< T, N >::self

Definition at line 151 of file KVector.hpp.

template<class T, std::size_t N>
typedef std::size_t slip::kvector< T, N >::size_type

Definition at line 160 of file KVector.hpp.

template<class T, std::size_t N>
typedef T slip::kvector< T, N >::value_type

Definition at line 150 of file KVector.hpp.

Member Function Documentation

template<class T, std::size_t N>
kvector<T,N>& slip::kvector< T, N >::apply ( T(*)(T)  fun)
inline

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

Parameters
funThe one-parameter C function
Returns
the resulting kvector
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 906 of file KVector.hpp.

template<class T, std::size_t N>
kvector<T,N>& slip::kvector< T, N >::apply ( T(*)(const T &)  fun)
inline

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

Parameters
funThe one-const-parameter C function
Returns
the resulting kvector
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 927 of file KVector.hpp.

template<class T, std::size_t N>
iterator slip::kvector< T, N >::begin ( )
inline

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

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

Definition at line 196 of file KVector.hpp.

template<class T, std::size_t N>
const_iterator slip::kvector< T, N >::begin ( ) const
inline

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

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

Definition at line 207 of file KVector.hpp.

template<class T, std::size_t N>
iterator_range slip::kvector< T, N >::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
range.Range to iterate.
Returns
end iterator_range value
Precondition
The range must be inside the whole range of the kvector.
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 248 of file KVector.hpp.

template<class T, std::size_t N>
const_iterator_range slip::kvector< T, N >::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
range.Range to iterate.
Returns
const_iterator_range value
Precondition
The range must be inside the whole range of the kvector.
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 276 of file KVector.hpp.

template<class T, std::size_t N>
template<typename Real >
Real slip::kvector< T, N >::dot ( const self other)
inline

Computes the dot product with another kvector other.

Parameters
other.Other Kvector.
Returns
The Real result of the dot product.

Definition at line 885 of file KVector.hpp.

template<class T, std::size_t N>
bool slip::kvector< T, N >::empty ( ) const
inline

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

Definition at line 779 of file KVector.hpp.

template<class T, std::size_t N>
iterator slip::kvector< T, N >::end ( )
inline

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

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

Definition at line 217 of file KVector.hpp.

template<class T, std::size_t N>
const_iterator slip::kvector< T, N >::end ( ) const
inline

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

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

Definition at line 227 of file KVector.hpp.

template<class T, std::size_t N>
iterator_range slip::kvector< T, N >::end ( const slip::Range< int > &  range)
inline

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

Parameters
range.Range to iterate.
Returns
end iterator_range value
Precondition
The range must be inside the whole range of the kvector.
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 303 of file KVector.hpp.

template<class T, std::size_t N>
const_iterator_range slip::kvector< T, N >::end ( const slip::Range< int > &  range) const
inline

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

Parameters
range.Range to iterate.
Returns
const_iterator_range value
Precondition
The range must be inside the whole range of the kvector.
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 326 of file KVector.hpp.

template<class T, std::size_t N>
norm_type slip::kvector< T, N >::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 kvector.

Precondition
size() != 0

Definition at line 832 of file KVector.hpp.

template<class T, std::size_t N>
void slip::kvector< T, N >::fill ( const T &  value)
inline

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

Parameters
valueA reference-to-const of arbitrary type.

Definition at line 521 of file KVector.hpp.

template<class T, std::size_t N>
void slip::kvector< T, N >::fill ( const T *  value)
inline

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

Parameters
valueA pointer of arbitrary type.

Definition at line 531 of file KVector.hpp.

template<class T, std::size_t N>
template<typename InputIterator >
void slip::kvector< T, N >::fill ( InputIterator  first,
InputIterator  last 
)
inline

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

Parameters
firstAn input iterator.
lastAn input iterator.

Definition at line 545 of file KVector.hpp.

template<class T, std::size_t N>
norm_type slip::kvector< T, N >::infinite_norm ( ) const
inline

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

Precondition
size() != 0

Definition at line 873 of file KVector.hpp.

template<class T, std::size_t N>
norm_type slip::kvector< T, N >::L1_norm ( ) const
inline

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

Precondition
size() != 0

Definition at line 853 of file KVector.hpp.

template<class T, std::size_t N>
norm_type slip::kvector< T, N >::L22_norm ( ) const
inline

Returns the L22 norm ( $\sum_i xi^2$) of the elements of the kvector.

Precondition
size() != 0

Definition at line 863 of file KVector.hpp.

template<class T, std::size_t N>
norm_type slip::kvector< T, N >::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 kvector.

Precondition
size() != 0

Definition at line 842 of file KVector.hpp.

template<class T, std::size_t N>
template<class Archive >
void slip::kvector< T, N >::load ( Archive &  ar,
const unsigned int  version 
)
inlineprotected

Definition at line 945 of file KVector.hpp.

template<class T, std::size_t N>
T& slip::kvector< T, N >::max ( )
inline

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

Precondition
size() != 0

Definition at line 812 of file KVector.hpp.

template<class T, std::size_t N>
size_type slip::kvector< T, N >::max_size ( ) const
inline

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

Definition at line 771 of file KVector.hpp.

template<class T, std::size_t N>
T& slip::kvector< T, N >::min ( )
inline

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

Precondition
size() != 0

Definition at line 800 of file KVector.hpp.

template<class T, std::size_t N>
std::string slip::kvector< T, N >::name ( ) const
inline

Returns the name of the class.

Definition at line 760 of file KVector.hpp.

template<class T, std::size_t N>
reference slip::kvector< T, N >::operator() ( const size_type  n)
inline

Subscript access to the data contained in the kvector.

Parameters
nThe index of the element for which data should be accessed.
Returns
Read/write reference to data.
Precondition
n < N

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.

Definition at line 659 of file KVector.hpp.

template<class T, std::size_t N>
const_reference slip::kvector< T, N >::operator() ( const size_type  n) const
inline

Subscript access to the data contained in the kvector.

Parameters
nThe index of the element for which data should be accessed.
Returns
Read-only (constant) reference to data.
Precondition
n < N

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.

Definition at line 673 of file KVector.hpp.

template<class T, std::size_t N>
self& slip::kvector< T, N >::operator*= ( const T &  val)
inline

Definition at line 699 of file KVector.hpp.

template<class T, std::size_t N>
self& slip::kvector< T, N >::operator*= ( const self rhs)
inline

Definition at line 739 of file KVector.hpp.

template<class T, std::size_t N>
self& slip::kvector< T, N >::operator+= ( const T &  val)
inline

Add val to each element of the kvector.

Parameters
valvalue
Returns
reference to the resulting kvector

Definition at line 687 of file KVector.hpp.

template<class T, std::size_t N>
self& slip::kvector< T, N >::operator+= ( const self rhs)
inline

Definition at line 725 of file KVector.hpp.

template<class T, std::size_t N>
self slip::kvector< T, N >::operator- ( ) const
inline

Definition at line 717 of file KVector.hpp.

template<class T, std::size_t N>
self& slip::kvector< T, N >::operator-= ( const T &  val)
inline

Definition at line 693 of file KVector.hpp.

template<class T, std::size_t N>
self& slip::kvector< T, N >::operator-= ( const self rhs)
inline

Definition at line 732 of file KVector.hpp.

template<class T, std::size_t N>
self& slip::kvector< T, N >::operator/= ( const T &  val)
inline

Definition at line 705 of file KVector.hpp.

template<class T, std::size_t N>
self& slip::kvector< T, N >::operator/= ( const self rhs)
inline

Definition at line 746 of file KVector.hpp.

template<class T, std::size_t N>
kvector<T,N>& slip::kvector< T, N >::operator= ( const kvector< T, N > &  rhs)
inline

Assigns all the element of the kvector by the kvector rhs.

Parameters
rhskvector<T,N>
Returns
reference to corresponding kvector

Definition at line 495 of file KVector.hpp.

template<class T, std::size_t N>
kvector<T,N>& slip::kvector< T, N >::operator= ( const T &  val)
inline

Assigns all the element of the kvector by val.

Parameters
valaffectation value
Returns
reference to corresponding kvector

Definition at line 509 of file KVector.hpp.

template<class T, std::size_t N>
reference slip::kvector< T, N >::operator[] ( const size_type  n)
inline

Subscript access to the data contained in the kvector.

Parameters
nThe index of the element for which data should be accessed.
Returns
Read/write reference to data.
Precondition
n < N

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.

Definition at line 633 of file KVector.hpp.

template<class T, std::size_t N>
const_reference slip::kvector< T, N >::operator[] ( const size_type  n) const
inline

Subscript access to the data contained in the kvector.

Parameters
nThe index of the element for which data should be accessed.
Returns
Read-only (constant) reference to data.
Precondition
n < N

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.

Definition at line 646 of file KVector.hpp.

template<class T, std::size_t N>
reverse_iterator slip::kvector< T, N >::rbegin ( )
inline

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

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

Definition at line 340 of file KVector.hpp.

template<class T, std::size_t N>
const_reverse_iterator slip::kvector< T, N >::rbegin ( ) const
inline

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

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

Definition at line 350 of file KVector.hpp.

template<class T, std::size_t N>
reverse_iterator_range slip::kvector< T, N >::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
range.Range to iterate.
Returns
reverse_iterator_range value
Precondition
The range must be inside the whole range of the kvector.
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 392 of file KVector.hpp.

template<class T, std::size_t N>
const_reverse_iterator_range slip::kvector< T, N >::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
range.Range to iterate.
Returns
cons_treverse__iterator_range value
Precondition
The range must be inside the whole range of the kvector.
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 415 of file KVector.hpp.

template<class T, std::size_t N>
reverse_iterator slip::kvector< T, N >::rend ( )
inline

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

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

Definition at line 360 of file KVector.hpp.

template<class T, std::size_t N>
const_reverse_iterator slip::kvector< T, N >::rend ( ) const
inline

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

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

Definition at line 371 of file KVector.hpp.

template<class T, std::size_t N>
reverse_iterator_range slip::kvector< T, N >::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
range.Range to iterate.
Returns
reverse_iterator_range value
Precondition
The range must be inside the whole range of the kvector.
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 438 of file KVector.hpp.

template<class T, std::size_t N>
const_reverse_iterator_range slip::kvector< T, N >::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
range.Range to iterate.
Returns
const_reverse_iterator_range value
Precondition
The range must be inside the whole range of the kvector.
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 461 of file KVector.hpp.

template<class T, std::size_t N>
template<class Archive >
void slip::kvector< T, N >::save ( Archive &  ar,
const unsigned int  version 
) const
inlineprotected

Definition at line 940 of file KVector.hpp.

template<class T, std::size_t N>
size_type slip::kvector< T, N >::size ( ) const
inline

Returns the number of elements in the kvector.

Definition at line 766 of file KVector.hpp.

template<class T, std::size_t N>
T slip::kvector< T, N >::sum ( ) const
inline

Returns the sum of the elements of the kvector.

Precondition
size() != 0

Definition at line 822 of file KVector.hpp.

template<class T, std::size_t N>
void slip::kvector< T, N >::swap ( kvector< T, N > &  x)
inline

Swaps data with another kvector.

Parameters
xA kvector of the same element type

Definition at line 785 of file KVector.hpp.

Friends And Related Function Documentation

template<typename T , std::size_t N>
kvector< typename slip::lin_alg_traits< T >::value_type, N > abs ( const kvector< T, N > &  V)
related

Returns the abs value of each element of the kvector.

Parameters
VThe kvector
Returns
the resulting kvector

Definition at line 1435 of file KVector.hpp.

template<std::size_t N>
kvector< float, N > acos ( const kvector< float, N > &  V)
related

Returns the acos value of each element of the kvector.

Parameters
VThe kvector
Returns
the resulting kvector

Definition at line 1464 of file KVector.hpp.

template<std::size_t N>
kvector< double, N > acos ( const kvector< double, N > &  V)
related

Returns the acos value of each element of the kvector.

Parameters
VThe kvector
Returns
the resulting kvector

Definition at line 1473 of file KVector.hpp.

template<std::size_t N>
kvector< long double, N > acos ( const kvector< long double, N > &  V)
related

Returns the acos value of each element of the kvector.

Parameters
VThe kvector
Returns
the resulting kvector

Definition at line 1482 of file KVector.hpp.

template<std::size_t N>
kvector< float, N > asin ( const kvector< float, N > &  V)
related

Returns the asin value of each element of the kvector.

Parameters
VThe kvector
Returns
the resulting kvector

Definition at line 1501 of file KVector.hpp.

template<std::size_t N>
kvector< double, N > asin ( const kvector< double, N > &  V)
related

Returns the asin value of each element of the kvector.

Parameters
VThe kvector
Returns
the resulting kvector

Definition at line 1510 of file KVector.hpp.

template<std::size_t N>
kvector< long double, N > asin ( const kvector< long double, N > &  V)
related

Returns the asin value of each element of the kvector.

Parameters
VThe kvector
Returns
the resulting kvector

Definition at line 1519 of file KVector.hpp.

template<std::size_t N>
kvector< float, N > atan ( const kvector< float, N > &  V)
related

Returns the atan value of each element of the kvector.

Parameters
VThe kvector
Returns
the resulting kvector

Definition at line 1539 of file KVector.hpp.

template<std::size_t N>
kvector< double, N > atan ( const kvector< double, N > &  V)
related

Returns the atan value of each element of the kvector.

Parameters
VThe kvector
Returns
the resulting kvector

Definition at line 1548 of file KVector.hpp.

template<std::size_t N>
kvector< long double, N > atan ( const kvector< long double, N > &  V)
related

Returns the atan value of each element of the kvector.

Parameters
VThe kvector
Returns
the resulting kvector

Definition at line 1557 of file KVector.hpp.

template<class T, std::size_t N>
friend class boost::serialization::access
friend

Definition at line 938 of file KVector.hpp.

template<typename T , std::size_t N>
kvector< T, N > cos ( const kvector< T, N > &  V)
related

Returns the cos value of each element of the kvector.

Parameters
VThe kvector
Returns
the resulting kvector

Definition at line 1454 of file KVector.hpp.

template<typename T , std::size_t N>
kvector< T, N > cosh ( const kvector< T, N > &  V)
related

Returns the cosh value of each element of the kvector.

Parameters
VThe kvector
Returns
the resulting kvector

Definition at line 1584 of file KVector.hpp.

template<typename T , std::size_t N>
kvector< T, N > exp ( const kvector< T, N > &  V)
related

Returns the exp value of each element of the kvector.

Parameters
VThe kvector
Returns
the resulting kvector

Definition at line 1566 of file KVector.hpp.

template<typename T , std::size_t N>
kvector< T, N > log ( const kvector< T, N > &  V)
related

Returns the log value of each element of the kvector.

Parameters
VThe kvector
Returns
the resulting kvector

Definition at line 1575 of file KVector.hpp.

template<typename T , std::size_t N>
kvector< T, N > log10 ( const kvector< T, N > &  V)
related

Returns the log10 value of each element of the kvector.

Parameters
VThe kvector
Returns
the resulting kvector

Definition at line 1611 of file KVector.hpp.

template<typename T , std::size_t N>
T & max ( kvector< T, N > &  M1)
related

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

Parameters
M1the kvector
Returns
the max element

Definition at line 1428 of file KVector.hpp.

template<typename T , std::size_t N>
T & min ( kvector< T, N > &  M1)
related

division of a scalar to each element of a kvector

Parameters
valThe scalar
VThe kvector
Returns
resulting kvector

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

Parameters
M1the kvector
Returns
the min element

Definition at line 1421 of file KVector.hpp.

template<class T, std::size_t N>
bool operator!= ( const kvector< T, N > &  x,
const kvector< T, N > &  y 
)
friend

Kvector inequality comparison.

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

Definition at line 1630 of file KVector.hpp.

template<class T, std::size_t N>
bool operator< ( const kvector< T, N > &  x,
const kvector< T, N > &  y 
)
friend

Less than comparison operator (kvector ordering relation)

Parameters
xA kvector
yA kvector of the same type of x
Returns
true iff x is lexicographically less than y
Precondition
x.size() == y.size()

Definition at line 1639 of file KVector.hpp.

template<class T, std::size_t N>
std::ostream& operator<< ( std::ostream &  out,
const kvector< T, N > &  b 
)
friend

Write the kvector to an ouput stream.

Parameters
outoutput std::ostream
bkvector to write to an output stream

Definition at line 1293 of file KVector.hpp.

template<class T, std::size_t N>
bool operator<= ( const kvector< T, N > &  x,
const kvector< T, N > &  y 
)
friend

Less than equal comparison operator.

Parameters
xA kvector
yA kvector of the same type of x
Returns
true iff !(y > x)
Precondition
x.size() == y.size()

Definition at line 1657 of file KVector.hpp.

template<class T, std::size_t N>
bool operator== ( const kvector< T, N > &  x,
const kvector< T, N > &  y 
)
friend

Kvector equality comparison.

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

Definition at line 1621 of file KVector.hpp.

template<class T, std::size_t N>
bool operator> ( const kvector< T, N > &  x,
const kvector< T, N > &  y 
)
friend

More than comparison operator.

Parameters
xA kvector
yA kvector of the same type of x
Returns
true iff y > x
Precondition
x.size() == y.size()

Definition at line 1648 of file KVector.hpp.

template<class T, std::size_t N>
bool operator>= ( const kvector< T, N > &  x,
const kvector< T, N > &  y 
)
friend

More than equal comparison operator.

Parameters
xA kvector
yA kvector of the same type of x
Returns
true iff !(x < y)
Precondition
x.size() == y.size()

Definition at line 1666 of file KVector.hpp.

template<typename T , std::size_t N>
kvector< T, N > sin ( const kvector< T, N > &  V)
related

Returns the sin value of each element of the kvector.

Parameters
VThe kvector
Returns
the resulting kvector

Definition at line 1491 of file KVector.hpp.

template<typename T , std::size_t N>
kvector< T, N > sinh ( const kvector< T, N > &  V)
related

Returns the sinh value of each element of the kvector.

Parameters
VThe kvector
Returns
the resulting kvector

Definition at line 1593 of file KVector.hpp.

template<typename T , std::size_t N>
kvector< T, N > sqrt ( const kvector< T, N > &  V)
related

Returns the sqrt value of each element of the kvector.

Parameters
VThe kvector
Returns
the resulting kvector

Definition at line 1445 of file KVector.hpp.

template<typename T , std::size_t N>
kvector< T, N > tan ( const kvector< T, N > &  V)
related

Returns the tan value of each element of the kvector.

Parameters
VThe kvector
Returns
the resulting kvector

Definition at line 1528 of file KVector.hpp.

template<typename T , std::size_t N>
kvector< T, N > tanh ( const kvector< T, N > &  V)
related

Returns the tanh value of each element of the kvector.

Parameters
VThe kvector
Returns
the resulting kvector

Definition at line 1602 of file KVector.hpp.

Member Data Documentation

template<class T, std::size_t N>
T slip::kvector< T, N >::data[N]

Data array storage of the kvector.

Definition at line 935 of file KVector.hpp.

template<class T, std::size_t N>
const std::size_t slip::kvector< T, N >::DIM = 1
static

Definition at line 181 of file KVector.hpp.

template<class T, std::size_t N>
const std::size_t slip::kvector< T, N >::SIZE = N
static

Definition at line 180 of file KVector.hpp.


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