concepts::Vector< F > Class Template Reference
A vector. More...
#include <vectorTest.hh>
Public Member Functions | |
virtual Function< F > & | add (const Function< F > &fnc, F sc) |
template<class H > | |
Vector< F > & | add (const Vector< H > &fnc) |
Adds a vector of possible different length and type. More... | |
template<class H > | |
Vector< F > & | add (const Vector< H > &fnc, F sc, uint offset=0) |
Adds a vector of possible different length and type with an offset. More... | |
Vector< F > & | apply (F fnc(const F &)) |
Application operator to each component, e.g. More... | |
template<class G > | |
Vector< F > & | assemble (const Space< G > &spc, const LinearForm< F, G > &lf) |
Assembles the vector w.r.t. linear form lf and space spc . More... | |
F * | data () const |
Real | l1 () const |
l1 norm More... | |
Real | l2 () const |
l2 norm More... | |
Real | l2_2 () const |
l2 norm squared More... | |
Real | max () const |
Maximum of the absolute values in the vector, ie. norm. More... | |
uint | n () const |
Elements in the vector. More... | |
operator F* () const | |
Conversion operator. More... | |
virtual F & | operator() (uint i) |
virtual F | operator() (uint i) const |
F | operator* (const Vector< F > &fnc) const |
Inner product (v = this , w = \fnc) More... | |
Vector< F > | operator* (F c) const |
virtual Function< F > & | operator*= (F sc) |
Scaling operator. More... | |
Vector< F > | operator+ (const Function< F > &fnc) const |
Vector< F > | operator+ (F c) const |
virtual Function< F > & | operator+= (const Function< F > &fnc) |
Addition operator. More... | |
virtual Function< F > & | operator+= (F c) |
Vector< F > | operator- (const Function< F > &fnc) const |
Vector< F > | operator- (F c) const |
virtual Function< F > & | operator-= (const Function< F > &fnc) |
Subtraction operator. More... | |
virtual Function< F > & | operator-= (F c) |
Vector< F > | operator/ (F c) const |
virtual Function< F > & | operator/= (F sc) |
virtual Vector< F > & | operator= (const Function< F > &fnc) |
template<class H > | |
Vector< F > & | operator= (const Function< H > &fnc) |
Vector< F > & | operator= (const Vector< F > &fnc) |
Assignement operator. More... | |
Vector< F > & | operator= (F c) |
Assignement operator. More... | |
virtual void | resize (uint n) |
Sets a new size, previous data might be lost More... | |
void | reverse () |
uint | size () const |
void | storeMatlab (const char *filename, const char *name=0, bool append=false) const |
Stores the vector in a Matlab sparse matrix. More... | |
template<class G > | |
Vector (const Space< G > &spc) | |
Constructor. More... | |
template<class G > | |
Vector (const Space< G > &spc, const LinearForm< F, G > &lf) | |
Constructor. More... | |
template<class G > | |
Vector (const Space< G > &spc, const std::string &fname) | |
File read constructor. More... | |
template<class G > | |
Vector (const Space< G > &spc, F *data) | |
Constructor. More... | |
Vector (const uint dim=0) | |
Constructor. More... | |
Vector (const Vector< F > &f) | |
Copy constructor. More... | |
template<class H > | |
Vector (const Vector< H > &f) | |
Copy constructor. More... | |
template<class H > | |
Vector (const Vector< H > &fnc, const Set< IndexRange > &indices) | |
Constructor. More... | |
template<class H > | |
Vector (const Vector< H > &fncX, const F &fnc(const H &)) | |
template<class H > | |
Vector (const Vector< H > &fncX, F fnc(const H &)) | |
Constructor. More... | |
Vector (const Vector< typename Realtype< F >::type > &V_R, const Vector< typename Realtype< F >::type > &V_I) | |
Constructor. More... | |
Vector (uint dim, F *data) | |
const Vector< F > & | write (const std::string &fname) const |
Writes the vector to a file. More... | |
virtual | ~Vector () |
Protected Member Functions | |
template<class G > | |
void | fillEntries_ (const Space< G > &spc, const LinearForm< F, G > &lf) |
virtual std::ostream & | info (std::ostream &os) const |
Protected Attributes | |
Array< F > | data_ |
Vector data. More... | |
Private Attributes | |
F * | v_ |
Pointer to the vector data. More... | |
Static Private Attributes | |
static uint | storeMatlabCounter_ |
Counts number of Matlab outputs (used to uniquely name the vectors) More... | |
Detailed Description
template<class F>
class concepts::Vector< F >
A vector.
The values of the function represented by this vector are stored elementwise in an array.
It is possible to write fast interfaces to other libraries since the array of values is under complete control of this class. An example is the interface to PETSc, where the vector data is not copied, but the data of PETSc is used.
- Examples
- arpackppTutorial.cc, and hpFEM3d-EV.cc.
Definition at line 15 of file vectorTest.hh.
Constructor & Destructor Documentation
◆ Vector() [1/12]
concepts::Vector< F >::Vector | ( | const Vector< F > & | f | ) |
Copy constructor.
◆ Vector() [2/12]
◆ Vector() [3/12]
|
inline |
◆ Vector() [4/12]
|
inline |
◆ Vector() [5/12]
concepts::Vector< F >::Vector | ( | const Space< G > & | spc, |
const LinearForm< F, G > & | lf | ||
) |
◆ Vector() [6/12]
concepts::Vector< F >::Vector | ( | const Space< G > & | spc, |
const std::string & | fname | ||
) |
File read constructor.
The vector is read from a file. This should be endian proof.
- Parameters
-
spc A space fname Filename
◆ Vector() [7/12]
|
inline |
◆ Vector() [8/12]
|
inline |
◆ Vector() [9/12]
concepts::Vector< F >::Vector | ( | const Vector< H > & | fncX, |
F | fncconst H & | ||
) |
◆ Vector() [10/12]
concepts::Vector< F >::Vector | ( | const Vector< H > & | fncX, |
const F & | fncconst H & | ||
) |
◆ Vector() [11/12]
concepts::Vector< F >::Vector | ( | const Vector< typename Realtype< F >::type > & | V_R, |
const Vector< typename Realtype< F >::type > & | V_I | ||
) |
Constructor.
Use this constructor to build a vector of type F out of two vectors with entries of type Realtype<F>; works only for F = Cmplx, G = Real
◆ Vector() [12/12]
concepts::Vector< F >::Vector | ( | const Vector< H > & | fnc, |
const Set< IndexRange > & | indices | ||
) |
◆ ~Vector()
|
virtual |
Member Function Documentation
◆ add() [1/3]
|
virtual |
◆ add() [2/3]
|
inline |
◆ add() [3/3]
Vector< F > & concepts::Vector< F >::add | ( | const Vector< H > & | fnc, |
F | sc, | ||
uint | offset = 0 |
||
) |
◆ apply()
Vector<F>& concepts::Vector< F >::apply | ( | F | fncconst F & | ) |
Application operator to each component, e.g.
std::sin or std::conj
◆ assemble()
Vector<F>& concepts::Vector< F >::assemble | ( | const Space< G > & | spc, |
const LinearForm< F, G > & | lf | ||
) |
Assembles the vector w.r.t. linear form lf
and space spc
.
◆ data()
|
inline |
◆ fillEntries_()
|
protected |
◆ info()
|
protectedvirtual |
◆ l1()
Real concepts::Vector< F >::l1 | ( | ) | const |
l1 norm
◆ l2()
|
inline |
◆ l2_2()
Real concepts::Vector< F >::l2_2 | ( | ) | const |
l2 norm squared
◆ max()
Real concepts::Vector< F >::max | ( | ) | const |
Maximum of the absolute values in the vector, ie. norm.
◆ n()
|
inline |
◆ operator F*()
|
inline |
◆ operator()() [1/2]
|
inlinevirtual |
◆ operator()() [2/2]
|
inlinevirtual |
◆ operator*() [1/2]
F concepts::Vector< F >::operator* | ( | const Vector< F > & | fnc | ) | const |
Inner product (v
= this
, w
= \fnc)
or
for complex vectors respectivly.
◆ operator*() [2/2]
Vector<F> concepts::Vector< F >::operator* | ( | F | c | ) | const |
◆ operator*=()
|
virtual |
Scaling operator.
◆ operator+() [1/2]
Vector<F> concepts::Vector< F >::operator+ | ( | const Function< F > & | fnc | ) | const |
◆ operator+() [2/2]
Vector<F> concepts::Vector< F >::operator+ | ( | F | c | ) | const |
◆ operator+=() [1/2]
|
virtual |
Addition operator.
◆ operator+=() [2/2]
|
virtual |
◆ operator-() [1/2]
Vector<F> concepts::Vector< F >::operator- | ( | const Function< F > & | fnc | ) | const |
◆ operator-() [2/2]
Vector<F> concepts::Vector< F >::operator- | ( | F | c | ) | const |
◆ operator-=() [1/2]
|
virtual |
Subtraction operator.
◆ operator-=() [2/2]
|
virtual |
◆ operator/()
Vector<F> concepts::Vector< F >::operator/ | ( | F | c | ) | const |
◆ operator/=()
|
virtual |
◆ operator=() [1/4]
|
virtual |
◆ operator=() [2/4]
Vector< F > & concepts::Vector< F >::operator= | ( | const Function< H > & | fnc | ) |
◆ operator=() [3/4]
Vector<F>& concepts::Vector< F >::operator= | ( | const Vector< F > & | fnc | ) |
Assignement operator.
◆ operator=() [4/4]
Vector<F>& concepts::Vector< F >::operator= | ( | F | c | ) |
Assignement operator.
◆ resize()
|
inlinevirtual |
◆ reverse()
void concepts::Vector< F >::reverse |
◆ size()
|
inline |
◆ storeMatlab()
void concepts::Vector< F >::storeMatlab | ( | const char * | filename, |
const char * | name = 0 , |
||
bool | append = false |
||
) | const |
Stores the vector in a Matlab sparse matrix.
◆ write()
const Vector<F>& concepts::Vector< F >::write | ( | const std::string & | fname | ) | const |
Writes the vector to a file.
This should be endian proof.
- Parameters
-
fname Filename
Member Data Documentation
◆ data_
|
protected |
◆ storeMatlabCounter_
|
staticprivate |
◆ v_
|
private |
The documentation for this class was generated from the following files:
- function/testsuite/vectorTest.hh
- function/vector.hh