Home | Doxygen Documentation | Tutorials | Developer Tools (restricted)

Public Member Functions | Protected Member Functions | Protected Attributes | Private Attributes | Static Private Attributes
concepts::Vector< F > Class Template Reference

A vector. More...

#include <vector.hh>

Inheritance diagram for concepts::Vector< F >:
Inheritance graph
[legend]
Collaboration diagram for concepts::Vector< F >:
Collaboration graph
[legend]

List of all members.

Public Member Functions

virtual Function< F > & add (const Function< F > &fnc, F sc)
 Adds a times fnc to this function.
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.
template<class H >
Vector< F > & add (const Vector< H > &fnc)
 Adds a vector of possible different length and type.
Vector< F > & apply (F fnc(const F &))
 Application operator to each component, e.g.
template<class G >
Vector< F > & assemble (const Space< G > &spc, LinearForm< F, G > &lf)
 Assembles the vector w.r.t. linear form lf and space spc.
F * data () const
uint dim () const
 Returns the dimension of the function.
Real l1 () const
 l1 norm
Real l2 () const
 l2 norm
Real l2_2 () const
 l2 norm squared
Real max () const
 Maximum of the absolute values in the vector, ie. $l^\infty$ norm.
uint n () const
 Elements in the vector.
 operator F * () const
 Conversion operator.
virtual F & operator() (uint i)
 Index operator.
virtual F operator() (uint i) const
 Index operator.
Vector< F > operator* (F c) const
operator* (const Vector< F > &fnc) const
 Inner product (v = this, w = )
virtual Function< F > & operator*= (F sc)
 Scaling operator.
Vector< F > operator+ (const Function< F > &fnc) const
Vector< F > operator+ (F c) const
virtual Function< F > & operator+= (F c)
 Addition operator.
virtual Function< F > & operator+= (const Function< F > &fnc)
 Addition operator.
Vector< F > operator- (const Function< F > &fnc) const
Vector< F > operator- (F c) const
virtual Function< F > & operator-= (const Function< F > &fnc)
 Subtraction operator.
virtual Function< F > & operator-= (F c)
 Subtraction operator.
virtual Function< F > & operator= (const Function< F > &fnc)
 Assignment operator.
template<class H >
Function< F > & operator= (const Function< H > &fnc)
Vector< F > & operator= (F c)
 Assignement operator.
Vector< F > & operator= (const Vector< F > &fnc)
 Assignement operator.
int size ()
void storeMatlab (const char *filename, const char *name=0, bool append=false) const
 Stores the vector in a Matlab sparse matrix.
 Vector (uint dim, F *data)
template<class G >
 Vector (const Space< G > &spc)
 Constructor.
template<class H >
 Vector (const Vector< H > &fnc, const Set< IndexRange > &indices)
 Constructor.
template<class G >
 Vector (const Space< G > &spc, LinearForm< F, G > &lf)
 Constructor.
 Vector (const Vector< F > &f)
 Copy constructor.
template<class G >
 Vector (const Space< G > &spc, F *data)
 Constructor.
 Vector (const Vector< typename Realtype< F >::type > &V_R, const Vector< typename Realtype< F >::type > &V_I)
 Constructor.
template<class H >
 Vector (const Vector< H > &fncX, const F &fnc(const H &))
template<class G >
 Vector (const Space< G > &spc, const std::string &fname)
 File read constructor.
template<class H >
 Vector (const Vector< H > &f)
 Copy constructor.
template<class H >
 Vector (const Vector< H > &fncX, F fnc(const H &))
 Constructor.
 Vector (const uint dim)
 Constructor.
const Vector< F > & write (const std::string &fname) const
 Writes the vector to a file.
virtual ~Vector ()

Protected Member Functions

template<class G >
void fillEntries_ (const Space< G > &spc, LinearForm< F, G > &lf)
virtual std::ostream & info (std::ostream &os) const
 Returns information in an output stream.

Protected Attributes

Array< F > data_
 Vector data.
const uint dim_
 Dimension of the function (or of the space the function is defined)

Private Attributes

F * v_
 Pointer to the vector data.

Static Private Attributes

static uint storeMatlabCounter_
 Counts number of Matlab outputs (used to uniquely name the vectors)

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.

Test:
test::VectorTest

Definition at line 37 of file vector.hh.


Constructor & Destructor Documentation

