Class xlifepp::Vector#

template<typename K>
class Vector : public std::vector<K>#

Inheritence diagram for xlifepp::Vector:

digraph { graph [bgcolor="#00000000"] node [shape=rectangle style=filled fillcolor="#FFFFFF" font=Helvetica padding=2] edge [color="#1414CE"] "8" [label="xlifepp::Vector< ComplexScalar >" tooltip="xlifepp::Vector< ComplexScalar >"] "14" [label="xlifepp::Vector< RealScalar >" tooltip="xlifepp::Vector< RealScalar >"] "9" [label="xlifepp::Vector< Scalar >" tooltip="xlifepp::Vector< Scalar >"] "12" [label="xlifepp::Vector< T >" tooltip="xlifepp::Vector< T >"] "11" [label="xlifepp::Vector< complex_t >" tooltip="xlifepp::Vector< complex_t >"] "10" [label="xlifepp::Vector< real_t >" tooltip="xlifepp::Vector< real_t >"] "15" [label="xlifepp::Vector< xlifepp::Vector< complex_t > >" tooltip="xlifepp::Vector< xlifepp::Vector< complex_t > >"] "13" [label="xlifepp::Vector< xlifepp::Vector< real_t > >" tooltip="xlifepp::Vector< xlifepp::Vector< real_t > >"] "5" [label="xlifepp::VectorEigenDense< ComplexScalar >" tooltip="xlifepp::VectorEigenDense< ComplexScalar >"] "7" [label="xlifepp::VectorEigenDense< RealScalar >" tooltip="xlifepp::VectorEigenDense< RealScalar >"] "6" [label="xlifepp::VectorEigenDense< Scalar >" tooltip="xlifepp::VectorEigenDense< Scalar >"] "3" [label="std::vector< T >" tooltip="std::vector< T >"] "2" [label="std::vector< K >" tooltip="std::vector< K >"] "1" [label="xlifepp::Vector< K >" tooltip="xlifepp::Vector< K >" fillcolor="#BFBFBF"] "4" [label="xlifepp::VectorEigenDense< K >" tooltip="xlifepp::VectorEigenDense< K >"] "8" -> "1" [dir=forward tooltip="template-instance"] "14" -> "1" [dir=forward tooltip="template-instance"] "9" -> "1" [dir=forward tooltip="template-instance"] "12" -> "1" [dir=forward tooltip="template-instance"] "11" -> "1" [dir=forward tooltip="template-instance"] "10" -> "1" [dir=forward tooltip="template-instance"] "15" -> "1" [dir=forward tooltip="template-instance"] "13" -> "1" [dir=forward tooltip="template-instance"] "5" -> "4" [dir=forward tooltip="template-instance"] "5" -> "8" [dir=forward tooltip="public-inheritance"] "7" -> "4" [dir=forward tooltip="template-instance"] "7" -> "14" [dir=forward tooltip="public-inheritance"] "6" -> "4" [dir=forward tooltip="template-instance"] "6" -> "9" [dir=forward tooltip="public-inheritance"] "2" -> "3" [dir=forward tooltip="template-instance"] "1" -> "2" [dir=forward tooltip="public-inheritance"] "4" -> "1" [dir=forward tooltip="public-inheritance"] }

Collaboration diagram for xlifepp::Vector:

digraph { graph [bgcolor="#00000000"] node [shape=rectangle style=filled fillcolor="#FFFFFF" font=Helvetica padding=2] edge [color="#1414CE"] "3" [label="std::vector< T >" tooltip="std::vector< T >"] "2" [label="std::vector< K >" tooltip="std::vector< K >"] "1" [label="xlifepp::Vector< K >" tooltip="xlifepp::Vector< K >" fillcolor="#BFBFBF"] "2" -> "3" [dir=forward tooltip="template-instance"] "1" -> "2" [dir=forward tooltip="public-inheritance"] }

to deal with numeric vector (say real or complex vector).

may be used for vector of vectors but restricted usage

Subclassed by xlifepp::VectorEigenDense< K >

Public Types

typedef K type_t#

useful typedefs for Vector class

Public Functions

inline Vector()#

default constructor

inline Vector(cit_vk b, cit_vk e)#

constructor by iterator

inline Vector(const K &r1)#

specific constructor from n items

