dune-common  2.4.1
Public Types | Public Member Functions | Related Functions | List of all members
Dune::DynamicVector< K, Allocator > Class Template Reference

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

#include <dune/common/dynvector.hh>

Inheritance diagram for Dune::DynamicVector< K, Allocator >:
Inheritance graph

Public Types

typedef Base::size_type size_type
 
typedef Base::value_type value_type
 
typedef Allocator allocator_type
 
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_type
Iterator
 Iterator class for sequential access. More...
 
typedef Iterator iterator
 typedef for stl compliant access More...
 
typedef DenseIterator< const
DenseVector, const value_type
ConstIterator
 ConstIterator class for sequential access. More...
 
typedef ConstIterator const_iterator
 typedef for stl compliant access More...
 

Public Member Functions

 DynamicVector (const allocator_type &a=allocator_type())
 Constructor making uninitialized vector. More...
 
 DynamicVector (size_type n, const allocator_type &a=allocator_type())
 
 DynamicVector (size_type n, value_type c, const allocator_type &a=allocator_type())
 Constructor making vector with identical coordinates. More...
 
 DynamicVector (const DynamicVector &x)
 Constructor making vector with identical coordinates. More...
 
 DynamicVector (DynamicVector &&x)
 Move constructor. More...
 
template<class T >
 DynamicVector (const DynamicVector< T, Allocator > &x)
 
template<class X >
 DynamicVector (const DenseVector< X > &x, const allocator_type &a=allocator_type())
 Copy constructor from another DenseVector. More...
 
DynamicVectoroperator= (const DynamicVector &other)
 Copy assignment operator. More...
 
DynamicVectoroperator= (DynamicVector &&other)
 Move assignment operator. More...
 
size_type capacity () const
 Number of elements for which memory has been allocated. More...
 
void resize (size_type n, value_type c=value_type())
 
void reserve (size_type n)
 
size_type vec_size () const
 
K & vec_access (size_type i)
 
const K & vec_access (size_type i) const
 
value_typeoperator[] (size_type i)
 random access More...
 
