Loading...
Searching...
No Matches
Dune::DenseVector< V > Class Template Reference
Common » Dense Matrix and Vector Template Library

Interface for a class of dense vectors over a given field. More...

`#include <dune/common/densevector.hh>`

Inheritance diagram for Dune::DenseVector< V >:

## Public Types

typedef Traits::derived_type | derived_type
| type of derived vector class
typedef Traits::value_type | value_type
| export the type representing the field
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 Traits::size_type | size_type
| The type used for the index access and size operation.
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

constexpr derived_type & | operator= (const value_type &k)
| Assignment operator for scalar.
template<typename W, std::enable_if_t< std::is_assignable< value_type &, typename DenseVector< W >::value_type >::value, int > = 0>
constexpr derived_type & | operator= (const DenseVector< W > &other)
| Assignment operator for other DenseVector of different type.
constexpr value_type & | operator[] (size_type i)
| random access
constexpr const value_type & | operator[] (size_type i) const
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 size_type | size () const
| size method
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 ConstIterator | begin () const
| begin ConstIterator
constexpr ConstIterator | end () const
| end ConstIterator
constexpr ConstIterator | beforeEnd () const
constexpr ConstIterator | beforeBegin () const
constexpr ConstIterator | find (size_type i) const
| return iterator to given element or end()
template<class Other>
constexpr derived_type & | operator+= (const DenseVector< Other > &x)
| vector space addition
template<class Other>
constexpr derived_type & | operator-= (const DenseVector< Other > &x)
| vector space subtraction
template<class Other>
constexpr derived_type | operator+ (const DenseVector< Other > &b) const
| Binary vector addition.
template<class Other>
constexpr derived_type | operator- (const DenseVector< Other > &b) const
| Binary vector subtraction.
constexpr derived_type | operator- () const
| Vector negation.
template<typename ValueType>
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
template<typename ValueType>
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
template<typename FieldType>
constexpr std::enable_if< std::is_convertible< FieldType, field_type >::value, derived_type >::type & | operator*= (const FieldType &kk)
| vector space multiplication with scalar
template<typename FieldType>
constexpr std::enable_if< std::is_convertible< FieldType, field_type >::value, derived_type >::type & | operator/= (const FieldType &kk)
| vector space division by scalar
template<class Other>
constexpr bool | operator== (const DenseVector< Other > &x) const
| Binary vector comparison.
template<class Other>
constexpr bool | operator!= (const DenseVector< Other > &x) const
| Binary vector incomparison.
template<class Other>
constexpr derived_type & | axpy (const field_type &a, const DenseVector< Other > &x)
| vector space axpy operation ( *this += a x )
template<class Other>
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
template<class Other>
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
template<typename vt = value_type, typename std::enable_if<!HasNaN< vt >::value, int >::type = 0>
constexpr FieldTraits< vt >::real_type | infinity_norm () const
| infinity norm (maximum of absolute values of entries)
template<typename vt = value_type, typename std::enable_if<!HasNaN< vt >::value, int >::type = 0>
constexpr FieldTraits< vt >::real_type | infinity_norm_real () const
| simplified infinity norm (uses Manhattan norm for complex values)
template<typename vt = value_type, typename std::enable_if< HasNaN< vt >::value, int >::type = 0>
constexpr FieldTraits< vt >::real_type | infinity_norm () const
| infinity norm (maximum of absolute values of entries)
template<typename vt = value_type, typename std::enable_if< HasNaN< vt >::value, int >::type = 0>
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 = 1
| The number of block levels we contain. This is the leaf, that is, 1.

## Protected Member Functions

constexpr | DenseVector ()=default
constexpr | DenseVector (const DenseVector &)=default
constexpr DenseVector & | operator= (const DenseVector &)=default
| Assignment operator for other DenseVector of same type.

## Related Symbols

(Note that these are not member symbols.)
template<typename V>
std::ostream & | operator<< (std::ostream &s, const DenseVector< V > &v)
| Write a DenseVector to an output stream.

## Detailed Description

template<typename V>
class Dune::DenseVector< V >

Interface for a class of dense vectors over a given field.

Template Parameters

  V | implementation class of the vector

## Member Typedef Documentation

## block_type

template<typename V>

typedef Traits::value_type Dune::DenseVector< V >::block_type

export the type representing the components

## const_iterator

template<typename V>

typedef ConstIterator Dune::DenseVector< V >::const_iterator

typedef for stl compliant access

## ConstIterator

template<typename V>

typedef DenseIterator<const DenseVector,const value_type> Dune::DenseVector< V >::ConstIterator

ConstIterator class for sequential access.

## derived_type

template<typename V>

typedef Traits::derived_type Dune::DenseVector< V >::derived_type

type of derived vector class

## field_type

template<typename V>

typedef FieldTraits<value_type>::field_type Dune::DenseVector< V >::field_type

