dune-common  2.5.0
Public Types | Public Member Functions | Static Public Member Functions | Related Functions | List of all members
Dune::FieldVector< K, SIZE > Class Template Reference

vector space out of a tensor product of fields. More...

#include <dune/common/densematrix.hh>

Inheritance diagram for Dune::FieldVector< K, SIZE >:
Inheritance graph

Public Types

enum  { dimension = SIZE }
 export size More...
 
typedef Base::size_type size_type
 
typedef Base::value_type value_type
 
typedef value_typereference
 The type used for references to the vector entry. More...
 
typedef const value_typeconst_reference
 The type used for const references to the vector entry. More...
 
enum  
 We are at the leaf of the block recursion. More...
 
typedef Traits::derived_type derived_type
 type of derived vector class More...
 
typedef Traits::value_type field_type
 export the type representing the field More...
 
typedef Traits::value_type block_type
 export the type representing the components More...
 
typedef DenseIterator< DenseVector, value_typeIterator
 Iterator class for sequential access. More...
 
typedef Iterator iterator
 typedef for stl compliant access More...
 
typedef DenseIterator< const DenseVector, const value_typeConstIterator
 ConstIterator class for sequential access. More...
 
typedef ConstIterator const_iterator
 typedef for stl compliant access More...
 

Public Member Functions

constexpr FieldVector ()
 Constructor making default-initialized vector. More...
 
 FieldVector (const K &t)
 Constructor making vector with identical coordinates. More...
 
 FieldVector (const FieldVector &x)
 Copy constructor. More...
 
 FieldVector (std::initializer_list< K > const &l)
 Construct from a std::initializer_list. More...
 
template<class C >
 FieldVector (const DenseVector< C > &x, typename std::enable_if< IsFieldVectorSizeCorrect< C, SIZE >::value >::type *dummy=0)
 Copy constructor from a second vector of possibly different type. More...
 
template<class K1 , int SIZE1>
 FieldVector (const FieldVector< K1, SIZE1 > &x)
 Constructor making vector with identical coordinates. More...
 
K & operator[] (size_type i)
 
const K & operator[] (size_type i) const
 
size_type size () const
 size method More...
 
Iterator begin ()
 begin iterator More...
 
ConstIterator begin () const
 begin ConstIterator More...
 
Iterator end ()
 end iterator More...
 
ConstIterator end () const
 end ConstIterator More...
 
Iterator beforeEnd ()
 
ConstIterator beforeEnd () const
 
Iterator beforeBegin ()
 
ConstIterator beforeBegin () const
 
Iterator find (size_type i)
 return iterator to given element or end() More...
 
ConstIterator find (size_type i) const
 return iterator to given element or end() More...
 
derived_typeoperator+= (const DenseVector< Other > &y)
 vector space addition More...
 
std::enable_if< std::is_convertible< ValueType, value_type >::value, derived_type >::type & operator+= (const ValueType &kk)
 vector space add scalar to all comps More...
 
derived_typeoperator-= (const DenseVector< Other > &y)
 vector space subtraction More...
 
std::enable_if< std::is_convertible< ValueType, value_type >::value, derived_type >::type & operator-= (const ValueType &kk)
 vector space subtract scalar from all comps More...
 
derived_type operator+ (const DenseVector< Other > &b) const
 Binary vector addition. More...
 
derived_type operator- (const DenseVector< Other > &b) const
 Binary vector subtraction. More...
 
std::enable_if< std::is_convertible< ValueType, value_type >::value, derived_type >::type & operator*= (const ValueType &kk)
 vector space multiplication with scalar More...
 
std::enable_if< std::is_convertible< ValueType, value_type >::value, derived_type >::type & operator/= (const ValueType &kk)
 vector space division by scalar More...
 
bool operator== (const DenseVector< Other > &y) const
 Binary vector comparison. More...
 
bool operator!= (const DenseVector< Other > &y) const
 Binary vector incomparison. More...
 
derived_typeaxpy (const value_type &a, const DenseVector< Other > &y)
 vector space axpy operation ( *this += a y ) More...
 
PromotionTraits< field_type, typename DenseVector< Other >::field_type >::PromotedType operator* (const DenseVector< Other > &y) const
 indefinite vector dot product $\left (x^T \cdot y \right)$ which corresponds to Petsc's VecTDot More...
 
PromotionTraits< field_type, typename DenseVector< Other >::field_type >::PromotedType dot (const DenseVector< Other > &y) const
 vector dot product $\left (x^H \cdot y \right)$ which corresponds to Petsc's VecDot More...
 
FieldTraits< value_type >::real_type one_norm () const
 one norm (sum over absolute values of entries) More...
 
FieldTraits< value_type >::real_type one_norm_real () const
 simplified one norm (uses Manhattan norm for complex values) More...
 
