Dune::DynamicVector< K, Allocator > Class Template Reference
[Dense Matrix and Vector Template Library]

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

#include <dune/common/dynvector.hh>

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

List of all members.

Public Types

typedef Base::size_type size_type
 The type used for the index access and size operation.
typedef Base::value_type value_type
 export the type representing the field
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
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, 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.
 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 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.
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.
void resize (size_type n, value_type c=value_type())
void reserve (size_type n)
size_type size () const
 size method
K & operator[] (size_type i)
const K & operator[] (size_type i) const
value_typeoperator[] (size_type i)
 random access
const value_typeoperator[] (size_type i) const
Iterator begin ()
 begin iterator
ConstIterator begin () const
 begin ConstIterator
Iterator end ()
 end iterator
ConstIterator end () const
 end ConstIterator
Iterator beforeEnd ()
ConstIterator beforeEnd () const
Iterator beforeBegin ()
ConstIterator beforeBegin () const
Iterator find (size_type i)
 return iterator to given element or end()
ConstIterator find (size_type i) const
 return iterator to given element or end()
derived_typeoperator+= (const DenseVector< Other > &y)
 vector space addition
std::enable_if
< std::is_convertible
< ValueType, value_type >
::value, derived_type >::type & 
operator+= (const ValueType &kk)
 vector space add scalar to all comps
derived_typeoperator-= (const DenseVector< Other > &y)
 vector space subtraction
std::enable_if
< std::is_convertible
< ValueType, value_type >
::value, derived_type >::type & 
operator-= (const ValueType &kk)
 vector space subtract scalar from all comps
derived_type operator+ (const DenseVector< Other > &b) const
 Binary vector addition.
derived_type operator- (const DenseVector< Other > &b) const
 Binary vector subtraction.
std::enable_if
< std::is_convertible
< FieldType, field_type >
::value, derived_type >::type & 
operator*= (const FieldType &kk)
 vector space multiplication with scalar
std::enable_if
< std::is_convertible
< FieldType, field_type >
::value, derived_type >::type & 
operator/= (const FieldType &kk)
 vector space division by scalar
bool operator== (const DenseVector< Other > &y) const
 Binary vector comparison.
bool operator!= (const DenseVector< Other > &y) const
 Binary vector incomparison.
derived_typeaxpy (const field_type &a, const DenseVector< Other > &y)
 vector space axpy operation ( *this += a y )
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
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
FieldTraits< value_type >
::real_type 
one_norm () const
 one norm (sum over absolute values of entries)
FieldTraits< value_type >
::real_type 
one_norm_real () const
 simplified one norm (uses Manhattan norm for complex values)
FieldTraits< value_type >
::real_type 
two_norm () const
 two norm sqrt(sum over squared values of entries)
FieldTraits< value_type >
::real_type 
two_norm2 () const
 square of two norm (sum over squared values of entries), need for block recursion
FieldTraits< vt >::real_type infinity_norm () const
 infinity norm (maximum of absolute values of entries)
FieldTraits< vt >::real_type infinity_norm () const
 infinity norm (maximum of absolute values of entries)
FieldTraits< vt >::real_type infinity_norm_real () const
 simplified infinity norm (uses Manhattan norm for complex values)
FieldTraits< vt >::real_type infinity_norm_real () const
 simplified infinity norm (uses Manhattan norm for complex values)
size_type N () const
 number of blocks in the vector (are of size 1 here)
size_type dim () const
 dimension of the vector space

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.

Detailed Description

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

Construct a vector with a dynamic size.

Template Parameters:
K is the field type (use float, double, complex, etc)
Allocator type 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 FieldTraits< value_type >::field_type Dune::DenseVector< DynamicVector< K, Allocator > >::field_type [inherited]

export the type representing the field

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

typedef for stl compliant access

typedef DenseIterator<DenseVector,value_type> Dune::DenseVector< DynamicVector< K, Allocator > >::Iterator [inherited]

Iterator class for sequential access.

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

The type used for the index access and size operation.

Reimplemented from Dune::DenseVector< DynamicVector< K, Allocator > >.

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

export the type representing the field

Reimplemented from Dune::DenseVector< DynamicVector< K, Allocator > >.


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()  )  [inline, explicit]

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() 
) [inline, explicit]
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 ( std::initializer_list< K > const &  l  )  [inline]

Construct from a std::initializer_list.

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 field_type a,
const DenseVector< Other > &  y 
) [inline, inherited]

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

ConstIterator Dune::DenseVector< DynamicVector< K, Allocator > >::beforeBegin (  )  const [inline, inherited]
Returns:
an iterator that is positioned before the first entry of the vector.
Iterator Dune::DenseVector< DynamicVector< K, Allocator > >::beforeBegin (  )  [inline, inherited]
Returns:
an iterator that is positioned before the first entry of the vector.
ConstIterator Dune::DenseVector< DynamicVector< K, Allocator > >::beforeEnd (  )  const [inline, inherited]
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 > >::beforeEnd (  )  [inline, inherited]
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 > >::begin (  )  const [inline, inherited]

begin ConstIterator

Iterator Dune::DenseVector< DynamicVector< K, Allocator > >::begin (  )  [inline, inherited]

