dune-common  2.11
Public Types | Public Member Functions | Static Public Attributes | 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

using size_type = typename Base::size_type
 The type used for the index access and size operation. More...
 
using value_type = typename Base::value_type
 The type of the elements stored in the vector. More...
 
using reference = value_type &
 The type used for references to the vector entries. More...
 
using const_reference = const value_type &
 The type used for const references to the vector entries. More...
 
typedef Traits::derived_type derived_type
 type of derived vector class More...
 
typedef FieldTraits< value_type >::field_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 () noexcept(std::is_nothrow_default_constructible_v< K >)
 Default constructor, making value-initialized vector with all components set to zero. More...
 
 explicit (SIZE !=1) const expr FieldVector(const value_type &value) noexcept
 Constructor with a given value initializing all entries to this value. More...
 
template<Concept::Number S>
 requires (std::constructible_from< K, S >) explicit(SIZE !
 Constructor with a given scalar initializing all entries to this value. More...
 
template<class V >
 requires (IsFieldVectorSizeCorrect< V, SIZE >::value &&std::is_assignable_v< K &, decltype(std::declval< const V &>()[0])>) const expr FieldVector &operator
 Assignment from another dense vector. More...
 
constexpr value_typeoperator[] (size_type i)
 random access More...
 
constexpr const value_typeoperator[] (size_type i) const
 
constexpr value_typefront ()
 return reference to first element More...
 
constexpr const value_typefront () const
 return reference to first element More...
 
constexpr value_typeback ()
 return reference to last element More...
 
constexpr const value_typeback () const
 return reference to last element More...
 
constexpr bool empty () const
 checks whether the container is empty More...
 
constexpr size_type size () const
 size method More...
 
constexpr Iterator begin ()
 begin iterator More...
 
constexpr ConstIterator begin () const
 begin ConstIterator More...
 
constexpr Iterator end ()
 end iterator More...
 
constexpr ConstIterator end () const
 end ConstIterator More...
 
constexpr Iterator beforeEnd ()
 
constexpr ConstIterator beforeEnd () const
 
constexpr Iterator beforeBegin ()
 
constexpr ConstIterator beforeBegin () const
 
constexpr Iterator find (size_type i)
 return iterator to given element or end() More...
 
constexpr ConstIterator find (size_type i) const
 return iterator to given element or end() More...
 
constexpr derived_typeoperator+= (const DenseVector< Other > &x)
 vector space addition More...
 
constexpr 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...
 
constexpr derived_typeoperator-= (const DenseVector< Other > &x)
 vector space subtraction More...
 
constexpr 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...
 
constexpr derived_type operator+ (const DenseVector< Other > &b) const
 Binary vector addition. More...
 
constexpr derived_type operator- (const DenseVector< Other > &b) const
 Binary vector subtraction. More...
 
constexpr derived_type operator- () const
 Vector negation. More...
 
constexpr std::enable_if< std::is_convertible< FieldType, field_type >::value, derived_type >::type & operator*= (const FieldType &kk)
 vector space multiplication with scalar More...
 
constexpr std::enable_if< std::is_convertible< FieldType, field_type >::value, derived_type >::type & operator/= (const FieldType &kk)
 vector space division by scalar More...
 
constexpr bool operator== (const DenseVector< Other > &x) const
 Binary vector comparison. More...
 
constexpr bool operator!= (const DenseVector< Other > &x) const
 Binary vector incomparison. More...
 
constexpr derived_typeaxpy (const field_type &a, const DenseVector< Other > &x)
 vector space axpy operation ( *this += a x ) More...
 
constexpr PromotionTraits< field_type, typename DenseVector< Other >::field_type >::PromotedType operator* (const DenseVector< Other > &x) const
 indefinite vector dot product $\left (x^T \cdot y \right)$ which corresponds to Petsc's VecTDot More...
 
constexpr PromotionTraits< field_type, typename DenseVector< Other >::field_type >::PromotedType dot (const DenseVector< Other > &x) const
 vector dot product $\left (x^H \cdot y \right)$ which corresponds to Petsc's VecDot More...
 
constexpr FieldTraits< value_type >::real_type one_norm () const
 one norm (sum over absolute values of entries) More...
 
constexpr FieldTraits< value_type >::real_type one_norm_real () const
 simplified one norm (uses Manhattan norm for complex values) More...
 
constexpr FieldTraits< value_type >::real_type two_norm () const
 two norm sqrt(sum over squared values of entries) More...
 
constexpr FieldTraits< value_type >::real_type two_norm2 () const
 square of two norm (sum over squared values of entries), need for block recursion More...
 
constexpr FieldTraits< vt >::real_type infinity_norm () const
 infinity norm (maximum of absolute values of entries) More...
 
constexpr FieldTraits< vt >::real_type infinity_norm () const
 infinity norm (maximum of absolute values of entries) More...
 
constexpr FieldTraits< vt >::real_type infinity_norm_real () const
 simplified infinity norm (uses Manhattan norm for complex values) More...
 
constexpr FieldTraits< vt >::real_type infinity_norm_real () const
 simplified infinity norm (uses Manhattan norm for complex values) More...
 
constexpr size_type N () const
 number of blocks in the vector (are of size 1 here) More...
 
constexpr size_type dim () const
 dimension of the vector space More...
 
Element access
constexpr reference operator[] (size_type i)
 Return a reference to the ith element. More...
 
constexpr const_reference operator[] (size_type i) const
 Return a (const) reference to the ith element. More...
 
constexpr K * data () noexcept
 Return pointer to underlying array. More...
 
constexpr const K * data () const noexcept
 Return pointer to underlying array. More...
 

Static Public Member Functions

Capacity
static constexpr size_type size () noexcept
 Obtain the number of elements stored in the vector. More...
 

Static Public Attributes

static constexpr int dimension = SIZE
 The size of this vector. More...
 
static constexpr int blocklevel
 The number of block levels we contain. This is the leaf, that is, 1. More...
 

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>
using Dune::FieldVector< K, SIZE >::const_reference = const value_type&

The type used for const references to the vector entries.

◆ 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

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>
using Dune::FieldVector< K, SIZE >::reference = value_type&

The type used for references to the vector entries.

◆ size_type

template<class K, int SIZE>
using Dune::FieldVector< K, SIZE >::size_type = typename Base::size_type

The type used for the index access and size operation.

◆ value_type

template<class K, int SIZE>
using Dune::FieldVector< K, SIZE >::value_type = typename Base::value_type

The type of the elements stored in the vector.

Constructor & Destructor Documentation

◆ FieldVector()

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

Default constructor, making value-initialized vector with all components set to zero.

Member Function Documentation

◆ axpy()

constexpr derived_type& Dune::DenseVector< FieldVector< K, SIZE > >::axpy ( const field_type a,
const DenseVector< Other > &  x 
)
inlineinherited

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

◆ back() [1/2]

constexpr value_type& Dune::DenseVector< FieldVector< K, SIZE > >::back ( )
inlineinherited

return reference to last element

◆ back() [2/2]

constexpr const value_type& Dune::DenseVector< FieldVector< K, SIZE > >::back ( ) const
inlineinherited

return reference to last element

◆ beforeBegin() [1/2]

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

◆ beforeBegin() [2/2]

constexpr 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]