export the type representing the field

## Iterator

template<typename V>

typedef DenseIterator<DenseVector,value_type> Dune::DenseVector< V >::Iterator

Iterator class for sequential access.

## iterator

template<typename V>

typedef Iterator Dune::DenseVector< V >::iterator

typedef for stl compliant access

## size_type

template<typename V>

typedef Traits::size_type Dune::DenseVector< V >::size_type

The type used for the index access and size operation.

## value_type

template<typename V>

typedef Traits::value_type Dune::DenseVector< V >::value_type

export the type representing the field

## Constructor & Destructor Documentation

## DenseVector() [1/2]

template<typename V>

Dune::DenseVector< V >::DenseVector | ( |  | ) |

constexpr protected default

## DenseVector() [2/2]

template<typename V>

Dune::DenseVector< V >::DenseVector | ( | const DenseVector< V > & |  | ) |

constexpr protected default

## Member Function Documentation

## axpy()

template<typename V>
template<class Other>

derived_type & Dune::DenseVector< V >::axpy | ( | const field_type & | a,
|  | const DenseVector< Other > & | x )

inline constexpr

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

## back() [1/2]

template<typename V>

value_type & Dune::DenseVector< V >::back | ( |  | ) |

inline constexpr

return reference to last element

## back() [2/2]

template<typename V>

const value_type & Dune::DenseVector< V >::back | ( |  | ) | const

inline constexpr

return reference to last element

## beforeBegin() [1/2]

template<typename V>

Iterator Dune::DenseVector< V >::beforeBegin | ( |  | ) |

inline constexpr

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

## beforeBegin() [2/2]

template<typename V>

ConstIterator Dune::DenseVector< V >::beforeBegin | ( |  | ) | const

inline constexpr

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

## beforeEnd() [1/2]

template<typename V>

Iterator Dune::DenseVector< V >::beforeEnd | ( |  | ) |

inline constexpr

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

## beforeEnd() [2/2]

template<typename V>

ConstIterator Dune::DenseVector< V >::beforeEnd | ( |  | ) | const

inline constexpr

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

## begin() [1/2]

template<typename V>

Iterator Dune::DenseVector< V >::begin | ( |  | ) |

inline constexpr

begin iterator

## begin() [2/2]

template<typename V>

ConstIterator Dune::DenseVector< V >::begin | ( |  | ) | const

inline constexpr

begin ConstIterator

## dim()

template<typename V>

size_type Dune::DenseVector< V >::dim | ( |  | ) | const

inline constexpr

dimension of the vector space

## dot()

template<typename V>
template<class Other>

PromotionTraits< field_type, typenameDenseVector< Other >::field_type >::PromotedType Dune::DenseVector< V >::dot | ( | const DenseVector< Other > & | x | ) | const

inline constexpr

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

template<typename V>

bool Dune::DenseVector< V >::empty | ( |  | ) | const

inline constexpr

checks whether the container is empty

## end() [1/2]

template<typename V>

Iterator Dune::DenseVector< V >::end | ( |  | ) |

inline constexpr

end iterator

## end() [2/2]

template<typename V>

ConstIterator Dune::DenseVector< V >::end | ( |  | ) | const

inline constexpr

end ConstIterator

## find() [1/2]

template<typename V>

Iterator Dune::DenseVector< V >::find | ( | size_type | i | ) |

inline constexpr

return iterator to given element or end()

## find() [2/2]

template<typename V>

ConstIterator Dune::DenseVector< V >::find | ( | size_type | i | ) | const

inline constexpr

return iterator to given element or end()

## front() [1/2]

template<typename V>

value_type & Dune::DenseVector< V >::front | ( |  | ) |

inline constexpr

return reference to first element

## front() [2/2]

template<typename V>

const value_type & Dune::DenseVector< V >::front | ( |  | ) | const

inline constexpr

return reference to first element

## infinity_norm() [1/2]

template<typename V>
template<typename vt = value_type, typename std::enable_if< HasNaN< vt >::value, int >::type = 0>

FieldTraits< vt >::real_type Dune::DenseVector< V >::infinity_norm | ( |  | ) | const

inline constexpr

infinity norm (maximum of absolute values of entries)

## infinity_norm() [2/2]

template<typename V>
template<typename vt = value_type, typename std::enable_if<!HasNaN< vt >::value, int >::type = 0>

FieldTraits< vt >::real_type Dune::DenseVector< V >::infinity_norm | ( |  | ) | const

inline constexpr

infinity norm (maximum of absolute values of entries)

## infinity_norm_real() [1/2]

template<typename V>
template<typename vt = value_type, typename std::enable_if< HasNaN< vt >::value, int >::type = 0>

FieldTraits< vt >::real_type Dune::DenseVector< V >::infinity_norm_real | ( |  | ) | const

inline constexpr