begin iterator

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 [inline, inherited]

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 [inline, inherited]

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:
y other vector
Returns:
ConstIterator Dune::DenseVector< DynamicVector< K, Allocator > >::end (  )  const [inline, inherited]

end ConstIterator

Iterator Dune::DenseVector< DynamicVector< K, Allocator > >::end (  )  [inline, inherited]

end iterator

ConstIterator Dune::DenseVector< DynamicVector< K, Allocator > >::find ( size_type  i  )  const [inline, inherited]

return iterator to given element or end()

Iterator Dune::DenseVector< DynamicVector< K, Allocator > >::find ( size_type  i  )  [inline, inherited]

return iterator to given element or end()

FieldTraits<vt>::real_type Dune::DenseVector< DynamicVector< K, Allocator > >::infinity_norm (  )  const [inline, inherited]

infinity norm (maximum of absolute values of entries)

FieldTraits<vt>::real_type Dune::DenseVector< DynamicVector< K, Allocator > >::infinity_norm (  )  const [inline, inherited]

infinity norm (maximum of absolute values of entries)

FieldTraits<vt>::real_type Dune::DenseVector< DynamicVector< K, Allocator > >::infinity_norm_real (  )  const [inline, inherited]

simplified infinity norm (uses Manhattan norm for complex values)

FieldTraits<vt>::real_type Dune::DenseVector< DynamicVector< K, Allocator > >::infinity_norm_real (  )  const [inline, inherited]

simplified infinity norm (uses Manhattan norm for complex values)

size_type Dune::DenseVector< DynamicVector< K, Allocator > >::N (  )  const [inline, inherited]

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

FieldTraits<value_type>::real_type Dune::DenseVector< DynamicVector< K, Allocator > >::one_norm (  )  const [inline, inherited]

one norm (sum over absolute values of entries)

FieldTraits<value_type>::real_type Dune::DenseVector< DynamicVector< K, Allocator > >::one_norm_real (  )  const [inline, inherited]

simplified one norm (uses Manhattan norm for complex values)

bool Dune::DenseVector< DynamicVector< K, Allocator > >::operator!= ( const DenseVector< Other > &  y  )  const [inline, inherited]

Binary vector incomparison.

PromotionTraits<field_type,typename DenseVector<Other>::field_type>::PromotedType Dune::DenseVector< DynamicVector< K, Allocator > >::operator* ( const DenseVector< Other > &  y  )  const [inline, inherited]

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:
y other vector
Returns:
std::enable_if< std::is_convertible<FieldType, field_type>::value, derived_type >::type& Dune::DenseVector< DynamicVector< K, Allocator > >::operator*= ( const FieldType &  kk  )  [inline, inherited]

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.

derived_type Dune::DenseVector< DynamicVector< K, Allocator > >::operator+ ( const DenseVector< Other > &  b  )  const [inline, inherited]

Binary vector addition.

std::enable_if< std::is_convertible<ValueType, value_type>::value, derived_type >::type& Dune::DenseVector< DynamicVector< K, Allocator > >::operator+= ( const ValueType &  kk  )  [inline, inherited]

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 > &  y  )  [inline, inherited]

vector space addition

derived_type Dune::DenseVector< DynamicVector< K, Allocator > >::operator- ( const DenseVector< Other > &  b  )  const [inline, inherited]

Binary vector subtraction.

std::enable_if< std::is_convertible<ValueType, value_type>::value, derived_type >::type& Dune::DenseVector< DynamicVector< K, Allocator > >::operator-= ( const ValueType &  kk  )  [inline, inherited]

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.

derived_type& Dune::DenseVector< DynamicVector< K, Allocator > >::operator-= ( const DenseVector< Other > &  y  )  [inline, inherited]

vector space subtraction

std::enable_if< std::is_convertible<FieldType, field_type>::value, derived_type >::type& Dune::DenseVector< DynamicVector< K, Allocator > >::operator/= ( const FieldType &  kk  )  [inline, inherited]

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.

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

Move assignment operator.

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

Copy assignment operator.

bool Dune::DenseVector< DynamicVector< K, Allocator > >::operator== ( const DenseVector< Other > &  y  )  const [inline, inherited]

Binary vector comparison.

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

random access

template<class K, class Allocator = std::allocator< K >>
const K& Dune::DynamicVector< K, Allocator >::operator[] ( size_type  i  )  const [inline]
template<class K, class Allocator = std::allocator< K >>
K& Dune::DynamicVector< K, Allocator >::operator[] ( size_type  i  )  [inline]
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]
template<class K, class Allocator = std::allocator< K >>
size_type Dune::DynamicVector< K, Allocator >::size (  )  const [inline]

size method

Reimplemented from Dune::DenseVector< DynamicVector< K, Allocator > >.

FieldTraits<value_type>::real_type Dune::DenseVector< DynamicVector< K, Allocator > >::two_norm (  )  const [inline, inherited]

two norm sqrt(sum over squared values of entries)

FieldTraits<value_type>::real_type Dune::DenseVector< DynamicVector< K, Allocator > >::two_norm2 (  )  const [inline, inherited]

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


The documentation for this class was generated from the following files:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines

Generated on 25 Mar 2018 for dune-common by  doxygen 1.6.1