constexpr 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]

constexpr 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]

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

begin iterator

◆ begin() [2/2]

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

begin ConstIterator

◆ data() [1/2]

template<class K, int SIZE>
constexpr K* Dune::FieldVector< K, SIZE >::data ( )
inlinenoexcept

Return pointer to underlying array.

◆ data() [2/2]

template<class K, int SIZE>
constexpr const K* Dune::FieldVector< K, SIZE >::data ( ) const
inlinenoexcept

Return pointer to underlying array.

◆ dim()

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

dimension of the vector space

◆ dot()

constexpr PromotionTraits<field_type,typename DenseVector<Other>::field_type>::PromotedType Dune::DenseVector< FieldVector< K, SIZE > >::dot ( const DenseVector< Other > &  x) 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
xother vector
Returns

◆ empty()

constexpr bool Dune::DenseVector< FieldVector< K, SIZE > >::empty ( ) const
inlineinherited

checks whether the container is empty

◆ end() [1/2]

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

end iterator

◆ end() [2/2]

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

end ConstIterator

◆ explicit()

template<class K, int SIZE>
Dune::FieldVector< K, SIZE >::explicit ( SIZE !  = 1) const &
inlinenoexcept

Constructor with a given value initializing all entries to this value.

◆ find() [1/2]

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

