Class xlifepp::VectorEntry#

class VectorEntry#

Collaboration diagram for xlifepp::VectorEntry:

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

small class handling current types of Vector shadowing template parameter of Vector

Public Functions

VectorEntry()#

default constructor

default constructor: real vector of size 0

VectorEntry(const complex_t&, number_t n)#

constructor from constant complex_t value and vector size

VectorEntry(const Function&, number_t n)#

constructor from a function

VectorEntry(const Vector<complex_t>&)#

constructor from a complex vector

constructor from a vector of complexes

VectorEntry(const Vector<complex_t>&, number_t n)#

constructor from constant Vector<complex_t> value and vector size

VectorEntry(const Vector<real_t>&)#

constructor from a real vector

constructor from a vector of reals

VectorEntry(const Vector<real_t>&, number_t n)#

constructor from constant Vector<real_t> value and vector size

VectorEntry(const Vector<Vector<complex_t>>&)#

constructor from a vector of complex vectors

VectorEntry(const Vector<Vector<real_t>>&)#

constructor from a vector of real vectors

VectorEntry(const VectorEntry&)#

copy constructor

VectorEntry(real_t, number_t n)#

constructor from constant real_t value and vector size

VectorEntry(ValueType, number_t nv, number_t n = 0)#

constructor from explicit vector type and vector size

constructor from explicit vector type and vector size n

VectorEntry(ValueType, StrucType, number_t n = 0, number_t nv = 1)#

constructor from explicit vector type and vector size

~VectorEntry()#

destructor

void add(const VectorEntry&, complex_t)#

add to current entry an entry multiplied by a complex scalar

void add(const VectorEntry&, const std::vector<number_t>&, complex_t)#

add to current entry at given positions an entry multiplied by a complex scalar

void add(const VectorEntry&, const std::vector<number_t>&, real_t)#

add to current entry at given positions an entry multiplied by a real scalar

add to current entry, at the positions given by pos, the entry ve multiplied by the constant a pos is the vector giving the position of the n-th (>=1) coefficients of ve in the current entry

void add(const VectorEntry&, real_t)#

add to current entry an entry multiplied by a real scalar

add to current entry the entry v multiplied by the constant a it is assumed that structure types and value types are consistent

Vector<complex_t> &asVector(Vector<complex_t>&) const#

return as Vector<complex_t>

Vector<real_t> &asVector(Vector<real_t>&) const#

return as Vector<real_t>

Vector<Vector<complex_t>> &asVector(Vector<Vector<complex_t>>&) const#

return as Vector<Vector<complex_t> >

Vector<Vector<real_t>> &asVector(Vector<Vector<real_t>>&) const#

return as Vector<Vector<real_t> >

inline Vector<complex_t>::iterator beginc()#

iterator to the first complex value

inline Vector<complex_t>::const_iterator beginc() const#

const iterator to the first complex value

inline Vector<Vector<complex_t>>::iterator begincv()#

iterator to the first complex vector value

inline Vector<Vector<complex_t>>::const_iterator begincv() const#

const iterator to the first complex vector value

inline Vector<real_t>::iterator beginr()#

iterator to the first real value

inline Vector<real_t>::const_iterator beginr() const#

const iterator to the first real value

inline Vector<Vector<real_t>>::iterator beginrv()#

iterator to the first real vector value

inline Vector<Vector<real_t>>::const_iterator beginrv() const#

const iterator to the first real vector value

void clear()#

deallocate memory used by a VectorEntry

void deleteRows(number_t, number_t)#

delete rows r1,…, r2

string_t encodeFileName(const string_t &fn) const#

encode file name with some additional informations

template<typename T>
inline Vector<T> *entriesp() const#

returns entries of type T

template<>
Vector<real_t> *entriesp() const#

specialization (no check of null pointer, do it before!)

void extendEntries(std::vector<number_t>, number_t)#

extend current entries along a new numbering

void extractComponent(const VectorEntry&, dimen_t)#

extract component i from vector entry of type vector<vector<K> >

void getEntry(number_t, complex_t&) const#

get (i) complex value (indices start from 1)

void getEntry(number_t, real_t&) const#

get (i) real value (indices start from 1)

void getEntry(number_t, Vector<complex_t>&) const#

get (i) complex matrix value (indices start from 1)

void getEntry(number_t, Vector<real_t>&) const#

get (i) real matrix value (indices start from 1)