inline Vector(const std::initializer_list<K> &v)#

constructor by an initializer list

Vector(const std::vector<complex_t>&)#

specialization vector<real>(vector<complex>)

Vector(const std::vector<complex_t> &x)

abusive specialization of complex to real (real part is cast)

inline Vector(const std::vector<K> &v)#

constructor by a std::vector

template<typename KK>
inline explicit Vector(const std::vector<KK> &v)#
Parameters:

v – vector<K>(vector<KK>)

Vector(const std::vector<real_t>&)#

specialization vector<complex>(vector<real>)

Vector(const std::vector<real_t> &x)

specialization vector<real> -> vector<complex>

Vector(const std::vector<Vector<complex_t>>&)#

specialization vector<vector<real>>=vector<vector<complex>>

Vector(const std::vector<Vector<complex_t>> &x)

abusive specialization of complex to real (real part is cast)

template<typename KK>
inline explicit Vector(const std::vector<Vector<KK>> &v)#
Parameters:

v – vector<K>(std::vector<vector<KK>>)

Vector(const std::vector<Vector<real_t>>&)#

specialization vector<vector<complex>>=vector<vector<real>>

Vector(const std::vector<Vector<real_t>> &x)

specialization vector<vector<real_t>> -> vector<vector<complex_t>>

inline explicit Vector(int l)#

constructor by length

inline explicit Vector(int l, const K &v)#

constructor by length for constant vector

inline explicit Vector(number_t l)#

constructor by length

inline explicit Vector(number_t l, const K &v)#

constructor by length for constant vector

inline it_vk begin()#

overloaded iterator begin()

inline cit_vk begin() const#

overloaded const iterator begin()

inline void complexCastError(const string_t &s, const number_t sz) const#

error: try to cast a complex to a real

inline void deleteRows(number_t r1i, number_t r2i)#

delete rows r1,…, r2

inline std::pair<number_t, number_t> dims() const#

dimension pair

inline void divideByZero(const string_t &s) const#

error: divide by 0 in vector operation s vector dimension dim(op1)

number_t elementSize() const#

specialisation of elementSize

inline number_t elementSize() const

return size of element of a matrix of matrices or a matrix of vectors (size of first block!)

inline it_vk end()#

overloaded iterator end()

inline cit_vk end() const#

overloaded const iterator end()

inline Vector<K> get(const std::vector<number_t> &is) const#

return ‘is’ components as vector

inline Vector<K> get(number_t i1, number_t i2) const#

return i1->i2 components as vector

inline void mismatchSize(const string_t &s, const size_t sz) const#

error: in vector operation s dimensions disagree dim(op1)= … dim(op2)=…

inline number_t nbzero(real_t tol = 0) const#

return number of 0 components (|xi|<=tol)

inline real_t norm1() const#

l1 norm

inline real_t norm2() const#

quadratic norm

inline real_t norm2squared() const#

squared quadratic norm

inline Vector<K> &normalize(number_t no = 2)#

normalize current vector in l1=1, l2=2 or linf=0

inline real_t norminfty() const#

sup norm

inline Vector<K> operator()(const std::vector<number_t> &is) const#

return ‘is’ components as vector

inline K &operator()(number_t i)#

i-th component (i=1..n) (r/w)

inline K operator()(number_t i) const#

i-th component (i=1..n) (r)

inline Vector<K> operator()(number_t i1, number_t i2) const#

return i1->i2 components as vector

Vector<real_t> &operator*=(const complex_t &vc)#

forbidden specialization of complex to real

Vector<real_t> &operator*=(const complex_t &vc)

specialization vector<real>*=complex

template<typename KK>
inline Vector<K> &operator*=(const KK &x)#

multiply current vector by a scalar

template<typename KK>
inline Vector<K> &operator*=(const Vector<KK> &x)#

vector<K>*=vector<KK>

inline Vector<K> &operator+=(const K &x)#

add a scalar to current vector

inline Vector<K> &operator+=(const Vector<K> &b)#

add a vector to current vector

template<typename KK>
inline Vector<K> &operator+=(const Vector<KK> &x)#

vector<K>=vector<KK>

Vector<complex_t> &operator+=(const Vector<real_t>&)#

specialization vector<complex>+=vector<real>

Vector<complex_t> &operator+=(const Vector<real_t> &x)