const value_typeoperator[] (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< value_type >
::real_type 
infinity_norm () const
 infinity norm (maximum of absolute values of entries) More...
 
FieldTraits< value_type >
::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...
 

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...
 

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 Typedef Documentation

template<class K, class Allocator = std::allocator< K >>
typedef Allocator Dune::DynamicVector< K, Allocator >::allocator_type
typedef Traits::value_type Dune::DenseVector< DynamicVector< K, Allocator > >::block_type
inherited

export the type representing the components

typedef ConstIterator Dune::DenseVector< DynamicVector< K, Allocator > >::const_iterator
inherited

typedef for stl compliant access

typedef DenseIterator<const DenseVector,const value_type> Dune::DenseVector< DynamicVector< K, Allocator > >::ConstIterator
inherited

ConstIterator class for sequential access.

typedef Traits::derived_type Dune::DenseVector< DynamicVector< K, Allocator > >::derived_type
inherited

type of derived vector class

typedef Traits::value_type Dune::DenseVector< DynamicVector< K, Allocator > >::field_type
inherited

export the type representing the field

Iterator class for sequential access.

typedef Iterator Dune::DenseVector< DynamicVector< K, Allocator > >::iterator
inherited

typedef for stl compliant access

template<class K, class Allocator = std::allocator< K >>
typedef Base::size_type Dune::DynamicVector< K, Allocator >::size_type
template<class K, class Allocator = std::allocator< K >>
typedef Base::value_type Dune::DynamicVector< K, Allocator >::value_type

Member Enumeration Documentation

anonymous enum
inherited

We are at the leaf of the block recursion.

Constructor & Destructor Documentation

template<class K, class Allocator = std::allocator< K >>
Dune::DynamicVector< K, Allocator >::DynamicVector ( const allocator_type a = allocator_type())
inlineexplicit

Constructor making uninitialized vector.

template<class K, class Allocator = std::allocator< K >>
Dune::DynamicVector< K, Allocator >::DynamicVector ( size_type  n,
const allocator_type a = allocator_type() 
)
inlineexplicit
template<class K, class Allocator = std::allocator< K >>
Dune::DynamicVector< K, Allocator >::DynamicVector ( size_type  n,
value_type  c,
const allocator_type a = allocator_type() 
)
inline

Constructor making vector with identical coordinates.

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

Constructor making vector with identical coordinates.

template<class K, class Allocator = std::allocator< K >>
Dune::DynamicVector< K, Allocator >::DynamicVector ( DynamicVector< K, Allocator > &&  x)
inline

Move constructor.

template<class K, class Allocator = std::allocator< K >>
template<class T >
Dune::DynamicVector< K, Allocator >::DynamicVector ( const DynamicVector< T, Allocator > &  x)
inline
template<class K, class Allocator = std::allocator< K >>
template<class X >
Dune::DynamicVector< K, Allocator >::DynamicVector ( const DenseVector< X > &  x,
const allocator_type a = allocator_type() 
)
inline

Copy constructor from another DenseVector.

Member Function Documentation

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

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

Iterator Dune::DenseVector< DynamicVector< K, Allocator > >::beforeBegin ( )
inlineinherited
Returns
an iterator that is positioned before the first entry of the vector.
ConstIterator Dune::DenseVector< DynamicVector< K, Allocator > >::beforeBegin ( ) const
inlineinherited
Returns
an iterator that is positioned before the first entry of the vector.
Iterator Dune::DenseVector< DynamicVector< K, Allocator > >::beforeEnd ( )
inlineinherited
Returns
an iterator that is positioned before the end iterator of the vector, i.e. at the last entry.
ConstIterator Dune::DenseVector< DynamicVector< K, Allocator > >::beforeEnd ( ) const
inlineinherited
Returns
an iterator that is positioned before the end iterator of the vector. i.e. at the last element
Iterator Dune::DenseVector< DynamicVector< K, Allocator > >::begin ( )
inlineinherited

begin iterator

ConstIterator Dune::DenseVector< DynamicVector< K, Allocator > >::begin ( ) const
inlineinherited

begin ConstIterator

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

size_type Dune::DenseVector< DynamicVector< K, Allocator > >::dim ( ) const
inlineinherited

dimension of the vector space

PromotionTraits<field_type,typename DenseVector<Other>::field_type>::PromotedType Dune::DenseVector< DynamicVector< K, Allocator > >::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
Iterator Dune::DenseVector< DynamicVector< K, Allocator > >::end ( )
inlineinherited

end iterator

ConstIterator Dune::DenseVector< DynamicVector< K, Allocator > >::end ( ) const
inlineinherited

end ConstIterator

Iterator Dune::DenseVector< DynamicVector< K, Allocator > >::find ( size_type  i)
inlineinherited

return iterator to given element or end()

ConstIterator Dune::DenseVector< DynamicVector< K, Allocator > >::find ( size_type  i) const
inlineinherited

return iterator to given element or end()

FieldTraits<value_type>::real_type Dune::DenseVector< DynamicVector< K, Allocator > >::infinity_norm ( ) const
inlineinherited

infinity norm (maximum of absolute values of entries)

FieldTraits<value_type>::real_type Dune::DenseVector< DynamicVector< K, Allocator > >::infinity_norm_real ( ) const
inlineinherited

simplified infinity norm (uses Manhattan norm for complex values)

size_type Dune::DenseVector< DynamicVector< K, Allocator > >::N ( ) const
inlineinherited

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

FieldTraits<value_type>::real_type Dune::DenseVector< DynamicVector< K, Allocator > >::one_norm ( ) const
inlineinherited

one norm (sum over absolute values of entries)

FieldTraits<value_type>::real_type Dune::DenseVector< DynamicVector< K, Allocator > >::one_norm_real ( ) const
inlineinherited

simplified one norm (uses Manhattan norm for complex values)

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

Binary vector incomparison.

PromotionTraits<field_type,typename DenseVector<Other>::field_type>::PromotedType Dune::DenseVector< DynamicVector< K, Allocator > >::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
std::enable_if< std::is_convertible<ValueType, value_type>::value, derived_type >::type& Dune::DenseVector< DynamicVector< K, Allocator > >::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.

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

Binary vector addition.

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

vector space addition

std::enable_if< std::is_convertible<ValueType, value_type>::value, derived_type >::type& Dune::DenseVector< DynamicVector< K, Allocator > >::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.

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

Binary vector subtraction.

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

vector space subtraction

std::enable_if< std::is_convertible<ValueType, value_type>::value, derived_type >::type& Dune::DenseVector< DynamicVector< K, Allocator > >::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.

std::enable_if< std::is_convertible<ValueType, value_type>::value, derived_type >::type& Dune::DenseVector< DynamicVector< K, Allocator > >::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.

template<class K, class Allocator = std::allocator< K >>
DynamicVector& Dune::DynamicVector< K, Allocator >::operator= ( const DynamicVector< K, Allocator > &  other)
inline

Copy assignment operator.

template<class K, class Allocator = std::allocator< K >>
DynamicVector& Dune::DynamicVector< K, Allocator >::operator= ( DynamicVector< K, Allocator > &&  other)
inline

Move assignment operator.

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

Binary vector comparison.

value_type& Dune::DenseVector< DynamicVector< K, Allocator > >::operator[] ( size_type  i)
inlineinherited

random access

const value_type& Dune::DenseVector< DynamicVector< K, Allocator > >::operator[] ( size_type  i) const
inlineinherited
template<class K, class Allocator = std::allocator< K >>
void Dune::DynamicVector< K, Allocator >::reserve ( size_type  n)
inline
template<class K, class Allocator = std::allocator< K >>
void Dune::DynamicVector< K, Allocator >::resize ( size_type  n,
value_type  c = value_type() 
)
inline
size_type Dune::DenseVector< DynamicVector< K, Allocator > >::size ( ) const
inlineinherited
FieldTraits<value_type>::real_type Dune::DenseVector< DynamicVector< K, Allocator > >::two_norm ( ) const
inlineinherited

two norm sqrt(sum over squared values of entries)

FieldTraits<value_type>::real_type Dune::DenseVector< DynamicVector< K, Allocator > >::two_norm2 ( ) const
inlineinherited

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

template<class K, class Allocator = std::allocator< K >>
K& Dune::DynamicVector< K, Allocator >::vec_access ( size_type  i)
inline
template<class K, class Allocator = std::allocator< K >>
const K& Dune::DynamicVector< K, Allocator >::vec_access ( size_type  i) const
inline
template<class K, class Allocator = std::allocator< K >>
size_type Dune::DynamicVector< K, Allocator >::vec_size ( ) const
inline

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