dune-istl 2.12-git
Loading...
Searching...
No Matches
Dune::Experimental::VectorView< B, R > Class Template Reference

Non-owning block vector view with explicit indices. More...

#include <dune/istl/experimental/vectorview.hh>

Inheritance diagram for Dune::Experimental::VectorView< B, R >:
Inheritance graph

Public Types

using index_range_type = typename IndexedArrayView< B, R >::index_range_type
 The type used for the index set.
 
using block_type = typename IndexedArrayView< B, R >::member_type
 The type of blocks in the vector.
 
using size_type = typename IndexedArrayView< B, R >::size_type
 The type used to count elements in the index set.
 
using value_type = typename IndexedArrayView< B, R >::member_type
 The type of blocks in the vector.
 
using reference = typename IndexedArrayView< B, R >::reference
 The type used for references to the blocks.
 
using const_reference = typename IndexedArrayView< B, R >::const_reference
 The type used for const references to the blocks.
 
using Iterator = typename IndexedArrayView< B, R >::iterator
 Iterator type with mutable access to the underlying blocks.
 
using ConstIterator = typename IndexedArrayView< B, R >::const_iterator
 Iterator type with const access to the underlying blocks.
 
using field_type = typename FieldTraits< block_type >::field_type
 The type of the field.
 
using real_type = typename FieldTraits< block_type >::real_type
 The type of the real part of the field.
 
using member_type = std::iter_value_t< T >
 The type of components in the array.
 
using index_type = typename OrderedIndexRangeTraits< index_range_type >::index_type
 The type used for the index access.
 
using iterator = Iterator
 Iterator type with mutable access to the underlying data.
 
using const_iterator = ConstIterator
 Iterator type with const access to the underlying data.
 

Public Member Functions

VectorView & operator= (const field_type &k) noexcept(noexcept(std::declval< reference >()=std::declval< const field_type & >()))
 Assign all entries to scalar k.
 
template<class OtherB , class OtherR >
VectorView & operator+= (const VectorView< OtherB, OtherR > &y) noexcept(noexcept(this->checkSizeMatch(std::declval< const VectorView< OtherB, OtherR > & >())) &&noexcept(std::declval< reference >()+=std::declval< typename VectorView< OtherB, OtherR >::const_reference >()))
 
template<class OtherB , class OtherR >
VectorView & operator-= (const VectorView< OtherB, OtherR > &y) noexcept(noexcept(this->checkSizeMatch(std::declval< const VectorView< OtherB, OtherR > & >())) &&noexcept(std::declval< reference >() -=std::declval< typename VectorView< OtherB, OtherR >::const_reference >()))
 
VectorView & operator*= (const field_type &k) noexcept(noexcept(std::declval< reference >() *=std::declval< const field_type & >()))
 Scale all entries by k.
 
VectorView & operator/= (const field_type &k) noexcept(noexcept(std::declval< reference >()/=std::declval< const field_type & >()))
 Divide all entries by k.
 
template<class OtherB , class OtherR >
VectorView & axpy (const field_type &a, const VectorView< OtherB, OtherR > &y) noexcept(noexcept(this->checkSizeMatch(std::declval< const VectorView< OtherB, OtherR > & >())) &&noexcept(Dune::Impl::asVector(std::declval< reference >()) .axpy(std::declval< const field_type & >(), Dune::Impl::asVector(std::declval< typename VectorView< OtherB, OtherR >::const_reference >()))))
 
template<class OtherB , class OtherR >
auto operator* (const VectorView< OtherB, OtherR > &y) const noexcept(noexcept(this->checkSizeMatch(std::declval< const VectorView< OtherB, OtherR > & >())) &&noexcept(Dune::Impl::asVector(std::declval< const_reference >()) *Dune::Impl::asVector(std::declval< typename VectorView< OtherB, OtherR >::const_reference >())))
 Indefinite vector dot product \(\left (x^T \cdot y \right)\).
 
template<class OtherB , class OtherR >
auto dot (const VectorView< OtherB, OtherR > &y) const noexcept(noexcept(this->checkSizeMatch(std::declval< const VectorView< OtherB, OtherR > & >())) &&noexcept(Dune::Impl::asVector(std::declval< const_reference >()) .dot(Dune::Impl::asVector(std::declval< typename VectorView< OtherB, OtherR >::const_reference >()))))
 Vector dot product \(\left (x^H \cdot y \right)\).
 