simplified infinity norm (uses Manhattan norm for complex values)

## infinity_norm_real() [2/2]

template<typename V>
template<typename vt = value_type, typename std::enable_if<!HasNaN< vt >::value, int >::type = 0>

FieldTraits< vt >::real_type Dune::DenseVector< V >::infinity_norm_real | ( |  | ) | const

inline constexpr

simplified infinity norm (uses Manhattan norm for complex values)

## N()

template<typename V>

size_type Dune::DenseVector< V >::N | ( |  | ) | const

inline constexpr

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

## one_norm()

template<typename V>

FieldTraits< value_type >::real_type Dune::DenseVector< V >::one_norm | ( |  | ) | const

inline constexpr

one norm (sum over absolute values of entries)

## one_norm_real()

template<typename V>

FieldTraits< value_type >::real_type Dune::DenseVector< V >::one_norm_real | ( |  | ) | const

inline constexpr

simplified one norm (uses Manhattan norm for complex values)

## operator!=()

template<typename V>
template<class Other>

bool Dune::DenseVector< V >::operator!= | ( | const DenseVector< Other > & | x | ) | const

inline constexpr

Binary vector incomparison.

## operator*()

template<typename V>
template<class Other>

PromotionTraits< field_type, typenameDenseVector< Other >::field_type >::PromotedType Dune::DenseVector< V >::operator* | ( | const DenseVector< Other > & | x | ) | const

inline constexpr

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

template<typename V>
template<typename FieldType>

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

inline constexpr

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

template<typename V>
template<class Other>

derived_type Dune::DenseVector< V >::operator+ | ( | const DenseVector< Other > & | b | ) | const

inline constexpr

Binary vector addition.

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

template<typename V>
template<class Other>

derived_type & Dune::DenseVector< V >::operator+= | ( | const DenseVector< Other > & | x | ) |

inline constexpr

vector space addition

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

template<typename V>
template<typename ValueType>

std::enable_if< std::is_convertible< ValueType, value_type >::value, derived_type >::type & Dune::DenseVector< V >::operator+= | ( | const ValueType & | kk | ) |

inline constexpr

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]

template<typename V>

derived_type Dune::DenseVector< V >::operator- | ( |  | ) | const

inline constexpr

Vector negation.

## operator-() [2/2]

template<typename V>
template<class Other>

derived_type Dune::DenseVector< V >::operator- | ( | const DenseVector< Other > & | b | ) | const

inline constexpr

Binary vector subtraction.

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

template<typename V>
template<class Other>

derived_type & Dune::DenseVector< V >::operator-= | ( | const DenseVector< Other > & | x | ) |

inline constexpr

vector space subtraction

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

template<typename V>
template<typename ValueType>

std::enable_if< std::is_convertible< ValueType, value_type >::value, derived_type >::type & Dune::DenseVector< V >::operator-= | ( | const ValueType & | kk | ) |

inline constexpr

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

template<typename V>
template<typename FieldType>

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

inline constexpr

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/3]

template<typename V>

DenseVector & Dune::DenseVector< V >::operator= | ( | const DenseVector< V > & |  | ) |

constexpr protected default

Assignment operator for other DenseVector of same type.

## operator=() [2/3]

template<typename V>
template<typename W, std::enable_if_t< std::is_assignable< value_type &, typename DenseVector< W >::value_type >::value, int > = 0>

derived_type & Dune::DenseVector< V >::operator= | ( | const DenseVector< W > & | other | ) |

inline constexpr

Assignment operator for other DenseVector of different type.

## operator=() [3/3]

template<typename V>

derived_type & Dune::DenseVector< V >::operator= | ( | const value_type & | k | ) |

inline constexpr

Assignment operator for scalar.

## operator==()

template<typename V>
template<class Other>

bool Dune::DenseVector< V >::operator== | ( | const DenseVector< Other > & | x | ) | const

inline constexpr

Binary vector comparison.

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

template<typename V>

value_type & Dune::DenseVector< V >::operator[] | ( | size_type | i | ) |

inline constexpr

random access

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

template<typename V>

const value_type & Dune::DenseVector< V >::operator[] | ( | size_type | i | ) | const

inline constexpr

## size()

template<typename V>

size_type Dune::DenseVector< V >::size | ( |  | ) | const

inline constexpr

size method

## two_norm()

template<typename V>

FieldTraits< value_type >::real_type Dune::DenseVector< V >::two_norm | ( |  | ) | const

inline constexpr

two norm sqrt(sum over squared values of entries)

## two_norm2()

template<typename V>

FieldTraits< value_type >::real_type Dune::DenseVector< V >::two_norm2 | ( |  | ) | const

inline constexpr

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

## Member Data Documentation

## blocklevel

template<typename V>

int Dune::DenseVector< V >::blocklevel = 1

static constexpr

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:

- densevector.hh