FieldTraits< value_type >::real_type two_norm () const
 two norm sqrt(sum over squared values of entries) More...
 
FieldTraits< value_type >::real_type two_norm2 () const
 square of two norm (sum over squared values of entries), need for block recursion More...
 
FieldTraits< vt >::real_type infinity_norm () const
 infinity norm (maximum of absolute values of entries) More...
 
FieldTraits< vt >::real_type infinity_norm () const
 infinity norm (maximum of absolute values of entries) More...
 
FieldTraits< vt >::real_type infinity_norm_real () const
 simplified infinity norm (uses Manhattan norm for complex values) More...
 
FieldTraits< vt >::real_type infinity_norm_real () const
 simplified infinity norm (uses Manhattan norm for complex values) More...
 
size_type N () const
 number of blocks in the vector (are of size 1 here) More...
 
size_type dim () const
 dimension of the vector space More...
 

Static Public Member Functions

static constexpr size_type size ()
 

Related Functions

(Note that these are not member functions.)

template<class K , int SIZE>
std::istream & operator>> (std::istream &in, FieldVector< K, SIZE > &v)
 Read a FieldVector from an input stream. More...
 
std::ostream & operator<< (std::ostream &s, const DenseVector< FieldVector< K, SIZE > > &v)
 Write a DenseVector to an output stream. More...
 

Detailed Description

template<class K, int SIZE>
class Dune::FieldVector< K, SIZE >

vector space out of a tensor product of fields.

Template Parameters
Kthe field type (use float, double, complex, etc)
SIZEnumber of components.

Member Typedef Documentation

§ block_type

typedef Traits::value_type Dune::DenseVector< FieldVector< K, SIZE > >::block_type
inherited

export the type representing the components

§ const_iterator

typedef ConstIterator Dune::DenseVector< FieldVector< K, SIZE > >::const_iterator
inherited

typedef for stl compliant access

§ const_reference

template<class K, int SIZE>
typedef const value_type& Dune::FieldVector< K, SIZE >::const_reference

The type used for const references to the vector entry.

§ ConstIterator

typedef DenseIterator<const DenseVector,const value_type> Dune::DenseVector< FieldVector< K, SIZE > >::ConstIterator
inherited

ConstIterator class for sequential access.

§ derived_type

type of derived vector class

§ field_type

typedef Traits::value_type Dune::DenseVector< FieldVector< K, SIZE > >::field_type
inherited

export the type representing the field

§ Iterator

Iterator class for sequential access.

§ iterator

typedef Iterator Dune::DenseVector< FieldVector< K, SIZE > >::iterator
inherited

typedef for stl compliant access

§ reference

template<class K, int SIZE>
typedef value_type& Dune::FieldVector< K, SIZE >::reference

The type used for references to the vector entry.

§ size_type

template<class K, int SIZE>
typedef Base::size_type Dune::FieldVector< K, SIZE >::size_type

§ value_type

template<class K, int SIZE>
typedef Base::value_type Dune::FieldVector< K, SIZE >::value_type

Member Enumeration Documentation

§ anonymous enum

template<class K, int SIZE>
anonymous enum

export size

Enumerator
dimension 

The size of this vector.

§ anonymous enum

anonymous enum
inherited

We are at the leaf of the block recursion.

Constructor & Destructor Documentation

§ FieldVector() [1/6]

template<class K, int SIZE>
constexpr Dune::FieldVector< K, SIZE >::FieldVector ( )
inline

Constructor making default-initialized vector.

§ FieldVector() [2/6]

template<class K, int SIZE>
Dune::FieldVector< K, SIZE >::FieldVector ( const K &  t)
inlineexplicit

Constructor making vector with identical coordinates.

§ FieldVector() [3/6]

template<class K, int SIZE>
Dune::FieldVector< K, SIZE >::FieldVector ( const FieldVector< K, SIZE > &  x)
inline

Copy constructor.

§ FieldVector() [4/6]

template<class K, int SIZE>
Dune::FieldVector< K, SIZE >::FieldVector ( std::initializer_list< K > const &  l)
inline

Construct from a std::initializer_list.

§ FieldVector() [5/6]

template<class K, int SIZE>
template<class C >
Dune::FieldVector< K, SIZE >::FieldVector ( const DenseVector< C > &  x,
typename std::enable_if< IsFieldVectorSizeCorrect< C, SIZE >::value >::type *  dummy = 0 
)
inline

Copy constructor from a second vector of possibly different type.

If the DenseVector type of the this constructor's argument is implemented by a FieldVector, it is statically checked if it has the correct size. If this is not the case the constructor is removed from the overload set using SFINAE.

