#include <Vector.h>
Public Member Functions | |
| Vector (int dim, bool distributed) | |
| Constructor creating a Vector with uninitialized values. More... | |
| Vector (double *vec, int dim, bool distributed, bool copy_data=true) | |
| Constructor in which the Vector is given its initial values. More... | |
| Vector (const Vector &other) | |
| Copy constructor. More... | |
| ~Vector () | |
| Destructor. | |
| Vector & | operator= (const Vector &rhs) |
| Assignment operator. More... | |
| Vector & | operator+= (const Vector &rhs) |
| Addition operator. More... | |
| Vector & | operator= (const double &a) |
| Equal operator. More... | |
| Vector & | transform (std::function< void(const int size, double *vector)> transformer) |
| Transform the vector using a supplied function. More... | |
| void | transform (Vector &result, std::function< void(const int size, double *vector)> transformer) const |
| Transform a vector using a supplied function and store the results in another vector. More... | |
| void | transform (Vector *&result, std::function< void(const int size, double *vector)> transformer) const |
| Transform a vector using a supplied function and store the results in another vector. More... | |
| Vector & | transform (std::function< void(const int size, double *origVector, double *resultVector)> transformer) |
| Transform the vector using a supplied function. More... | |
| void | transform (Vector &result, std::function< void(const int size, double *origVector, double *resultVector)> transformer) const |
| Transform a vector using a supplied function and store the results in another vector. More... | |
| void | transform (Vector *&result, std::function< void(const int size, double *origVector, double *resultVector)> transformer) const |
| Transform a vector using a supplied function and store the results in another vector. More... | |
| void | setSize (int dim) |
| Sets the length of the vector and reallocates storage if needed. All values are initialized to zero. More... | |
| bool | distributed () const |
| Returns true if the Vector is distributed. More... | |
| int | dim () const |
| Returns the dimension of the Vector on this processor. More... | |
| double | inner_product (const Vector &other) const |
| Inner product, reference form. More... | |
| double | inner_product (const Vector *other) const |
| Inner product, pointer version. More... | |
| double | norm () const |
| Form the norm of this. More... | |
| double | norm2 () const |
| Form the squared norm of this. More... | |
| double | normalize () |
| Normalizes the Vector and returns its norm. More... | |
| Vector * | plus (const Vector &other) const |
| Adds other and this and returns the result, reference version. More... | |
| Vector * | plus (const Vector *other) const |
| Adds other and this and returns the result, pointer version. More... | |
| void | plus (const Vector &other, Vector *&result) const |
| Adds other and this and fills result with the answer. More... | |
| void | plus (const Vector &other, Vector &result) const |
| Adds other and this and fills result with the answer. More... | |
| Vector * | plusAx (double factor, const Vector &other) |
| Adds factor*other and this and returns the result, reference version. More... | |
| Vector * | plusAx (double factor, const Vector *other) |
| Adds factor*other and this and returns the result, pointer version. More... | |
| void | plusAx (double factor, const Vector &other, Vector *&result) const |
| Adds factor*other and this and fills result with the answer. More... | |
| void | plusAx (double factor, const Vector &other, Vector &result) const |
| Adds factor*other and this and fills result with the answer. More... | |
| void | plusEqAx (double factor, const Vector &other) |
| Adds factor*other to this, reference version. More... | |
| void | plusEqAx (double factor, const Vector *other) |
| Adds factor*other to this, pointer version. More... | |
| Vector * | minus (const Vector &other) const |
| Subtracts other and this and returns the result, reference version. More... | |
| Vector * | minus (const Vector *other) const |
| Subtracts other and this and returns the result, pointer version. More... | |
| void | minus (const Vector &other, Vector *&result) const |
| Subtracts other and this and fills result with the answer. More... | |
| void | minus (const Vector &other, Vector &result) const |
| Subtracts other and this and fills result with the answer. More... | |
| Vector * | mult (double factor) const |
| Multiplies this by the supplied constant and returns the result. More... | |
| void | mult (double factor, Vector *&result) const |
| Multiplies this by the supplied constant and fills result with the answer. More... | |
| void | mult (double factor, Vector &result) const |
| Multiplies this by the supplied constant and fills result with the answer. More... | |
| const double & | item (int i) const |
| Const Vector member access. More... | |
| double & | item (int i) |
| Non-const Vector member access. More... | |
| const double & | operator() (int i) const |
| Const Vector member access. More... | |
| double & | operator() (int i) |
| Non-const Vector member access. More... | |
| void | print (const char *prefix) |
| print Vector into (a) ascii file(s). More... | |
| void | write (const std::string &base_file_name) |
| write Vector into (a) HDF file(s). More... | |
| void | read (const std::string &base_file_name) |
| read Vector from (a) HDF file(s). More... | |
| void | local_read (const std::string &base_file_name, int rank) |
| read read a single rank of a distributed Vector from (a) HDF file(s). More... | |
| double * | getData () const |
| Get the vector data as a pointer. | |
Class Vector is a simple vector class in which the dimensions may be distributed across multiple processes. This class supports only the basic operations that are needed by the SVD library.
| CAROM::Vector::Vector | ( | int | dim, |
| bool | distributed | ||
| ) |
Constructor creating a Vector with uninitialized values.
| CAROM::Vector::Vector | ( | double * | vec, |
| int | dim, | ||
| bool | distributed, | ||
| bool | copy_data = true |
||
| ) |
Constructor in which the Vector is given its initial values.
| [in] | vec | The initial values of the Vector. |
| [in] | dim | When undistributed, the total dimension of the Vector. When distributed, the part of the total dimension of the Vector on this processor. |
| [in] | distributed | If true the dimensions of the Vector are spread over all processors. |
| [in] | copy_data | If true the vector allocates is own storage and copies the contents of vec into its own storage. Otherwise it uses vec as its storage. |
| CAROM::Vector::Vector | ( | const Vector & | other | ) |
Copy constructor.
| [in] | other | The Vector to copy. |
|
inline |
|
inline |
| double CAROM::Vector::inner_product | ( | const Vector & | other | ) | const |
Inner product, reference form.
For distributed Vectors this is a parallel operation.
| [in] | other | The Vector to form the inner product with this. |
|
inline |
Inner product, pointer version.
For distributed Vectors this is a parallel operation.
| [in] | other | The Vector to form the inner product with this. |
|
inline |
|
inline |
| void CAROM::Vector::local_read | ( | const std::string & | base_file_name, |
| int | rank | ||
| ) |
read read a single rank of a distributed Vector from (a) HDF file(s).
| [in] | base_file_name | The base part of the file name. |
| [in] | rank | The rank to read from. |
Subtracts other and this and returns the result, reference version.
| [in] | other | The other subtrahand. |
Subtracts other and this and returns the result, pointer version.
| [in] | other | The other subtrahand. |
Subtracts other and this and fills result with the answer.
Result will be allocated if unallocated or resized appropriately if already allocated.
| [in] | other | The other subtrahend. |
| [out] | result | this - other |
Subtracts other and this and fills result with the answer.
Result will be resized appropriately.
| [in] | other | The other subtrahend. |
| [out] | result | this - other |
|
inline |
Multiplies this by the supplied constant and returns the result.
| [in] | factor | Factor to multiply by. |
| void CAROM::Vector::mult | ( | double | factor, |
| Vector *& | result | ||
| ) | const |
Multiplies this by the supplied constant and fills result with the answer.
| [in] | factor | Factor to multiply by. |
| [out] | result | factor*this |
| void CAROM::Vector::mult | ( | double | factor, |
| Vector & | result | ||
| ) | const |
Multiplies this by the supplied constant and fills result with the answer.
| [in] | factor | Factor to multiply by. |
| [out] | result | factor*this |
| double CAROM::Vector::norm | ( | ) | const |
Form the norm of this.
For a distributed Vector this is a parallel operation.
| double CAROM::Vector::norm2 | ( | ) | const |
Form the squared norm of this.
For a distributed Vector this is a parallel operation.
| double CAROM::Vector::normalize | ( | ) |
|
inline |
|
inline |
Addition operator.
| [in] | rhs | The Vector to add to this. |
Assignment operator.
| [in] | rhs | The Vector to assign to this. |
| Vector& CAROM::Vector::operator= | ( | const double & | a | ) |
Adds other and this and returns the result, reference version.
| [in] | other | The other summand. |
Adds other and this and returns the result, pointer version.
| [in] | other | The other summand. |
Adds other and this and fills result with the answer.
Result will be allocated if unallocated or resized appropriately if already allocated.
| [in] | other | The other summand. |
| [out] | result | this + other |
Adds other and this and fills result with the answer.
Result will be resized appropriately.
| [in] | other | The other summand. |
| [out] | result | this + other |
Adds factor*other and this and returns the result, reference version.
| [in] | factor | Multiplicative factor applied to other. |
| [in] | other | The other summand. |
Adds factor*other and this and returns the result, pointer version.
| [in] | factor | Multiplicative factor applied to other. |
| [in] | other | The other summand. |
Adds factor*other and this and fills result with the answer.
Result will be allocated if unallocated or resized appropriately if already allocated.
| [in] | factor | Multiplicative factor applied to other. |
| [in] | other | The other summand. |
| [out] | result | this + factor*other |
Adds factor*other and this and fills result with the answer.
Result will be resized appropriately.
| [in] | factor | Multiplicative factor applied to other. |
| [in] | other | The other summand. |
| [out] | result | this + factor*other |
| void CAROM::Vector::plusEqAx | ( | double | factor, |
| const Vector & | other | ||
| ) |
Adds factor*other to this, reference version.
| [in] | factor | Multiplicative factor applied to other. |
| [in] | other | The other summand. |
|
inline |
Adds factor*other to this, pointer version.
| [in] | factor | Multiplicative factor applied to other. |
| [in] | other | The other summand. |
| void CAROM::Vector::print | ( | const char * | prefix | ) |
print Vector into (a) ascii file(s).
| [in] | prefix | The name of the prefix of the file name. |
| void CAROM::Vector::read | ( | const std::string & | base_file_name | ) |
read Vector from (a) HDF file(s).
| [in] | base_file_name | The base part of the file name. |
|
inline |
| Vector& CAROM::Vector::transform | ( | std::function< void(const int size, double *vector)> | transformer | ) |
Transform the vector using a supplied function.
| [in] | transformer | A transformer function which takes in as input a size and a vector. |
| void CAROM::Vector::transform | ( | Vector & | result, |
| std::function< void(const int size, double *vector)> | transformer | ||
| ) | const |
Transform a vector using a supplied function and store the results in another vector.
| [out] | result | A vector which will store the transformed result. |
| [in] | transformer | A transformer function which takes in as input a size and transforms the vector. |
| void CAROM::Vector::transform | ( | Vector *& | result, |
| std::function< void(const int size, double *vector)> | transformer | ||
| ) | const |
Transform a vector using a supplied function and store the results in another vector.
| [out] | result | A vector which will store the transformed result. |
| [in] | transformer | A transformer function which takes in as input a size and transforms the vector. |
| Vector& CAROM::Vector::transform | ( | std::function< void(const int size, double *origVector, double *resultVector)> | transformer | ) |
Transform the vector using a supplied function.
| [in] | transformer | A transformer function which takes in as input a size and transforms the origVector and stores the result in resultVector. |
| void CAROM::Vector::transform | ( | Vector & | result, |
| std::function< void(const int size, double *origVector, double *resultVector)> | transformer | ||
| ) | const |
Transform a vector using a supplied function and store the results in another vector.
| [out] | result | A vector which will store the transformed result. |
| [in] | transformer | A transformer function which takes in as input a size and transforms the origVector and stores the result in resultVector. |
| void CAROM::Vector::transform | ( | Vector *& | result, |
| std::function< void(const int size, double *origVector, double *resultVector)> | transformer | ||
| ) | const |
Transform a vector using a supplied function and store the results in another vector.
| [out] | result | A vector which will store the transformed result. |
| [in] | transformer | A transformer function which takes in as input a size and transforms the origVector and stores the result in resultVector. |
| void CAROM::Vector::write | ( | const std::string & | base_file_name | ) |
write Vector into (a) HDF file(s).
| [in] | base_file_name | The base part of the file name. |
1.8.5