operations are not specialized for complex to real, cast with constructor before: x+Vector(z) or do real(z+x)

vector addition

Vector<Vector<complex_t>> &operator+=(const Vector<Vector<real_t>>&)#

specialization vector<vector<complex>>+=vector<vector<real>>

Vector<Vector<complex_t>> &operator+=(const Vector<Vector<real_t>> &x)

vector addition

inline Vector<K> &operator-=(const K &x)#

substract a scalar to current vector

inline Vector<K> &operator-=(const Vector<K> &b)#

substract a vector to current vector

template<typename KK>
inline Vector<K> &operator-=(const Vector<KK> &x)#

vector<K>-=vector<KK>

Vector<complex_t> &operator-=(const Vector<real_t>&)#

specialization vector<complex>-=vector<real>

Vector<complex_t> &operator-=(const Vector<real_t> &x)

vector substraction

Vector<Vector<complex_t>> &operator-=(const Vector<Vector<real_t>>&)#

specialization vector<vector<complex>>-=vector<vector<real>>

Vector<Vector<complex_t>> &operator-=(const Vector<Vector<real_t>> &x)

vector substraction

Vector<real_t> &operator/=(const complex_t &vc)#

specialization vector<real>/=complex

template<typename KK>
inline Vector<K> &operator/=(const KK &x)#

divide current vector by a scalar

template<typename KK>
inline Vector<K> &operator/=(const Vector<KK> &x)#

vector<K>*=vector<KK>

inline Vector<K> &operator=(const K &x)#

assign const scalar value to all vector entries

inline Vector<K> &operator=(const std::initializer_list<K> &x)#

assign brace enclosed list

inline Vector<K> &operator=(const std::vector<K> &x)#

assign std::vector<K>

Vector<real_t> &operator=(const Vector<complex_t>&)#

specialization vector<real>=vector<complex>

Vector<real_t> &operator=(const Vector<complex_t> &x)

abusive specialization of complex to real (real part is cast)

template<typename KK>
inline Vector<K> &operator=(const Vector<KK> &x)#

vector<K>=vector<KK>

Vector<complex_t> &operator=(const Vector<real_t>&)#

specialization vector<complex>=vector<real>

Vector<complex_t> &operator=(const Vector<real_t>&)

specialization vector<complex>=vector<real>

Vector<complex_t> &operator=(const Vector<real_t> &x)

specialization vector<complex>=vector<real>

Vector<Vector<real_t>> &operator=(const Vector<Vector<complex_t>>&)#

specialization vector<vector<real>>=vector<vector<complex>>

Vector<Vector<real_t>> &operator=(const Vector<Vector<complex_t>> &x)

abusive specialization of complex to real (real part is cast)

Vector<Vector<complex_t>> &operator=(const Vector<Vector<real_t>>&)#

specialization vector<vector<complex>>=vector<vector<real>>

Vector<Vector<complex_t>> &operator=(const Vector<Vector<real_t>> &x)

specialization vector<vector<complex>>=vector<vector<real>>

inline void print() const#

write to default file stream

inline void print(std::ostream &os) const#

write to a output stream

inline void printRaw(std::ostream &os) const#

print in a raw format to stream

inline void printRaw(std::ostream &os) const

print in a raw format (1 column)

inline void printRaw(std::ostream &os) const

print in a raw format (2 columns)

inline void printRaw(std::ostream &os) const

print in a raw format (N columns)

inline void printRaw(std::ostream &os) const

print in a raw format (2N columns)

inline Vector<K> &round(real_t prec = 0.)#

round with given precision

inline Vector<K> &roundToZero(real_t aszero = std::sqrt(theEpsilon))#

round to 0 all coefficients smaller (in norm) than a aszero, storage is not modified

inline void set(const std::vector<number_t> &is, const std::vector<K> &vec)#

set ‘is’ components of current vector

inline void set(number_t i1, number_t i2, const std::vector<K> &vec)#

set i1->i2 components of current vector

inline size_t size() const#

overloaded size

StrucType strucType() const#

specialisation of strucType

inline StrucType strucType() const

get structure type of matrix using template specialization

inline Vector<K> &toConj()#

to its conjugate (assuming conj(real)->real)

ValueType valueType() const#

specialisation of valueType

inline ValueType valueType() const

get value type of matrix using template specialization