Parameters
[in]xA DenseVector with correct size.
[in]dummyA void* dummy argument needed by SFINAE.

§ FieldVector() [6/6]

template<class K, int SIZE>
template<class K1 , int SIZE1>
Dune::FieldVector< K, SIZE >::FieldVector ( const FieldVector< K1, SIZE1 > &  x)
inlineexplicit

Constructor making vector with identical coordinates.

Member Function Documentation

§ axpy()

derived_type& Dune::DenseVector< FieldVector< K, SIZE > >::axpy ( const value_type a,
const DenseVector< Other > &  y 
)
inlineinherited

vector space axpy operation ( *this += a y )

§ beforeBegin() [1/2]

Iterator Dune::DenseVector< FieldVector< K, SIZE > >::beforeBegin ( )
inlineinherited
Returns
an iterator that is positioned before the first entry of the vector.

§ beforeBegin() [2/2]

ConstIterator Dune::DenseVector< FieldVector< K, SIZE > >::beforeBegin ( ) const
inlineinherited
Returns
an iterator that is positioned before the first entry of the vector.

§ beforeEnd() [1/2]

Iterator Dune::DenseVector< FieldVector< K, SIZE > >::beforeEnd ( )
inlineinherited
Returns
an iterator that is positioned before the end iterator of the vector, i.e. at the last entry.

§ beforeEnd() [2/2]

ConstIterator Dune::DenseVector< FieldVector< K, SIZE > >::beforeEnd ( ) const
inlineinherited
Returns
an iterator that is positioned before the end iterator of the vector. i.e. at the last element

§ begin() [1/2]

Iterator Dune::DenseVector< FieldVector< K, SIZE > >::begin ( )
inlineinherited

begin iterator

§ begin() [2/2]

ConstIterator Dune::DenseVector< FieldVector< K, SIZE > >::begin ( ) const
inlineinherited

begin ConstIterator

§ dim()

size_type Dune::DenseVector< FieldVector< K, SIZE > >::dim ( ) const
inlineinherited

dimension of the vector space

§ dot()

PromotionTraits<field_type,typename DenseVector<Other>::field_type>::PromotedType Dune::DenseVector< FieldVector< K, SIZE > >::dot ( const DenseVector< Other > &  y) const
inlineinherited

vector dot product $\left (x^H \cdot y \right)$ which corresponds to Petsc's VecDot

http://www.mcs.anl.gov/petsc/petsc-current/docs/manualpages/Vec/VecDot.html

Parameters
yother vector
Returns

§ end() [1/2]

Iterator Dune::DenseVector< FieldVector< K, SIZE > >::end ( )
inlineinherited

end iterator

§ end() [2/2]

ConstIterator Dune::DenseVector< FieldVector< K, SIZE > >::end ( ) const
inlineinherited

end ConstIterator

§ find() [1/2]

Iterator Dune::DenseVector< FieldVector< K, SIZE > >::find ( size_type  i)
inlineinherited

return iterator to given element or end()

§ find() [2/2]

ConstIterator Dune::DenseVector< FieldVector< K, SIZE > >::find ( size_type  i) const
inlineinherited

return iterator to given element or end()

§ infinity_norm() [1/2]

FieldTraits<vt>::real_type Dune::DenseVector< FieldVector< K, SIZE > >::infinity_norm ( ) const
inlineinherited

infinity norm (maximum of absolute values of entries)

§ infinity_norm() [2/2]

FieldTraits<vt>::real_type Dune::DenseVector< FieldVector< K, SIZE > >::infinity_norm ( ) const
inlineinherited

infinity norm (maximum of absolute values of entries)

§ infinity_norm_real() [1/2]

FieldTraits<vt>::real_type Dune::DenseVector< FieldVector< K, SIZE > >::infinity_norm_real ( ) const
inlineinherited

simplified infinity norm (uses Manhattan norm for complex values)

§ infinity_norm_real() [2/2]

FieldTraits<vt>::real_type Dune::DenseVector< FieldVector< K, SIZE > >::infinity_norm_real ( ) const
inlineinherited

simplified infinity norm (uses Manhattan norm for complex values)

§ N()

size_type Dune::DenseVector< FieldVector< K, SIZE > >::N ( ) const
inlineinherited

number of blocks in the vector (are of size 1 here)

§ one_norm()

FieldTraits<value_type>::real_type Dune::DenseVector< FieldVector< K, SIZE > >::one_norm ( ) const
inlineinherited

one norm (sum over absolute values of entries)

§ one_norm_real()

FieldTraits<value_type>::real_type Dune::DenseVector< FieldVector< K, SIZE > >::one_norm_real ( ) const
inlineinherited

simplified one norm (uses Manhattan norm for complex values)

§ operator!=()