return iterator to given element or end()

◆ find() [2/2]

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

return iterator to given element or end()

◆ front() [1/2]

constexpr value_type& Dune::DenseVector< FieldVector< K, SIZE > >::front ( )
inlineinherited

return reference to first element

◆ front() [2/2]

constexpr const value_type& Dune::DenseVector< FieldVector< K, SIZE > >::front ( ) const
inlineinherited

return reference to first element

◆ infinity_norm() [1/2]

constexpr 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]

constexpr 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]

constexpr 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]

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

simplified infinity norm (uses Manhattan norm for complex values)

◆ N()

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

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

◆ one_norm()

constexpr 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()

constexpr 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!=()

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

Binary vector incomparison.

◆ operator*()

constexpr PromotionTraits<field_type,typename DenseVector<Other>::field_type>::PromotedType Dune::DenseVector< FieldVector< K, SIZE > >::operator* ( const DenseVector< Other > &  x) 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
xother vector
Returns

◆ operator*=()

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

vector space multiplication with scalar

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

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

◆ operator+()

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

Binary vector addition.

◆ operator+=() [1/2]

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

vector space addition

◆ operator+=() [2/2]

constexpr 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-() [1/2]

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

Binary vector subtraction.

◆ operator-() [2/2]

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

Vector negation.

◆ operator-=() [1/2]

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

vector space subtraction

◆ operator-=() [2/2]

constexpr 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/=()

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

vector space division by scalar

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

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

◆ operator==()

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

Binary vector comparison.

◆ operator[]() [1/4]

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

Return a reference to the ith element.

Exceptions
RangeErrorif index i is out of range [0,SIZE) (only checked if DUNE_CHECK_BOUNDS is defined).

◆ operator[]() [2/4]

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

Return a (const) reference to the ith element.

Exceptions
RangeErrorif index i is out of range [0,SIZE) (only checked if DUNE_CHECK_BOUNDS is defined).

◆ operator[]() [3/4]

constexpr value_type& Dune::DenseVector< FieldVector< K, SIZE > >::operator[] ( size_type  i)
inlineinherited

random access

◆ operator[]() [4/4]

constexpr const value_type& Dune::DenseVector< FieldVector< K, SIZE > >::operator[] ( size_type  i) const
inlineinherited

◆ requires() [1/2]

template<class K, int SIZE>
template<Concept::Number S>
Dune::FieldVector< K, SIZE >::requires ( std::constructible_from< K, S >  )

Constructor with a given scalar initializing all entries to this value.

◆ requires() [2/2]

template<class K, int SIZE>
template<class V >
Dune::FieldVector< K, SIZE >::requires ( IsFieldVectorSizeCorrect< V, SIZE >::value &&std::is_assignable_v< K &, decltype(std::declval< const V &>()[0])>  ) const &

Assignment from another dense vector.

◆ size() [1/2]

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

Obtain the number of elements stored in the vector.

◆ size() [2/2]

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

size method

◆ two_norm()

constexpr 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()

constexpr 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)

Member Data Documentation

◆ blocklevel

constexpr int Dune::DenseVector< FieldVector< K, SIZE > >::blocklevel
staticinherited

The number of block levels we contain. This is the leaf, that is, 1.

◆ dimension

template<class K, int SIZE>
constexpr int Dune::FieldVector< K, SIZE >::dimension = SIZE
static

The size of this vector.


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