template<class F>
concepts::Vector< F >::Vector ( const Vector< F > &  f)

Copy constructor.

template<class F >
template<class H >
concepts::Vector< F >::Vector ( const Vector< H > &  f)

Copy constructor.

Definition at line 235 of file vector.hh.

Here is the call graph for this function:

template<class F>
template<class G >
concepts::Vector< F >::Vector ( const Space< G > &  spc) [inline]

Constructor.

Creates a vector with all entries set to 0.

Parameters:
spcA space

Definition at line 49 of file vector.hh.

template<class F>
concepts::Vector< F >::Vector ( const uint  dim) [inline]

Constructor.

Creates a vector with all entries set to 0.

Parameters:
dimnumber of entries

Definition at line 55 of file vector.hh.

template<class F>
template<class G >
concepts::Vector< F >::Vector ( const Space< G > &  spc,
LinearForm< F, G > &  lf 
)

Constructor.

The entries are filled according to lf.

Parameters:
spcA space
lfA linear form

Definition at line 252 of file vector.hh.

Here is the call graph for this function:

template<class F>
template<class G >
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:
spcA space
fnameFilename
template<class F>
template<class G >
concepts::Vector< F >::Vector ( const Space< G > &  spc,
F *  data 
) [inline]

Constructor.

Use this constructor to create a vector from an array of data. The memory in data is not freed by this class.

Parameters:
spcSpace on which the vector is defined
dataData of the vector

Definition at line 82 of file vector.hh.

template<class F>
concepts::Vector< F >::Vector ( uint  dim,
F *  data 
) [inline]

Definition at line 86 of file vector.hh.

template<class F>
template<class H >
concepts::Vector< F >::Vector ( const Vector< H > &  fncX,
F   fncconst H & 
)

Constructor.

Use this constructor to create a vector of type F out of a vector with entries of type H. The F type vector consists of elementwise evaluations of the function fnc.

Definition at line 242 of file vector.hh.

template<class F>
template<class H >
concepts::Vector< F >::Vector ( const Vector< H > &  fncX,
const F &  fncconst H & 
)

Definition at line 259 of file vector.hh.

template<class F>
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

template<class F>
template<class H >
concepts::Vector< F >::Vector ( const Vector< H > &  fnc,
const Set< IndexRange > &  indices 
)

Constructor.

Takes (copies) the entries at the indices indices of vector fnc.

Definition at line 269 of file vector.hh.

Here is the call graph for this function:

template<class F>
virtual concepts::Vector< F >::~Vector ( ) [virtual]

Member Function Documentation

template<class F>
virtual Function<F>& concepts::Vector< F >::add ( const Function< F > &  fnc,
a 
) [virtual]

Adds a times fnc to this function.

Reimplemented from concepts::Function< F >.

template<class F>
template<class H >
Vector< F > & concepts::Vector< F >::add ( const Vector< H > &  fnc,
sc,
uint  offset = 0 
)

Adds a vector of possible different length and type with an offset.

Definition at line 289 of file vector.hh.

Here is the call graph for this function:

template<class F>
template<class H >
Vector<F>& concepts::Vector< F >::add ( const Vector< H > &  fnc) [inline]

Adds a vector of possible different length and type.

Definition at line 195 of file vector.hh.

template<class F>
Vector<F>& concepts::Vector< F >::apply ( F   fncconst F &)

Application operator to each component, e.g.

std::sin or std::conj

template<class F>
template<class G >
Vector<F>& concepts::Vector< F >::assemble ( const Space< G > &  spc,
LinearForm< F, G > &  lf 
)

Assembles the vector w.r.t. linear form lf and space spc.

template<class F>
F* concepts::Vector< F >::data ( ) const [inline]

Definition at line 185 of file vector.hh.

template<class F>
uint concepts::Function< F >::dim ( ) const [inline, inherited]

Returns the dimension of the function.

Definition at line 50 of file basis.hh.

template<class F>
template<class G >
void concepts::Vector< F >::fillEntries_ ( const Space< G > &  spc,
LinearForm< F, G > &  lf 
) [protected]
template<class F>
virtual std::ostream& concepts::Vector< F >::info ( std::ostream &  os) const [protected, virtual]

Returns information in an output stream.

Reimplemented from concepts::Function< F >.

template<class F>
Real concepts::Vector< F >::l1 ( ) const

l1 norm

template<class F>
Real concepts::Vector< F >::l2 ( ) const [inline]

