Loading web-font TeX/Main/Regular

Dune Core Modules (unstable)

Construct a vector with a dynamic size. More...

#include <dune/common/dynvector.hh>

Public Types

typedef Traits::derived_type derived_type
 type of derived vector class
 
typedef FieldTraits< value_type >::field_type field_type
 export the type representing the field
 
typedef Traits::value_type block_type
 export the type representing the components
 
typedef DenseIterator< DenseVector, value_type > Iterator
 Iterator class for sequential access.
 
typedef Iterator iterator
 typedef for stl compliant access
 
typedef DenseIterator< const DenseVector, const value_type > ConstIterator
 ConstIterator class for sequential access.
 
typedef ConstIterator const_iterator
 typedef for stl compliant access
 

Public Member Functions

 DynamicVector (const allocator_type &a=allocator_type())
 Constructor making uninitialized vector.
 
 DynamicVector (size_type n, value_type c, const allocator_type &a=allocator_type())
 Constructor making vector with identical coordinates.
 
 DynamicVector (std::initializer_list< K > const &l)
 Construct from a std::initializer_list.
 
 DynamicVector (const DynamicVector &x)
 Constructor making vector with identical coordinates.
 
 DynamicVector (DynamicVector &&x)
 Move constructor.
 
template<class X >
 DynamicVector (const DenseVector< X > &x, const allocator_type &a=allocator_type())
 Copy constructor from another DenseVector.
 
DynamicVectoroperator= (const DynamicVector &other)
 Copy assignment operator.
 
DynamicVectoroperator= (DynamicVector &&other)
 Move assignment operator.
 
size_type capacity () const
 Number of elements for which memory has been allocated. More...
 
K * data () noexcept
 return pointer to underlying array
 
const K * data () const noexcept
 return pointer to underlying array
 
constexpr derived_typeoperator= (const value_type &k)
 Assignment operator for scalar.
 
constexpr DenseVectoroperator= (const DenseVector &)=default
 Assignment operator for other DenseVector of same type.
 
template<typename W , std::enable_if_t< std::is_assignable< value_type &, typename DenseVector< W >::value_type >::value, int > = 0>
constexpr derived_typeoperator= (const DenseVector< W > &other)
 Assignment operator for other DenseVector of different type.
 
constexpr value_type & front ()
 return reference to first element
 
constexpr const value_type & front () const
 return reference to first element
 
constexpr value_type & back ()
 return reference to last element
 
constexpr const value_type & back () const
 return reference to last element
 
constexpr bool empty () const
 checks whether the container is empty
 
constexpr Iterator begin ()
 begin iterator
 
constexpr ConstIterator begin () const
 begin ConstIterator
 
constexpr Iterator end ()
 end iterator
 
constexpr ConstIterator end () const
 end ConstIterator
 
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()
 
constexpr ConstIterator find (size_type i) const
 return iterator to given element or end()
 
constexpr derived_typeoperator+= (const DenseVector< Other > &x)
 vector space addition
 
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
 
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.
 
constexpr derived_type operator- (const DenseVector< Other > &b) const
 Binary vector subtraction.
 
constexpr derived_type operator- () const
 Vector negation.
 
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.
 
constexpr bool operator!= (const DenseVector< Other > &x) const
 Binary vector incomparison.
 
constexpr derived_typeaxpy (const field_type &a, const DenseVector< Other > &x)
 vector space axpy operation ( *this += a x )
 
constexpr PromotionTraits< field_type, typenameDenseVector< 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, typenameDenseVector< 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)
 
constexpr FieldTraits< value_type >::real_type one_norm_real () const
 simplified one norm (uses Manhattan norm for complex values)
 
constexpr FieldTraits< value_type >::real_type two_norm () const
 two norm sqrt(sum over squared values of entries)
 
constexpr FieldTraits< value_type >::real_type two_norm2 () const
 square of two norm (sum over squared values of entries), need for block recursion
 
