Loading...
Searching...
No Matches
Dune::DynamicVector< K, Allocator > Class Template Reference
Common » 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 >:

## Public Types

typedef Base::size_type | size_type
typedef Base::value_type | value_type
typedef std::vector< K, Allocator > | container_type
typedef Allocator | allocator_type
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.
DynamicVector & | operator= (const DynamicVector &other)
| Copy assignment operator.
DynamicVector & | operator= (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
K & | operator[] (size_type i)
const K & | operator[] (size_type i) const
K * | data () noexcept
| return pointer to underlying array
const K * | data () const noexcept
| return pointer to underlying array
const container_type & | container () const
container_type & | container ()
constexpr derived_type & | operator= (const value_type &k)
| Assignment operator for scalar.
constexpr DenseVector & | operator= (const DenseVector &)=default
| Assignment operator for other DenseVector of same type.
constexpr derived_type & | operator= (const DenseVector< W > &other)
| Assignment operator for other DenseVector of different type.
constexpr value_type & | front ()
| return reference to first element
constexpr value_type & | back ()
| return reference to last element
constexpr bool | empty () const
| checks whether the container is empty
constexpr Iterator | begin ()
| begin iterator
constexpr Iterator | end ()
| end iterator
constexpr Iterator | beforeEnd ()
constexpr Iterator | beforeBegin ()
constexpr Iterator | find (size_type i)
| return iterator to given element or end()
constexpr derived_type & | operator+= (const DenseVector< Other > &x)
| vector space addition
constexpr derived_type & | operator-= (const DenseVector< Other > &x)
| vector space subtraction
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 std::enable_if< std::is_convertible< FieldType, field_type >::value, derived_type >::type & | operator*= (const FieldType &kk)
| vector space multiplication with scalar
constexpr std::enable_if< std::is_convertible< FieldType, field_type >::value, derived_type >::type & | operator/= (const FieldType &kk)
| vector space division by scalar
constexpr bool | operator== (const DenseVector< Other > &x) const
| Binary vector comparison.
constexpr bool | operator!= (const DenseVector< Other > &x) const
| Binary vector incomparison.
constexpr derived_type & | axpy (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 which corresponds to Petsc's VecTDot
constexpr PromotionTraits< field_type, typenameDenseVector< Other >::field_type >::PromotedType | dot (const DenseVector< Other > &x) const
| vector dot product which corresponds to Petsc's VecDot
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_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 Symbols

(Note that these are not member symbols.)
template<class K, class Allocator>
std::istream & | operator>> (std::istream &in, DynamicVector< K, Allocator > &v)
| Read a DynamicVector from an input stream.
std::ostream & | operator<< (std::ostream &s, const DenseVector< DynamicVector< K, std::allocator< K > > > &v)
| Write a DenseVector to an output 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

## allocator_type

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

typedef Allocator Dune::DynamicVector< K, Allocator >::allocator_type

## block_type

typedef Traits::value_type Dune::DenseVector< DynamicVector< K, std::allocator< K > > >::block_type

inherited

export the type representing the components

## const_iterator

typedef ConstIterator Dune::DenseVector< DynamicVector< K, std::allocator< K > > >::const_iterator

inherited

typedef for stl compliant access

## ConstIterator

typedef DenseIterator<const DenseVector,const value_type> Dune::DenseVector< DynamicVector< K, std::allocator< K > > >::ConstIterator

inherited

ConstIterator class for sequential access.

## container_type

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

typedef std::vector< K, Allocator > Dune::DynamicVector< K, Allocator >::container_type

## derived_type

typedef Traits::derived_type Dune::DenseVector< DynamicVector< K, std::allocator< K > > >::derived_type

inherited

type of derived vector class

## field_type

typedef FieldTraits<value_type>::field_type Dune::DenseVector< DynamicVector< K, std::allocator< K > > >::field_type

inherited

export the type representing the field

## Iterator

typedef DenseIterator<DenseVector,value_type> Dune::DenseVector< DynamicVector< K, std::allocator< K > > >::Iterator

inherited

Iterator class for sequential access.

## iterator

typedef Iterator Dune::DenseVector< DynamicVector< K, std::allocator< K > > >::iterator

inherited

typedef for stl compliant access

## size_type

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

typedef Base::size_type Dune::DynamicVector< K, Allocator >::size_type

## value_type

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

typedef Base::value_type Dune::DynamicVector< K, Allocator >::value_type

## Constructor & Destructor Documentation

## DynamicVector() [1/8]

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.

## DynamicVector() [2/8]

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

Dune::DynamicVector< K, Allocator >::DynamicVector | ( | size_type | n,
|  | const allocator_type & | a = allocator_type() )

inline explicit

## DynamicVector() [3/8]

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.

## DynamicVector() [4/8]

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.

## DynamicVector() [5/8]

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.

## DynamicVector() [6/8]

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

Dune::DynamicVector< K, Allocator >::DynamicVector | ( | DynamicVector< K, Allocator > && | x | ) |

inline

Move constructor.

## DynamicVector() [7/8]

template<class K, class Allocator = std::allocator< K >>
template<class T>

Dune::DynamicVector< K, Allocator >::DynamicVector | ( | const DynamicVector< T, Allocator > & | x | ) |

inline

## DynamicVector() [8/8]

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

## axpy()

derived_type & Dune::DenseVector< DynamicVector< K, std::allocator< K > > >::axpy | ( | const field_type & | a,
|  | const DenseVector< Other > & | x )

inline constexpr inherited

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

## back()

value_type & Dune::DenseVector< DynamicVector< K, std::allocator< K > > >::back | ( |  | ) |

inline constexpr inherited

return reference to last element

## beforeBegin()

Iterator Dune::DenseVector< DynamicVector< K, std::allocator< K > > >::beforeBegin | ( |  | ) |

inline constexpr inherited

Returns
  an iterator that is positioned before the first entry of the vector.

## beforeEnd()

Iterator Dune::DenseVector< DynamicVector< K, std::allocator< K > > >::beforeEnd | ( |  | ) |

inline constexpr inherited

Returns
  an iterator that is positioned before the end iterator of the vector, i.e. at the last entry.

## begin()

Iterator Dune::DenseVector< DynamicVector< K, std::allocator< K > > >::begin | ( |  | ) |

inline constexpr inherited

begin iterator

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

## container() [1/2]

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

container_type & Dune::DynamicVector< K, Allocator >::container | ( |  | ) |

inline

## container() [2/2]

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

const container_type & Dune::DynamicVector< K, Allocator >::container | ( |  | ) | const

inline

## data() [1/2]

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

const K * Dune::DynamicVector< K, Allocator >::data | ( |  | ) | const

inline noexcept

return pointer to underlying array

## data() [2/2]

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

K * Dune::DynamicVector< K, Allocator >::data | ( |  | ) |

inline noexcept

return pointer to underlying array

## dim()

size_type Dune::DenseVector< DynamicVector< K, std::allocator< K > > >::dim | ( |  | ) | const

inline constexpr inherited

dimension of the vector space

## dot()

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

inline constexpr inherited

vector dot product which corresponds to Petsc's VecDot

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

Parameters

  x | other vector

Returns

## empty()

bool Dune::DenseVector< DynamicVector< K, std::allocator< K > > >::empty | ( |  | ) | const

inline constexpr inherited

checks whether the container is empty

## end()

Iterator Dune::DenseVector< DynamicVector< K, std::allocator< K > > >::end | ( |  | ) |

inline constexpr inherited

end iterator

## find()

Iterator Dune::DenseVector< DynamicVector< K, std::allocator< K > > >::find | ( | size_type | i | ) |

inline constexpr inherited

return iterator to given element or end()

## front()

value_type & Dune::DenseVector< DynamicVector< K, std::allocator< K > > >::front | ( |  | ) |

inline constexpr inherited

return reference to first element

## infinity_norm()

FieldTraits< vt >::real_type Dune::DenseVector< DynamicVector< K, std::allocator< K > > >::infinity_norm | ( |  | ) | const

inline constexpr inherited

infinity norm (maximum of absolute values of entries)

## infinity_norm_real()

FieldTraits< vt >::real_type Dune::DenseVector< DynamicVector< K, std::allocator< K > > >::infinity_norm_real | ( |  | ) | const

inline constexpr inherited

simplified infinity norm (uses Manhattan norm for complex values)

## N()

size_type Dune::DenseVector< DynamicVector< K, std::allocator< K > > >::N | ( |  | ) | const

inline constexpr inherited

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

## one_norm()

FieldTraits< value_type >::real_type Dune::DenseVector< DynamicVector< K, std::allocator< K > > >::one_norm | ( |  | ) | const

inline constexpr inherited

one norm (sum over absolute values of entries)

## one_norm_real()

FieldTraits< value_type >::real_type Dune::DenseVector< DynamicVector< K, std::allocator< K > > >::one_norm_real | ( |  | ) | const

inline constexpr inherited

simplified one norm (uses Manhattan norm for complex values)

## operator!=()

bool Dune::DenseVector< DynamicVector< K, std::allocator< K > > >::operator!= | ( | const DenseVector< Other > & | x | ) | const

inline constexpr inherited

Binary vector incomparison.

## operator*()

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

inline constexpr inherited

indefinite vector dot product which corresponds to Petsc's VecTDot

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

Parameters

  x | other vector

Returns

## operator*=()

std::enable_if< std::is_convertible< FieldType, field_type >::value, derived_type >::type & Dune::DenseVector< DynamicVector< K, std::allocator< K > > >::operator*= | ( | const FieldType & | kk | ) |

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

## operator+()

derived_type Dune::DenseVector< DynamicVector< K, std::allocator< K > > >::operator+ | ( | const DenseVector< Other > & | b | ) | const

inline constexpr inherited

Binary vector addition.

## operator+=()

derived_type & Dune::DenseVector< DynamicVector< K, std::allocator< K > > >::operator+= | ( | const DenseVector< Other > & | x | ) |

inline constexpr inherited

vector space addition

## operator-()

derived_type Dune::DenseVector< DynamicVector< K, std::allocator< K > > >::operator- | ( | const DenseVector< Other > & | b | ) | const

inline constexpr inherited

Binary vector subtraction.

## operator-=()

derived_type & Dune::DenseVector< DynamicVector< K, std::allocator< K > > >::operator-= | ( | const DenseVector< Other > & | x | ) |

inline constexpr inherited

vector space subtraction

## operator/=()

std::enable_if< std::is_convertible< FieldType, field_type >::value, derived_type >::type & Dune::DenseVector< DynamicVector< K, std::allocator< K > > >::operator/= | ( | const FieldType & | kk | ) |

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

## operator=() [1/5]

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

DenseVector & Dune::DenseVector< DynamicVector< K, Allocator > >::operator= | ( | const DenseVector & |  | ) |

constexpr default

Assignment operator for other DenseVector of same type.

## operator=() [2/5]

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

derived_type & Dune::DenseVector< DynamicVector< K, Allocator > >::operator= | ( | const DenseVector< W > & | other | ) |

inline constexpr

Assignment operator for other DenseVector of different type.

## operator=() [3/5]

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

DynamicVector & Dune::DynamicVector< K, Allocator >::operator= | ( | const DynamicVector< K, Allocator > & | other | ) |

inline

Copy assignment operator.

## operator=() [4/5]

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

derived_type & Dune::DenseVector< DynamicVector< K, Allocator > >::operator= | ( | const value_type & | k | ) |

inline constexpr

Assignment operator for scalar.

## operator=() [5/5]

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

DynamicVector & Dune::DynamicVector< K, Allocator >::operator= | ( | DynamicVector< K, Allocator > && | other | ) |

inline

Move assignment operator.

## operator==()

bool Dune::DenseVector< DynamicVector< K, std::allocator< K > > >::operator== | ( | const DenseVector< Other > & | x | ) | const

inline constexpr inherited

Binary vector comparison.

## operator[]() [1/2]

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

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

inline

## operator[]() [2/2]

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

const K & Dune::DynamicVector< K, Allocator >::operator[] | ( | size_type | i | ) | const

inline

## reserve()

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

void Dune::DynamicVector< K, Allocator >::reserve | ( | size_type | n | ) |

inline

## resize()

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

void Dune::DynamicVector< K, Allocator >::resize | ( | size_type | n,
|  | value_type | c = value_type() )

inline

## size()

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

size_type Dune::DynamicVector< K, Allocator >::size | ( |  | ) | const

inline

## two_norm()

FieldTraits< value_type >::real_type Dune::DenseVector< DynamicVector< K, std::allocator< K > > >::two_norm | ( |  | ) | const

inline constexpr inherited

two norm sqrt(sum over squared values of entries)

## two_norm2()

FieldTraits< value_type >::real_type Dune::DenseVector< DynamicVector< K, std::allocator< K > > >::two_norm2 | ( |  | ) | const

inline constexpr inherited

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

## Friends And Related Symbol 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] | s | std :: ostream to write to
  [in] | v | DenseVector to write

Returns
  the output stream (s)

## Member Data Documentation

## blocklevel

int Dune::DenseVector< DynamicVector< K, std::allocator< K > > >::blocklevel

static constexpr inherited

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

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

- dynvector.hh