l2 norm

Definition at line 201 of file vector.hh.

template<class F>
Real concepts::Vector< F >::l2_2 ( ) const

l2 norm squared

template<class F>
Real concepts::Vector< F >::max ( ) const

Maximum of the absolute values in the vector, ie. $l^\infty$ norm.

template<class F>
uint concepts::Vector< F >::n ( ) const [inline]

Elements in the vector.

Definition at line 210 of file vector.hh.

template<class F>
concepts::Vector< F >::operator F * ( ) const [inline]

Conversion operator.

Returns the array of values.

Definition at line 183 of file vector.hh.

template<class F>
virtual F& concepts::Vector< F >::operator() ( uint  i) [inline, virtual]

Index operator.

Implements concepts::Function< F >.

Definition at line 138 of file vector.hh.

template<class F>
virtual F concepts::Vector< F >::operator() ( uint  i) const [inline, virtual]

Index operator.

Implements concepts::Function< F >.

Definition at line 141 of file vector.hh.

template<class F>
F concepts::Vector< F >::operator* ( const Vector< F > &  fnc) const

Inner product (v = this, w = )

\[v \cdot w\]

or

\[v \cdot \overline{w}\]

for complex vectors respectivly.

template<class F>
Vector<F> concepts::Vector< F >::operator* ( c) const
template<class F>
virtual Function<F>& concepts::Vector< F >::operator*= ( sc) [virtual]

Scaling operator.

Reimplemented from concepts::Function< F >.

template<class F>
Vector<F> concepts::Vector< F >::operator+ ( const Function< F > &  fnc) const
template<class F>
Vector<F> concepts::Vector< F >::operator+ ( c) const
template<class F>
virtual Function<F>& concepts::Vector< F >::operator+= ( const Function< F > &  fnc) [virtual]

Addition operator.

Reimplemented from concepts::Function< F >.

template<class F>
virtual Function<F>& concepts::Vector< F >::operator+= ( c) [virtual]

Addition operator.

Reimplemented from concepts::Function< F >.

template<class F>
Vector<F> concepts::Vector< F >::operator- ( c) const
template<class F>
Vector<F> concepts::Vector< F >::operator- ( const Function< F > &  fnc) const
template<class F>
virtual Function<F>& concepts::Vector< F >::operator-= ( const Function< F > &  fnc) [virtual]

Subtraction operator.

Reimplemented from concepts::Function< F >.

template<class F>
virtual Function<F>& concepts::Vector< F >::operator-= ( c) [virtual]

Subtraction operator.

Reimplemented from concepts::Function< F >.

template<class F >
template<class H >
Function< F > & concepts::Vector< F >::operator= ( const Function< H > &  fnc)

Definition at line 280 of file vector.hh.

template<class F>
Vector<F>& concepts::Vector< F >::operator= ( c)

Assignement operator.

template<class F>
Vector<F>& concepts::Vector< F >::operator= ( const Vector< F > &  fnc)

Assignement operator.

template<class F>
virtual Function<F>& concepts::Vector< F >::operator= ( const Function< F > &  fnc) [virtual]

Assignment operator.

Implements concepts::Function< F >.

template<class F>
int concepts::Vector< F >::size ( ) [inline]

Definition at line 145 of file vector.hh.

template<class F>
void concepts::Vector< F >::storeMatlab ( const char *  filename,
const char *  name = 0,
bool  append = false 
) const

Stores the vector in a Matlab sparse matrix.

template<class F>
const Vector<F>& concepts::Vector< F >::write ( const std::string &  fname) const

Writes the vector to a file.

This should be endian proof.

Parameters:
fnameFilename

Member Data Documentation

template<class F>
Array<F> concepts::Vector< F >::data_ [protected]

Vector data.

Definition at line 225 of file vector.hh.

template<class F>
const uint concepts::Function< F >::dim_ [protected, inherited]

Dimension of the function (or of the space the function is defined)

Definition at line 54 of file basis.hh.

template<class F>
uint concepts::Vector< F >::storeMatlabCounter_ [static, private]

Counts number of Matlab outputs (used to uniquely name the vectors)

Definition at line 230 of file vector.hh.

template<class F>
F* concepts::Vector< F >::v_ [private]

Pointer to the vector data.

Definition at line 228 of file vector.hh.


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

Home | Doxygen Documentation | Tutorials | Developer Tools (restricted)