constexpr FieldTraits< vt >::real_type infinity_norm () const
 infinity norm (maximum of absolute values of entries)
 
constexpr FieldTraits< vt >::real_type infinity_norm () const
 infinity norm (maximum of absolute values of entries)
 
constexpr FieldTraits< vt >::real_type infinity_norm_real () const
 simplified infinity norm (uses Manhattan norm for complex values)
 
constexpr FieldTraits< vt >::real_type infinity_norm_real () const
 simplified infinity norm (uses Manhattan norm for complex values)
 
constexpr size_type N () const
 number of blocks in the vector (are of size 1 here)
 
constexpr size_type dim () const
 dimension of the vector space
 

Static Public Attributes

static constexpr int blocklevel
 The number of block levels we contain. This is the leaf, that is, 1.
 

Related Functions

(Note that these are not member functions.)

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

Detailed Description

template<class K, class Allocator = std::allocator< K >>
class Dune::DynamicVector< K, Allocator >

Construct a vector with a dynamic size.

Template Parameters
Kis the field type (use float, double, complex, etc)
Allocatortype of allocator object used to define the storage allocation model, default Allocator = std::allocator< K >.

Member Function Documentation

◆ beforeBegin() [1/2]

constexpr Iterator Dune::DenseVector< DynamicVector< K, std::allocator< K > > >::beforeBegin ( )
inlineconstexprinherited
Returns
an iterator that is positioned before the first entry of the vector.

◆ beforeBegin() [2/2]

constexpr ConstIterator Dune::DenseVector< DynamicVector< K, std::allocator< K > > >::beforeBegin ( ) const
inlineconstexprinherited
Returns
an iterator that is positioned before the first entry of the vector.

◆ beforeEnd() [1/2]

constexpr Iterator Dune::DenseVector< DynamicVector< K, std::allocator< K > > >::beforeEnd ( )
inlineconstexprinherited
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< DynamicVector< K, std::allocator< K > > >::beforeEnd ( ) const
inlineconstexprinherited
Returns
an iterator that is positioned before the end iterator of the vector. i.e. at the last element

◆ capacity()

template<class K , class Allocator = std::allocator< K >>
size_type Dune::DynamicVector< K, Allocator >::capacity ( ) const
inline

Number of elements for which memory has been allocated.

capacity() is always greater than or equal to size().

◆ dot()

constexpr PromotionTraits< field_type, typenameDenseVector< Other >::field_type >::PromotedType Dune::DenseVector< DynamicVector< K, std::allocator< K > > >::dot ( const DenseVector< Other > &  x) const
inlineconstexprinherited

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

◆ operator*()

constexpr PromotionTraits< field_type, typenameDenseVector< Other >::field_type >::PromotedType Dune::DenseVector< DynamicVector< K, std::allocator< K > > >::operator* ( const DenseVector< Other > &  x) const
inlineconstexprinherited

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< DynamicVector< K, std::allocator< K > > >::operator*= ( const FieldType &  kk)
inlineconstexprinherited

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 std::enable_if< std::is_convertible< ValueType, value_type >::value, derived_type >::type & Dune::DenseVector< DynamicVector< K, std::allocator< K > > >::operator+= ( const ValueType &  kk)
inlineconstexprinherited

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

constexpr std::enable_if< std::is_convertible< ValueType, value_type >::value, derived_type >::type & Dune::DenseVector< DynamicVector< K, std::allocator< K > > >::operator-= ( const ValueType &  kk)
inlineconstexprinherited

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< DynamicVector< K, std::allocator< K > > >::operator/= ( const FieldType &  kk)
inlineconstexprinherited

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.

Friends And Related Function Documentation

◆ operator<<()

std::ostream & operator<< ( std::ostream &  s,
const DenseVector< DynamicVector< K, std::allocator< K > > > &  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 file:
Creative Commons License   |  Legal Statements / Impressum  |  Hosted by TU Dresden & Uni Heidelberg  |  generated with Hugo v0.111.3 (Mar 12, 23:28, 2025)