v2DM-DOCI
1.0
|
#include <Vector.h>
Public Member Functions | |
Vector (int) | |
Vector (Matrix &) | |
Vector (const Vector &) | |
Vector (Vector &&) | |
virtual | ~Vector () |
Vector & | operator= (const Vector &) |
Vector & | operator= (Vector &&) |
Vector & | operator= (double) |
Vector & | operator+= (const Vector &) |
Vector & | operator-= (const Vector &) |
Vector & | daxpy (double alpha, const Vector &) |
Vector & | operator/= (double) |
Vector & | operator*= (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 &) |
Vector & | mprod (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) |
Vector::Vector | ( | int | n | ) |
constructor that takes dimension as input
n | dimension 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.
Vector::Vector | ( | const Vector & | vec_copy | ) |
copy constructor
vec_copy | The 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.
|
virtual |
Destructor
Definition at line 90 of file Vector.cpp.
add the vector vector_pl times the constant alpha to this
alpha | the constant to multiply the vector_pl with |
vector_pl | the Vector to be multiplied by alpha and added to this |
Definition at line 154 of file Vector.cpp.
double Vector::ddot | ( | const Vector & | vector_i | ) | const |
vector_i | input vector |
Definition at line 277 of file Vector.cpp.
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.
void Vector::dscal | ( | double | alpha | ) |
Scale the vector (*this) with parameter alpha
alpha | scalefactor |
Definition at line 288 of file Vector.cpp.
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.
seed | the seed to use |
Definition at line 307 of file Vector.cpp.
int Vector::gn | ( | ) | const |
Definition at line 237 of file Vector.cpp.
double * Vector::gVector | ( | ) |
Definition at line 221 of file Vector.cpp.
const double * Vector::gVector | ( | ) | const |
Definition at line 229 of file Vector.cpp.
void Vector::invert | ( | ) |
Definition at line 356 of file Vector.cpp.
Definition at line 376 of file Vector.cpp.
double Vector::log_product | ( | ) | const |
Definition at line 263 of file Vector.cpp.
double Vector::max | ( | ) | const |
Definition at line 345 of file Vector.cpp.
double Vector::min | ( | ) | const |
Definition at line 330 of file Vector.cpp.
Definition at line 384 of file Vector.cpp.
Vector & Vector::operator*= | ( | double | c | ) |
*= operator overloaded: divide by a constant
c | the number to divide your vector through |
Definition at line 178 of file Vector.cpp.
overload the += operator for matrices
vector_pl | The vector you want to add to this |
Definition at line 131 of file Vector.cpp.
overload the -= operator for matrices
vector_pl | The vector you want to deduct from this |
Definition at line 142 of file Vector.cpp.
Vector & Vector::operator/= | ( | double | c | ) |
/= operator overloaded: divide by a constant
c | the number to divide your vector through |
Definition at line 167 of file Vector.cpp.
overload the equality operator
vec_copy | The vector you want to be copied into this |
Definition at line 98 of file Vector.cpp.
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)
a | the 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
i | row number |
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
i | row number |
Definition at line 202 of file Vector.cpp.
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 |
Definition at line 245 of file Vector.cpp.
void Vector::symmetrize | ( | ) |
Definition at line 372 of file Vector.cpp.
double Vector::trace | ( | ) | const |
Definition at line 255 of file Vector.cpp.
|
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;
output | The stream to which you are writing (e.g. cout) |
vector_p | de Vector you want to print |
Definition at line 317 of file Vector.cpp.
|
private |