Value getValue(number_t) const#

get (i) as value (indices start from 1)

get (i) and set (i) as value (indices start from 1)

bool isEmpty() const#

true if no one of pointers allocated

complex_t maxValAbs() const#

return the value (in complex) of component being the largest one in absolute value

void moveColumns(const std::vector<number_t>&)#

move columns according to a map

move columns according to a map m between current entries and a vector entries of dim n=size(m) the map m= (m1, …, mk, …) gives the displacement of columns in set {1,2,…n} : the column mk moves at position k mk=0 means that the column k is 0 example: m=[0 2 1] : [col1, col2, …] –> [0 col2 col1] Numbering starts at 1

number_t nbzero(real_t tol = 0) const#

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

real_t norm2() const#

intern norm2

VectorEntry &operator*=(const complex_t&)#

operation U*=c

VectorEntry &operator*=(const real_t&)#

operation U*=r

VectorEntry &operator+=(const VectorEntry&)#

operation U+=V (same size, but value types may be different)

VectorEntry &operator-=(const VectorEntry&)#

operation U+=V (same size, but value types may be different)

VectorEntry &operator/=(const complex_t&)#

operation U/=c

VectorEntry &operator/=(const real_t&)#

operation U/=r

VectorEntry &operator=(const VectorEntry&)#

assign operator (full copy)

void print(std::ostream&) const#

print entries on ostream

void printFirst(std::ostream&, number_t, std::vector<string_t> comment = std::vector<string_t>()) const#

print first n entries

void printLast(std::ostream&, number_t, std::vector<string_t> comment = std::vector<string_t>()) const#

print last n entries

complex_t product(number_t, const complex_t&) const#

return v(n)*a (complex)

real_t product(number_t, const real_t&) const#

return v(n)*a (real)

void resize(number_t)#

resize entry

VectorEntry &round(real_t prec = 0.)#

round with a given precision (0 no round)

VectorEntry &roundToZero(real_t aszero = std::sqrt(theEpsilon))#

round to zero all coefficients close to 0 (|.

| < aszero)

inline void saveToFile(const string_t &fn, bool encode) const#

save VectorEntry to file

void saveToFile(const string_t &fn, number_t prec = fullPrec, bool encode = false) const#

save VectorEntry to file

void setEntry(number_t, const complex_t&)#

set (i) complex value (indices start from 1)

void setEntry(number_t, const real_t&)#

set (i) real value (indices start from 1)

void setEntry(number_t, const Vector<complex_t>&)#

set (i) complex matrix value (indices start from 1)

void setEntry(number_t, const Vector<real_t>&)#

set (i) real matrix value (indices start from 1)

void setValue(number_t, const Value&)#

set (i) value (indices start from 1)

number_t size() const#

return number of values counted in value type

inline StrucType &strucType()#

return strucType (non const)

inline StrucType strucType() const#

return strucType (const)

VectorEntry &toAbs()#

v -> abs(v) (modify current entries to real entries)

transform current data to abs, real and imaginary part in any case, these functions transform entries v to real entries

VectorEntry &toComplex()#

modify current entries to complex entries if they are not

VectorEntry &toConj()#

v -> conjugate of v (modify current entries), if real nothing is done

VectorEntry &toImag()#

v -> imaginary part of v (modify current entries to real entries)

VectorEntry &toReal()#

v -> real part of v (modify current entries to real entries)

VectorEntry *toScalar()#

create new scalar vector entry from non scalar vector entry

VectorEntry &toVector(dimen_t n, dimen_t i)#

if scalar entries, modify current scalar entries to vector entries (1<=i<=n)

inline ValueType &valueType()#

return valueType (non const)

inline ValueType valueType() const#

return valueType (const)

Public Members

Vector<complex_t> *cEntries_p#

pointer to complex vector

Vector<Vector<complex_t>> *cvEntries_p#

pointer to vector of complex vectors

dimen_t nbOfComponents#

number of components of value (1 in scalar case, 2,3,.

. in vector case)

Vector<real_t> *rEntries_p#

pointer to real vector

Vector<Vector<real_t>> *rvEntries_p#

pointer to vector of real vectors

StrucType strucType_#

structure type of the entries (_scalar,_vector)

ValueType valueType_#

value type of the entries (_real,_complex)

Friends

friend std::ostream &operator<<(std::ostream&, const VectorEntry&)#

output VectorEntry on stream