HLIBpro  2.8.1
TVirtualVector Class Reference

A virtual vector gets his data from some real vector and behaves just like it, except memory-management.

#include <TVirtualVector.hh>

Inheritance diagram for TVirtualVector:
TScalarVector TVector TTypeInfo

Public Member Functions

 TVirtualVector ()
 construct virtual vector without data
 
 TVirtualVector (const TVirtualVector &v)
 copy constructor
 
 TVirtualVector (const BLAS::Vector< real > &vec, const TIndexSet &ais)
 reference data in vec with additional offset (real valued)
 
 TVirtualVector (const BLAS::Vector< complex > &vec, const TIndexSet &ais)
 reference data in vec with additional offset (complex valued)
 
 TVirtualVector (const TScalarVector *x, const TIndexSet &ais)
 reference part of vector vector x defined by index set ais
 
 ~TVirtualVector ()
 destructor
 
virtual void set_vector (const BLAS::Vector< real > &vec)
 reference vector vec (real valued)
 
virtual void set_vector (const BLAS::Vector< complex > &vec)
 reference vector vec (complex valued)
 
virtual void set_vector (const BLAS::Vector< real > &vec, const TIndexSet &ais)
 reference part of vector vec defined by index set ais (real valued)
 
virtual void set_vector (const BLAS::Vector< complex > &vec, const TIndexSet &ais)
 reference part of vector vec defined by index set ais (complex valued)
 
virtual void set_vector (const TScalarVector *vec, const TIndexSet &ais)
 reference part of vector vec defined by index set ais
 
virtual void set_size (const size_t n)
 set size of the vector (must not differ from current size in order to not reallocate memory)
 
virtual void set_complex (const bool b)
 switch to complex representation
 
virtual TVirtualVectoroperator= (const TVirtualVector &vec)
 copy operator (copy pointers !!!)
 
virtual void assign (const real alpha, const TVector *x)
 compute this = α·x
 
virtual void cassign (const complex &alpha, const TVector *x)
 compute this = α·x
 
virtual auto copy () const -> std::unique_ptr< TVector >
 return copy of vector (real copy, not a virtual one)
 
virtual auto create () const -> std::unique_ptr< TVector >
 return object of same class
 
virtual void set_vector (const BLAS::Vector< real > &vec, const idx_t offset)
 set internal data directly (real valued)
 
virtual void set_vector (const BLAS::Vector< complex > &vec, const idx_t offset)
 set internal data directly (complex valued)
 
- Public Member Functions inherited from TScalarVector
 TScalarVector (const value_type_t avalue_type=real_valued)
 construct zero sized vector
 
 TScalarVector (const size_t n, const idx_t offset=0, const value_type_t avalue_type=real_valued)
 construct vector of size n with offset offset
 
 TScalarVector (const TIndexSet &ais, const value_type_t avalue_type=real_valued)
 construct vector with size defined by indexset ais
 
 TScalarVector (const TIndexSet &ais, const BLAS::Vector< real > &bvec)
 
 TScalarVector (const TIndexSet &ais, const BLAS::Vector< complex > &bvec)
 
 TScalarVector (const TScalarVector &v)
 standard copy constructor
 
 TScalarVector (TScalarVector &&v)
 standard move constructor
 
 TScalarVector (const TIndexSet &ais, BLAS::Vector< real > &&bvec)
 
 TScalarVector (const TIndexSet &ais, BLAS::Vector< complex > &&bvec)
 
virtual ~TScalarVector ()
 destructor
 
virtual size_t size () const
 return size of vector
 
virtual real entry (const idx_t i) const
 access coefficent i (real valued)
 
virtual const complex centry (const idx_t i) const
 access coefficent i (complex valued)
 
virtual void set_entry (const idx_t i, const real f)
 set coefficient i to f (real valued)
 
virtual void set_centry (const idx_t i, const complex f)
 set coefficient i to f (complex valued)
 
virtual void add_entry (const idx_t i, const real f)
 add f to i'th entry
 
virtual void add_centry (const idx_t i, const complex f)
 add f to i'th entry (complex valued)
 
BLAS::Vector< real > & blas_rvec ()
 return real valued data
 
const BLAS::Vector< real > & blas_rvec () const
 return constant real valued data
 
BLAS::Vector< complex > & blas_cvec ()
 return complex valued data
 
const BLAS::Vector< complex > & blas_cvec () const
 return constant complex valued data
 