bool Dune::DenseVector< FieldVector< K, SIZE > >::operator!= ( const DenseVector< Other > &  y) const
inlineinherited

Binary vector incomparison.

§ operator*()

PromotionTraits<field_type,typename DenseVector<Other>::field_type>::PromotedType Dune::DenseVector< FieldVector< K, SIZE > >::operator* ( const DenseVector< Other > &  y) const
inlineinherited

indefinite vector dot product $\left (x^T \cdot y \right)$ which corresponds to Petsc's VecTDot

http://www.mcs.anl.gov/petsc/petsc-current/docs/manualpages/Vec/VecTDot.html

Parameters
yother vector
Returns

§ operator*=()

std::enable_if< std::is_convertible<ValueType, value_type>::value, derived_type >::type& Dune::DenseVector< FieldVector< K, SIZE > >::operator*= ( const ValueType &  kk)
inlineinherited

vector space multiplication with scalar

we use enable_if to avoid an ambiguity, if the function parameter can be converted to value_type implicitly. (see FS#1457)

The function is only enabled, if the parameter is directly convertible to value_type.

§ operator+()

derived_type Dune::DenseVector< FieldVector< K, SIZE > >::operator+ ( const DenseVector< Other > &  b) const
inlineinherited

Binary vector addition.

§ operator+=() [1/2]

derived_type& Dune::DenseVector< FieldVector< K, SIZE > >::operator+= ( const DenseVector< Other > &  y)
inlineinherited

vector space addition

§ operator+=() [2/2]

std::enable_if< std::is_convertible<ValueType, value_type>::value, derived_type >::type& Dune::DenseVector< FieldVector< K, SIZE > >::operator+= ( const ValueType &  kk)
inlineinherited

vector space add scalar to all comps

we use enable_if to avoid an ambiguity, if the function parameter can be converted to value_type implicitly. (see FS#1457)

The function is only enabled, if the parameter is directly convertible to value_type.

§ operator-()

derived_type Dune::DenseVector< FieldVector< K, SIZE > >::operator- ( const DenseVector< Other > &  b) const
inlineinherited

Binary vector subtraction.

§ operator-=() [1/2]

derived_type& Dune::DenseVector< FieldVector< K, SIZE > >::operator-= ( const DenseVector< Other > &  y)
inlineinherited

vector space subtraction

§ operator-=() [2/2]

std::enable_if< std::is_convertible<ValueType, value_type>::value, derived_type >::type& Dune::DenseVector< FieldVector< K, SIZE > >::operator-= ( const ValueType &  kk)
inlineinherited

vector space subtract scalar from all comps

we use enable_if to avoid an ambiguity, if the function parameter can be converted to value_type implicitly. (see FS#1457)

The function is only enabled, if the parameter is directly convertible to value_type.

§ operator/=()

std::enable_if< std::is_convertible<ValueType, value_type>::value, derived_type >::type& Dune::DenseVector< FieldVector< K, SIZE > >::operator/= ( const ValueType &  kk)
inlineinherited

vector space division by scalar

we use enable_if to avoid an ambiguity, if the function parameter can be converted to value_type implicitly. (see FS#1457)

The function is only enabled, if the parameter is directly convertible to value_type.

§ operator==()

bool Dune::DenseVector< FieldVector< K, SIZE > >::operator== ( const DenseVector< Other > &  y) const
inlineinherited

Binary vector comparison.

§ operator[]() [1/2]

template<class K, int SIZE>
K& Dune::FieldVector< K, SIZE >::operator[] ( size_type  i)
inline

§ operator[]() [2/2]

template<class K, int SIZE>
const K& Dune::FieldVector< K, SIZE >::operator[] ( size_type  i) const
inline

§ size() [1/2]

template<class K, int SIZE>
static constexpr size_type Dune::FieldVector< K, SIZE >::size ( )
inlinestatic

§ size() [2/2]

size_type Dune::DenseVector< FieldVector< K, SIZE > >::size ( ) const
inlineinherited

size method

§ two_norm()

FieldTraits<value_type>::real_type Dune::DenseVector< FieldVector< K, SIZE > >::two_norm ( ) const
inlineinherited

two norm sqrt(sum over squared values of entries)

§ two_norm2()

FieldTraits<value_type>::real_type Dune::DenseVector< FieldVector< K, SIZE > >::two_norm2 ( ) const
inlineinherited

square of two norm (sum over squared values of entries), need for block recursion

Friends And Related Function Documentation

§ operator<<()

std::ostream & operator<< ( std::ostream &  s,
const DenseVector< FieldVector< K, SIZE > > &  v 
)
related

Write a DenseVector to an output stream.

Parameters
[in]sstd :: ostream to write to
[in]vDenseVector to write
Returns
the output stream (s)

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