v2DM-DOCI  1.0
doci2DM::Vector Class Reference

#include <Vector.h>

+ Collaboration diagram for doci2DM::Vector:

Public Member Functions

 Vector (int)
 
 Vector (Matrix &)
 
 Vector (const Vector &)
 
 Vector (Vector &&)
 
virtual ~Vector ()
 
Vectoroperator= (const Vector &)
 
Vectoroperator= (Vector &&)
 
Vectoroperator= (double)
 
Vectoroperator+= (const Vector &)
 
Vectoroperator-= (const Vector &)
 
Vectordaxpy (double alpha, const Vector &)
 
Vectoroperator/= (double)
 
Vectoroperator*= (double)
 
void diagonalize (Matrix &)
 
double & operator[] (int i)
 
double operator[] (int i) const
 
void fill_Random ()
 
void fill_Random (int seed)
 
double * gVector ()
 
const double * gVector () const
 
int gn () const
 
double sum () const
 
double trace () const
 
double log_product () const
 
double ddot (const Vector &) const
 
void dscal (double alpha)
 
double min () const
 
double max () const
 
void invert ()
 
void sqrt (int)
 
void symmetrize ()
 
void L_map (const Vector &, const Vector &)
 
Vectormprod (const Vector &, const Vector &)
 
void sort ()
 
void sep_pm (Vector &, Vector &)
 

Private Attributes

std::unique_ptr< double[]> vector
 pointer of doubles, contains the numbers, the vector More...
 
int n
 dimension of the vector More...
 

Friends

std::ostream & operator<< (std::ostream &output, const doci2DM::Vector &vector_p)
 

Detailed Description

Author
Brecht Verstichel
Date
15-04-2010

This is a class written for vectors. It will contain the eigenvalues of the TPM, etc. Matrices. It is a template class, corresponding to the different VectorType's that can be put in, it will automatically get the right dimension. It is a wrapper around a pointer and redefines much used lapack and blas routines as memberfunctions

Definition at line 42 of file Vector.h.

Constructor & Destructor Documentation

Vector::Vector ( int  n)

constructor that takes dimension as input

Parameters
ndimension of the vector

Definition at line 46 of file Vector.cpp.

Vector::Vector ( Matrix matrix)

Construct and initialize the Vector object by diagonalizing a Matrix object:

Definition at line 56 of file Vector.cpp.

+ Here is the call graph for this function:

Vector::Vector ( const Vector vec_copy)

copy constructor

Parameters
vec_copyThe vector you want to be copied into the object you are constructing

Definition at line 70 of file Vector.cpp.

Vector::Vector ( Vector &&  vec_copy)

Definition at line 79 of file Vector.cpp.

Vector::~Vector ( )
virtual

Destructor

Definition at line 90 of file Vector.cpp.

Member Function Documentation

Vector & Vector::daxpy ( double  alpha,
const Vector vector_pl 
)

add the vector vector_pl times the constant alpha to this

Parameters
alphathe constant to multiply the vector_pl with
vector_plthe Vector to be multiplied by alpha and added to this

Definition at line 154 of file Vector.cpp.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

double Vector::ddot ( const Vector vector_i) const
Returns
inproduct of (*this) vector with vector_i
Parameters
vector_iinput vector

Definition at line 277 of file Vector.cpp.

+ Here is the call graph for this function:

void Vector::diagonalize ( Matrix matrix)

Diagonalize the Matrix matrix when you have allready allocated the memory of the vector on the correct dimension.

Definition at line 213 of file Vector.cpp.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void Vector::dscal ( double  alpha)

Scale the vector (*this) with parameter alpha

Parameters
alphascalefactor

Definition at line 288 of file Vector.cpp.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void Vector::fill_Random ( )

Fill the vector with random numbers.

Definition at line 298 of file Vector.cpp.

void Vector::fill_Random ( int  seed)

Fill the vector with random numbers.

Parameters
seedthe seed to use

Definition at line 307 of file Vector.cpp.

int Vector::gn ( ) const
Returns
the dimension of the vector

Definition at line 237 of file Vector.cpp.

+ Here is the caller graph for this function:

double * Vector::gVector ( )
Returns
the underlying pointer to vector, useful for mkl and lapack applications

Definition at line 221 of file Vector.cpp.