virtual void set_cluster (const TCluster *c)
 define vector by cluster
 
virtual void set_is (const TIndexSet &ais)
 define vector by indexset
 
virtual void set_vector (const BLAS::Vector< real > &vec, const idx_t offset)
 set internal data directly (real valued)
 
virtual void set_vector (const BLAS::Vector< complex > &vec, const idx_t offset)
 set internal data directly (complex valued)
 
virtual void copy_from (const TScalarVector *v)
 copy from vector v
 
virtual void copy_to (TScalarVector *v) const
 copy to vector v
 
virtual void copy_from (const real *v)
 copy from C array v
 
virtual void copy_to (real *v)
 copy to C array v
 
TScalarVectoroperator= (const TScalarVector &v)
 standard copy operator
 
void permute (const TPermutation &perm)
 permute entries according to perm
 
virtual void fill (const real alpha)
 fill vector with constant α
 
virtual void fill_rand (const uint seed)
 fill vector with random numbers
 
virtual void scale (const real alpha)
 set this ≔ α · this
 
virtual real norm2 () const
 compute ‖·‖₂
 
virtual real norm_inf () const
 compute ‖·‖∞
 
virtual void axpy (const real alpha, const TVector *x)
 set this ≔ this + α · x
 
virtual void add_sub_mt (const TScalarVector &x)
 set this ≔ this + x (thread safe, is(x) ⊆ is(this))
 
virtual void conjugate ()
 conjugate coefficients
 
virtual void cfill (const complex &alpha)
 fill vector with constant α
 
virtual void cscale (const complex &alpha)
 set this ≔ α · this
 
virtual complex dot (const TVector *x) const
 return inner product <this, x> = this^H · x
 
virtual complex dotu (const TVector *x) const
 return inner product <this, x> = this^T · x
 
virtual void caxpy (const complex &f, const TVector *x)
 set this ≔ this + α · x
 
virtual size_t byte_size () const
 return size in bytes used by this object
 
virtual auto restrict_re () const -> std::unique_ptr< TVector >
 return vector restricted to real part of coefficients
 
virtual auto restrict_im () const -> std::unique_ptr< TVector >
 return vector restricted to imaginary part of coefficients
 
virtual auto restrict_abs () const -> std::unique_ptr< TVector >
 return vector restricted to absolute value of coefficients
 
virtual void print (const uint ofs=0) const
 print vector information
 
virtual void read (TByteStream &s)
 read vector from stream
 
virtual void write (TByteStream &s) const
 write vector to stream
 
virtual size_t bs_size () const
 returns size of object in bytestream
 
virtual void sum (const TProcSet &ps)
 pointwise summation between all vectors in ps
 
virtual void copy_to (TVector *x) const
 assign local values to vector x
 
virtual void sum (const TProcSet &p, const uint pid, const uint nparts, TByteStream *bs=NULL)
 
virtual void sum (const TProcSet &p)
 same as More...
 
- Public Member Functions inherited from TVector
 TVector (const idx_t offset=0, const value_type_t avalue_type=real_valued)
 construct real or complex valued vector with first index offset
 
 TVector (const TVector &v)
 copy constructor
 
virtual ~TVector ()
 dtor
 
idx_t ofs () const
 return first index (offset)
 
virtual void set_ofs (const idx_t n)
 set first index (offset)
 
TIndexSet is () const
 return index set
 
value_type_t value_type () const
 return value type of vector
 
bool is_complex () const
 return true if vector is complex valued
 
void set_complex (const bool b)
 change between real and complex valued representation
 
TVectoroperator= (const TVector &v)
 copy operator for all vectors
 
virtual size_t global_byte_size () const
 
virtual void copy_to (TVector *x) const
 assign local values to vector x
 
virtual void sum (const TProcSet &p, const uint pid, const uint nparts, TByteStream *bs=NULL)
 
- Public Member Functions inherited from TTypeInfo
virtual typeid_t type () const =0
 return type ID of object
 
virtual bool is_type (const typeid_t t) const
 return true if local object is of given type ID t
 
virtual std::string typestr () const
 return string representation of type
 

Additional Inherited Members

- Protected Member Functions inherited from TScalarVector
virtual void to_real ()
 switch to real valued representation if possible
 
virtual void to_complex ()
 switch to complex valued representation
 
void init_chunk_mutices ()
 initialise mutices for vector chunks