FieldTraits< field_type >::real_type one_norm () const noexcept(noexcept(Dune::Impl::asVector(std::declval< const_reference >()).one_norm()))
 One norm (sum over absolute values of entries)
 
FieldTraits< field_type >::real_type one_norm_real () const noexcept(noexcept(Dune::Impl::asVector(std::declval< const_reference >()).one_norm_real()))
 Simplified one norm (uses Manhattan norm for complex values)
 
FieldTraits< field_type >::real_type two_norm () const noexcept(noexcept(two_norm2()))
 Two norm sqrt(sum over squared values of entries)
 
FieldTraits< field_type >::real_type two_norm2 () const noexcept(noexcept(Dune::Impl::asVector(std::declval< const_reference >()).two_norm2()))
 Square of the two-norm (the sum over the squared values of the entries)
 
FieldTraits< field_type >::real_type infinity_norm () const noexcept(noexcept(Dune::Impl::asVector(std::declval< const_reference >()).infinity_norm()))
 Infinity norm (maximum of absolute values of entries)
 
FieldTraits< field_type >::real_type infinity_norm_real () const noexcept(noexcept(Dune::Impl::asVector(std::declval< const_reference >()).infinity_norm_real()))
 Simplified infinity norm (uses Manhattan norm for complex values)
 
size_type N () const noexcept
 Logical index span of the vector (size of index_set range), not stored entries.
 
reference operator[] (index_type i)
 Access element by an index from the index set.
 
const_reference operator[] (index_type i) const
 Const access element by an index from the index set.
 
constexpr iterator begin () noexcept(noexcept(iterator(data_, index_set_, size_type{})))
 Iterator to the first element in the view.
 
constexpr const_iterator begin () const noexcept(noexcept(iterator(data_, index_set_, size_type{})))
 Const iterator to the first element in the view.
 
constexpr iterator end () noexcept(noexcept(iterator(data_, index_set_, size_type{})))
 Iterator to one past the last element in the view.
 
constexpr const_iterator end () const noexcept(noexcept(iterator(data_, index_set_, size_type{})))
 Const iterator to one past the last element in the view.
 
iterator find (size_type i)
 Find element with index i in the index set.
 
const_iterator find (size_type i) const
 Find element with index i in the index set.
 
bool contains (index_type i) const
 
constexpr size_type size () const noexcept(noexcept(std::ranges::size(index_set_)))
 The number of elements in the view, i.e. the size of the index set.
 
constexpr index_range_type indexSet () const
 The logical index range covered by the view, as determined by the index set.
 

Detailed Description

template<std::random_access_iterator B, Concepts::BorrowedOrderedIndexRange R>
class Dune::Experimental::VectorView< B, R >

Non-owning block vector view with explicit indices.

This class extends IndexedArrayView with vector-space operations such as scaled addition and norms. Data ownership remains external.

Binary operations with another VectorView iterate over entries of the other vector and expect its indices to form a subset of this view's index set.

If DUNE_ISTL_WITH_CHECKING is enabled, index subset violations raise ISTLError. Without checking, violating this precondition is undefined behavior.

Member Typedef Documentation

◆ block_type

template<std::random_access_iterator B, Concepts::BorrowedOrderedIndexRange R>
using Dune::Experimental::VectorView< B, R >::block_type = typename IndexedArrayView<B, R>::member_type

The type of blocks in the vector.

◆ const_iterator

using Dune::Experimental::IndexedArrayView< T, R >::const_iterator = ConstIterator
inherited

Iterator type with const access to the underlying data.

◆ const_reference

template<std::random_access_iterator B, Concepts::BorrowedOrderedIndexRange R>
using Dune::Experimental::VectorView< B, R >::const_reference = typename IndexedArrayView<B, R>::const_reference

The type used for const references to the blocks.

◆ ConstIterator

template<std::random_access_iterator B, Concepts::BorrowedOrderedIndexRange R>
using Dune::Experimental::VectorView< B, R >::ConstIterator = typename IndexedArrayView<B, R>::const_iterator

Iterator type with const access to the underlying blocks.

◆ field_type

template<std::random_access_iterator B, Concepts::BorrowedOrderedIndexRange R>
using Dune::Experimental::VectorView< B, R >::field_type = typename FieldTraits<block_type>::field_type

The type of the field.

◆ index_range_type

template<std::random_access_iterator B, Concepts::BorrowedOrderedIndexRange R>
using Dune::Experimental::VectorView< B, R >::index_range_type = typename IndexedArrayView<B, R>::index_range_type

The type used for the index set.