+ Here is the caller graph for this function:

const double * Vector::gVector ( ) const
Returns
the underlying pointer to vector, useful for mkl and lapack applications: const version

Definition at line 229 of file Vector.cpp.

void Vector::invert ( )

Definition at line 356 of file Vector.cpp.

void Vector::L_map ( const Vector a,
const Vector b 
)

Definition at line 376 of file Vector.cpp.

double Vector::log_product ( ) const
Returns
the logarithm of the product of all the elements in the vector (so the sum of all the logarithms)

Definition at line 263 of file Vector.cpp.

double Vector::max ( ) const
Returns
the maximal element present in this Vector object. watch out, only works when Vector is filled with the eigenvalues of a diagonalized Matrix object

Definition at line 345 of file Vector.cpp.

double Vector::min ( ) const
Returns
the minimal element present in this Vector object. watch out, only works when Vector is filled with the eigenvalues of a diagonalized Matrix object

Definition at line 330 of file Vector.cpp.

Vector & Vector::mprod ( const Vector x,
const Vector y 
)

Definition at line 384 of file Vector.cpp.

Vector & Vector::operator*= ( double  c)

*= operator overloaded: divide by a constant

Parameters
cthe number to divide your vector through

Definition at line 178 of file Vector.cpp.

+ Here is the call graph for this function:

Vector & Vector::operator+= ( const Vector vector_pl)

overload the += operator for matrices

Parameters
vector_plThe vector you want to add to this

Definition at line 131 of file Vector.cpp.

+ Here is the call graph for this function:

Vector & Vector::operator-= ( const Vector vector_pl)

overload the -= operator for matrices

Parameters
vector_plThe vector you want to deduct from this

Definition at line 142 of file Vector.cpp.

+ Here is the call graph for this function:

Vector & Vector::operator/= ( double  c)

/= operator overloaded: divide by a constant

Parameters
cthe number to divide your vector through

Definition at line 167 of file Vector.cpp.

+ Here is the call graph for this function:

Vector & Vector::operator= ( const Vector vec_copy)

overload the equality operator

Parameters
vec_copyThe vector you want to be copied into this

Definition at line 98 of file Vector.cpp.

Vector & Vector::operator= ( Vector &&  vec_copy)

Definition at line 106 of file Vector.cpp.

Vector & Vector::operator= ( double  a)

Make all the number in your vector equal to the number a, e.g. usefull for initialization (Vector M = 0)

Parameters
athe number

Definition at line 119 of file Vector.cpp.

double & Vector::operator[] ( int  i)

write access to your vector, change the number on index i

Parameters
irow number
Returns
the entry on place i

Definition at line 190 of file Vector.cpp.

double Vector::operator[] ( int  i) const

read access to your vector, change the number on index i: const version

Parameters
irow number
Returns
the entry on place i

Definition at line 202 of file Vector.cpp.

void Vector::sep_pm ( Vector pos,
Vector neg 
)

Definition at line 402 of file Vector.cpp.

void Vector::sort ( )

Sort the vector, small to large

Definition at line 397 of file Vector.cpp.

void Vector::sqrt ( int  option)

Definition at line 362 of file Vector.cpp.

double Vector::sum ( ) const
Returns
the sum of all the elements in the vector

Definition at line 245 of file Vector.cpp.

+ Here is the caller graph for this function:

void Vector::symmetrize ( )

Definition at line 372 of file Vector.cpp.

double Vector::trace ( ) const

Definition at line 255 of file Vector.cpp.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

Friends And Related Function Documentation

std::ostream& operator<< ( std::ostream &  output,
const doci2DM::Vector vector_p 
)
friend

Output stream operator overloaded, the usage is simple, if you want to print to a file, make an ifstream object and type:

object << vector << endl;

For output onto the screen type:

cout << vector << endl;

Parameters
outputThe stream to which you are writing (e.g. cout)
vector_pde Vector you want to print

Definition at line 317 of file Vector.cpp.

Member Data Documentation

int doci2DM::Vector::n
private

dimension of the vector

Definition at line 145 of file Vector.h.

std::unique_ptr<double []> doci2DM::Vector::vector
private

pointer of doubles, contains the numbers, the vector

Definition at line 142 of file Vector.h.


The documentation for this class was generated from the following files: