Class xlifepp::VectorEigenDense#

template<typename K>
class VectorEigenDense : public xlifepp::Vector<K>#

Inheritence diagram for xlifepp::VectorEigenDense:

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

Collaboration diagram for xlifepp::VectorEigenDense:

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

Class (row) dense vector to deal with direct eigen problem solver.

This class provides some basic methods to support calculation of eigen problem dense matrix.

TODO Improve performance by reusing vector data

Template Parameters:

Type – of scalar (real_t, complex_t)

Public Types

typedef VectorEigenDense::type_t Scalar#

useful typedefs to VectorEigenDense class

Public Functions

inline VectorEigenDense()#

default constructor

inline VectorEigenDense(const dimen_t l)#

constructor from length

inline VectorEigenDense(const dimen_t l, const K v, AccessType ac = _col)#

Full constructor.

Parameters:
  • l[in] Size of vector (number of row or number of column)

  • v[in] initial value

  • ac[in] type of vector (column or row)

inline VectorEigenDense(const VectorEigenDense<K> &v)#

Copy constructor.

inline AccessType accessType() const#

return access type

inline K coeff(const number_t idx) const#

Coefficient of vector.

inline K &coeffRef(const number_t idx)#

Reference of coefficient of vector.

inline K dotProduct(VectorEigenDense<K> &v) const#

Calculate inner product (hermitian product) of two vectors: inner product = vectorX * vectorY.

Parameters:

v[in] the second vector (Y)

Returns:

inner product

inline VectorEigenDense<K> head(number_t headSize)#

Extract head a vector, return result into a new vector.

Parameters:

headSize[in] size of the extracted vector

Returns:

extracted heading vector

inline void head(number_t headSize, VectorEigenDense<K> &v)#

Replace tail of a vector with a vector.

Parameters:
  • headSize[in] size of the new vector

  • v[in] Input vector

inline void indexOutOfRange(const string_t &s, const size_t index, const size_t range) const#

error message when index out of range

inline void makeHouseHolder(VectorEigenDense<K> &essential, K &tau, real_t &beta) const#

Computes the elementary reflector H such that: \( H *this = [ beta 0 ... 0]^T \) where the transformation H is: \( H = I - tau v v^*\) and the vector v is: \( v^T = [1 essential^T] \).

On output:

Parameters:
  • essential – the essential part of the vector v

  • tau – the scaling factor of the Householder transformation

  • beta – the result of H * *this

inline void makeHouseHolderInPlace(K &tau, real_t &beta)#

Computes the elementary reflector H such that: \( H *this = [ beta 0 ... 0]^T \) where the transformation H is: \( H = I - tau v v^*\) and the vector v is: \( v^T = [1 essential^T] \).

The essential part of the vector v is stored in *this.

On output:

TODO This implementation is not so good. In deed, we can use directly one part of vector as the essential.

Parameters:
  • tau – the scaling factor of the Householder transformation

  • beta – the result of H * *this

inline void makeHouseHolderInPlace(K &tau, real_t &beta, number_t tail)#

Computes the elementary reflector H only for the tail part of vector: \( H *tail = [ beta 0 ... 0]^T \) where the transformation H is: \( H = I - tau v v^*\) and the vector v is: \( v^T = [1 essential^T] \).

The essential part of the vector v is stored in *this.

On output:

TODO This implementation is not so good. In deed, we can use directly one part of vector as the essential.

Parameters:
  • tau – the scaling factor of the Householder transformation

  • beta – the result of H * *this On Input:

  • tail – size of the tail of vector on which the house holder transformation is taken place

inline number_t minElement(number_t firstPos, number_t lastPos)#

Minimum element within a range.

inline void normalize()#

Normalize vector.

inline RealScalar normFrobenius() const#

compute Frobenius norm of a vector

inline void overSize(const string_t &s, const size_t r, const size_t c) const#

error message when incompatible sizes

inline VectorEigenDense<real_t> real()#

Real part of vector.

inline VectorEigenDense<K> segment(const int_t index, const int_t segmentLength)#

Extract segment of a vector.

Parameters:
  • index[in] beginning position of segment in vector

  • segmentLength[in] segment length

Returns:

segment vector

inline void segment(VectorEigenDense<K> &seg, const int_t index, const int_t segmentLength)#

Fill segment of a vector with a vector.

Parameters:
  • index[in] beginning position of segment in vector

  • segmentLength[in] segment length

  • seg[inout] vector to be modified

Returns:

segment vector

inline void set(const K v)#

Set a vector with a value.

inline void setZero()#

set a vector to zero

inline real_t sumAbs()#

Calculate sum of absolute value of all elements.

inline VectorEigenDense<K> tail(number_t tailSize)#

Tail a vector, return result into a new vector.

Parameters:

tailSize[in] size of the new vector

Returns:

extracted tailing vector

inline void tail(number_t tailSize, VectorEigenDense<K> &v)#

Replace tail of a vector with a vector.

Parameters:
  • tailSize[in] size of the new vector

  • v[in] Input vector