◆ index_type

using Dune::Experimental::IndexedArrayView< T, R >::index_type = typename OrderedIndexRangeTraits<index_range_type>::index_type
inherited

The type used for the index access.

◆ iterator

using Dune::Experimental::IndexedArrayView< T, R >::iterator = Iterator
inherited

Iterator type with mutable access to the underlying data.

◆ Iterator

template<std::random_access_iterator B, Concepts::BorrowedOrderedIndexRange R>
using Dune::Experimental::VectorView< B, R >::Iterator = typename IndexedArrayView<B, R>::iterator

Iterator type with mutable access to the underlying blocks.

◆ member_type

using Dune::Experimental::IndexedArrayView< T, R >::member_type = std::iter_value_t<T>
inherited

The type of components in the array.

◆ real_type

template<std::random_access_iterator B, Concepts::BorrowedOrderedIndexRange R>
using Dune::Experimental::VectorView< B, R >::real_type = typename FieldTraits<block_type>::real_type

The type of the real part of the field.

◆ reference

template<std::random_access_iterator B, Concepts::BorrowedOrderedIndexRange R>
using Dune::Experimental::VectorView< B, R >::reference = typename IndexedArrayView<B, R>::reference

The type used for references to the blocks.

◆ size_type

template<std::random_access_iterator B, Concepts::BorrowedOrderedIndexRange R>
using Dune::Experimental::VectorView< B, R >::size_type = typename IndexedArrayView<B, R>::size_type

The type used to count elements in the index set.

◆ value_type

template<std::random_access_iterator B, Concepts::BorrowedOrderedIndexRange R>
using Dune::Experimental::VectorView< B, R >::value_type = typename IndexedArrayView<B, R>::member_type

The type of blocks in the vector.

Member Function Documentation

◆ axpy()

template<std::random_access_iterator B, Concepts::BorrowedOrderedIndexRange R>
template<class OtherB , class OtherR >
VectorView & Dune::Experimental::VectorView< B, R >::axpy ( const field_type &  a,
const VectorView< OtherB, OtherR > &  y 
)
inlinenoexcept

AXPY operation on indices from y: this += a * y. Requires y's indices to be a subset of this vector's indices.

◆ begin() [1/2]

constexpr const_iterator Dune::Experimental::IndexedArrayView< T, R >::begin ( ) const
inlineconstexprnoexceptinherited

Const iterator to the first element in the view.

◆ begin() [2/2]

constexpr iterator Dune::Experimental::IndexedArrayView< T, R >::begin ( )
inlineconstexprnoexceptinherited

Iterator to the first element in the view.

◆ contains()

bool Dune::Experimental::IndexedArrayView< T, R >::contains ( index_type  i) const
inlineinherited

◆ dot()

template<std::random_access_iterator B, Concepts::BorrowedOrderedIndexRange R>
template<class OtherB , class OtherR >
auto Dune::Experimental::VectorView< B, R >::dot ( const VectorView< OtherB, OtherR > &  y) const
inlinenoexcept

Vector dot product \(\left (x^H \cdot y \right)\).

◆ end() [1/2]

constexpr const_iterator Dune::Experimental::IndexedArrayView< T, R >::end ( ) const
inlineconstexprnoexceptinherited

Const iterator to one past the last element in the view.

◆ end() [2/2]

constexpr iterator Dune::Experimental::IndexedArrayView< T, R >::end ( )
inlineconstexprnoexceptinherited

Iterator to one past the last element in the view.

◆ find() [1/2]

iterator Dune::Experimental::IndexedArrayView< T, R >::find ( size_type  i)
inlineinherited

Find element with index i in the index set.

Returns
Iterator to the element with index i, or end() if i is not present.

◆ find() [2/2]

const_iterator Dune::Experimental::IndexedArrayView< T, R >::find ( size_type  i) const
inlineinherited

Find element with index i in the index set.

Returns
Const iterator to the element with index i, or end() if i is not present.

◆ indexSet()

constexpr index_range_type Dune::Experimental::IndexedArrayView< T, R >::indexSet ( ) const
inlineconstexprinherited

The logical index range covered by the view, as determined by the index set.

◆ infinity_norm()

template<std::random_access_iterator B, Concepts::BorrowedOrderedIndexRange R>
FieldTraits< field_type >::real_type Dune::Experimental::VectorView< B, R >::infinity_norm ( ) const
inlinenoexcept

Infinity norm (maximum of absolute values of entries)

◆ infinity_norm_real()

template<std::random_access_iterator B, Concepts::BorrowedOrderedIndexRange R>
FieldTraits< field_type >::real_type Dune::Experimental::VectorView< B, R >::infinity_norm_real ( ) const
inlinenoexcept

Simplified infinity norm (uses Manhattan norm for complex values)

◆ N()

template<std::random_access_iterator B, Concepts::BorrowedOrderedIndexRange R>
size_type Dune::Experimental::VectorView< B, R >::N ( ) const
inlinenoexcept

Logical index span of the vector (size of index_set range), not stored entries.

◆ one_norm()

template<std::random_access_iterator B, Concepts::BorrowedOrderedIndexRange R>
FieldTraits< field_type >::real_type Dune::Experimental::VectorView< B, R >::one_norm ( ) const
inlinenoexcept

One norm (sum over absolute values of entries)

◆ one_norm_real()

template<std::random_access_iterator B, Concepts::BorrowedOrderedIndexRange R>
FieldTraits< field_type >::real_type Dune::Experimental::VectorView< B, R >::one_norm_real ( ) const
inlinenoexcept

Simplified one norm (uses Manhattan norm for complex values)

◆ operator*()

template<std::random_access_iterator B, Concepts::BorrowedOrderedIndexRange R>
template<class OtherB , class OtherR >
auto Dune::Experimental::VectorView< B, R >::operator* ( const VectorView< OtherB, OtherR > &  y) const
inlinenoexcept

Indefinite vector dot product \(\left (x^T \cdot y \right)\).

◆ operator*=()

template<std::random_access_iterator B, Concepts::BorrowedOrderedIndexRange R>
VectorView & Dune::Experimental::VectorView< B, R >::operator*= ( const field_type &  k)
inlinenoexcept

Scale all entries by k.

◆ operator+=()

template<std::random_access_iterator B, Concepts::BorrowedOrderedIndexRange R>
template<class OtherB , class OtherR >
VectorView & Dune::Experimental::VectorView< B, R >::operator+= ( const VectorView< OtherB, OtherR > &  y)
inlinenoexcept

Add entries from y to this vector at indices contained in y. Requires y's indices to be a subset of this vector's indices.

◆ operator-=()

template<std::random_access_iterator B, Concepts::BorrowedOrderedIndexRange R>
template<class OtherB , class OtherR >
VectorView & Dune::Experimental::VectorView< B, R >::operator-= ( const VectorView< OtherB, OtherR > &  y)
inlinenoexcept

Subtract entries from y from this vector at indices contained in y. Requires y's indices to be a subset of this vector's indices.

◆ operator/=()

template<std::random_access_iterator B, Concepts::BorrowedOrderedIndexRange R>
VectorView & Dune::Experimental::VectorView< B, R >::operator/= ( const field_type &  k)
inlinenoexcept

Divide all entries by k.

◆ operator=()

template<std::random_access_iterator B, Concepts::BorrowedOrderedIndexRange R>
VectorView & Dune::Experimental::VectorView< B, R >::operator= ( const field_type &  k)
inlinenoexcept

Assign all entries to scalar k.

◆ operator[]() [1/2]

reference Dune::Experimental::IndexedArrayView< T, R >::operator[] ( index_type  i)
inlineinherited

Access element by an index from the index set.

Parameters
iIndex from the index set.
Exceptions
ISTLErrorif bounds checking is enabled and i is not present.

◆ operator[]() [2/2]

const_reference Dune::Experimental::IndexedArrayView< T, R >::operator[] ( index_type  i) const
inlineinherited

Const access element by an index from the index set.

Parameters
iIndex from the index set.
Exceptions
ISTLErrorif bounds checking is enabled and i is not present.

◆ size()

constexpr size_type Dune::Experimental::IndexedArrayView< T, R >::size ( ) const
inlineconstexprnoexceptinherited

The number of elements in the view, i.e. the size of the index set.

◆ two_norm()

template<std::random_access_iterator B, Concepts::BorrowedOrderedIndexRange R>
FieldTraits< field_type >::real_type Dune::Experimental::VectorView< B, R >::two_norm ( ) const
inlinenoexcept

Two norm sqrt(sum over squared values of entries)

◆ two_norm2()

template<std::random_access_iterator B, Concepts::BorrowedOrderedIndexRange R>
FieldTraits< field_type >::real_type Dune::Experimental::VectorView< B, R >::two_norm2 ( ) const
inlinenoexcept

Square of the two-norm (the sum over the squared values of the entries)


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