Class template Dune::XT::LA::VectorInterface

Inherits from Dune::XT::LA::ContainerInterface.

Friends Dune::XT::LA::VectorInterface::const_iterator, Dune::XT::LA::VectorInterface::iterator, operator<<(std::ostream &, const VectorInterface<T, S> &).

template<class Traits, class ScalarImp>
class Dune::XT::LA::VectorInterface<Traits, ScalarImp> : public ContainerInterface<Traits, ScalarImp>

CRTP base interface for vector containers, providing access, arithmetic, norms and dot products.

Method Dune::XT::LA::VectorInterface::size

template<class Traits, class ScalarImp>
inline int Dune::XT::LA::VectorInterface<Traits, ScalarImp>::size() const

The size of the vector.

:returns: The size of the vector.

Method Dune::XT::LA::VectorInterface::resize

template<class Traits, class ScalarImp>
inline void Dune::XT::LA::VectorInterface<Traits, ScalarImp>::resize(const int new_size)

Note

This is supposed to do nothing if new_size == size()

Method Dune::XT::LA::VectorInterface::add_to_entry

template<class Traits, class ScalarImp>
inline void Dune::XT::LA::VectorInterface<Traits, ScalarImp>::add_to_entry(const int ii, const ScalarType &value)

Add a scalar to the iith entry.

Method Dune::XT::LA::VectorInterface::set_entry

template<class Traits, class ScalarImp>
inline void Dune::XT::LA::VectorInterface<Traits, ScalarImp>::set_entry(const int ii, const ScalarType &value)

Set the iith entry to given scalar.

Method Dune::XT::LA::VectorInterface::get_entry

template<class Traits, class ScalarImp>
inline ScalarType Dune::XT::LA::VectorInterface<Traits, ScalarImp>::get_entry(const int ii) const

Get the iith entry.

Method Dune::XT::LA::VectorInterface::get_unchecked_ref

template<class Traits, class ScalarImp>
inline ScalarType &Dune::XT::LA::VectorInterface<Traits, ScalarImp>::get_unchecked_ref(const int ii)

The purpose of get_unchecked_ref is to allow direct access to the underlying data without any checks (regarding cow or thread safety). This allows default implementations in the interface with locking prior to for-loops.

Method Dune::XT::LA::VectorInterface::get_unchecked_ref

template<class Traits, class ScalarImp>
inline const ScalarType &Dune::XT::LA::VectorInterface<Traits, ScalarImp>::get_unchecked_ref(const int ii) const

No documentation provided.

Method Dune::XT::LA::VectorInterface::set_all

template<class Traits, class ScalarImp>
virtual void Dune::XT::LA::VectorInterface<Traits, ScalarImp>::set_all(const ScalarType &val)

\ }

Provided by the interface for convenience!

Note

Those marked as virtual may be implemented more efficiently in a derived class! \ {

Method Dune::XT::LA::VectorInterface::valid

template<class Traits, class ScalarImp>
virtual bool Dune::XT::LA::VectorInterface<Traits, ScalarImp>::valid() const

No documentation provided.

Method Dune::XT::LA::VectorInterface::operator[]

template<class Traits, class ScalarImp>
inline ScalarType &Dune::XT::LA::VectorInterface<Traits, ScalarImp>::operator[](const int ii)

Get writable reference to the iith entry.

Method Dune::XT::LA::VectorInterface::operator[]

template<class Traits, class ScalarImp>
inline const ScalarType &Dune::XT::LA::VectorInterface<Traits, ScalarImp>::operator[](const int ii) const

Get read-only reference to the iith entry.

Method Dune::XT::LA::VectorInterface::min

template<class Traits, class ScalarImp>
virtual ScalarType Dune::XT::LA::VectorInterface<Traits, ScalarImp>::min() const

No documentation provided.

Method Dune::XT::LA::VectorInterface::max

template<class Traits, class ScalarImp>
virtual ScalarType Dune::XT::LA::VectorInterface<Traits, ScalarImp>::max() const

No documentation provided.

Method Dune::XT::LA::VectorInterface::mean

template<class Traits, class ScalarImp>
virtual ScalarType Dune::XT::LA::VectorInterface<Traits, ScalarImp>::mean() const

No documentation provided.

Method Dune::XT::LA::VectorInterface::amax

template<class Traits, class ScalarImp>
int Dune::XT::LA::VectorInterface<Traits, ScalarImp>::amax() const

The maximum absolute value of the vector.

Note

If you override this method please use exceptions instead of assertions (for the python bindings).

:returns: A pair of the highest index at which the maximum is attained and the absolute maximum value.

Method Dune::XT::LA::VectorInterface::almost_equal

template<class Traits, class ScalarImp>
virtual bool Dune::XT::LA::VectorInterface<Traits, ScalarImp>::almost_equal(const derived_type &other, const ScalarType epsilon) const

Check vectors for equality. Equality of two vectors is defined as in Dune::FloatCmp componentwise.

Note

If you override this method please use exceptions instead of assertions (for the python bindings).

See also: Dune::Common::FloatCmp

:param other: A vector of same size to compare with. :param epsilon: See Dune::FloatCmp. :returns: Truth value of the comparison.

Method Dune::XT::LA::VectorInterface::dot

template<class Traits, class ScalarImp>
virtual ScalarType Dune::XT::LA::VectorInterface<Traits, ScalarImp>::dot(const derived_type &other) const

Computes the scalar products between two vectors.

Note

If you override this method please use exceptions instead of assertions (for the python bindings).

:param other: The second factor. :returns: The scalar product.

Method Dune::XT::LA::VectorInterface::l1_norm

template<class Traits, class ScalarImp>
virtual RealType Dune::XT::LA::VectorInterface<Traits, ScalarImp>::l1_norm() const

The l1-norm of the vector.

Note

If you override this method please use exceptions instead of assertions (for the python bindings).

:returns: The l1-norm of the vector.

Method Dune::XT::LA::VectorInterface::one_norm

template<class Traits, class ScalarImp>
RealType Dune::XT::LA::VectorInterface<Traits, ScalarImp>::one_norm() const

No documentation provided.

Method Dune::XT::LA::VectorInterface::l2_norm

template<class Traits, class ScalarImp>
virtual RealType Dune::XT::LA::VectorInterface<Traits, ScalarImp>::l2_norm() const

The l2-norm of the vector.

Note

If you override this method please use exceptions instead of assertions (for the python bindings).

:returns: The l2-norm of the vector.

Method Dune::XT::LA::VectorInterface::two_norm

template<class Traits, class ScalarImp>
RealType Dune::XT::LA::VectorInterface<Traits, ScalarImp>::two_norm() const

No documentation provided.

Method Dune::XT::LA::VectorInterface::sup_norm

template<class Traits, class ScalarImp>
virtual RealType Dune::XT::LA::VectorInterface<Traits, ScalarImp>::sup_norm() const

The l-infintiy-norm of the vector.

Note

If you override this method please use exceptions instead of assertions (for the python bindings).

:returns: The l-infintiy-norm of the vector.

Method Dune::XT::LA::VectorInterface::inf_norm

template<class Traits, class ScalarImp>
RealType Dune::XT::LA::VectorInterface<Traits, ScalarImp>::inf_norm() const

No documentation provided.

Method Dune::XT::LA::VectorInterface::standard_deviation

template<class Traits, class ScalarImp>
virtual ScalarType Dune::XT::LA::VectorInterface<Traits, ScalarImp>::standard_deviation() const

No documentation provided.

Method Dune::XT::LA::VectorInterface::add

template<class Traits, class ScalarImp>
virtual void Dune::XT::LA::VectorInterface<Traits, ScalarImp>::add(const derived_type &other, derived_type &result) const

Adds two vectors.

Note

If you override this method please use exceptions instead of assertions (for the python bindings).

Note

If you are looking for the old (now deprecated) add() method,

See also: add_to_entry

:param other: The right summand. :param result: Vector to write the result of this + other to

Method Dune::XT::LA::VectorInterface::add

template<class Traits, class ScalarImp>
virtual derived_type Dune::XT::LA::VectorInterface<Traits, ScalarImp>::add(const derived_type &other) const

Adds two vectors.

Note

If you override this method please use exceptions instead of assertions (for the python bindings).

Note

If you are looking for the old (now deprecated) add() method,

See also: add_to_entry

:param other: The right summand. :returns: The sum of this and other.

Method Dune::XT::LA::VectorInterface::iadd

template<class Traits, class ScalarImp>
virtual void Dune::XT::LA::VectorInterface<Traits, ScalarImp>::iadd(const derived_type &other)

Inplace variant of add().

Note

If you override this method please use exceptions instead of assertions (for the python bindings).

:param other: The right summand.

Method Dune::XT::LA::VectorInterface::sub

template<class Traits, class ScalarImp>
virtual void Dune::XT::LA::VectorInterface<Traits, ScalarImp>::sub(const derived_type &other, derived_type &result) const

Subtracts two vectors.

Note

If you override this method please use exceptions instead of assertions (for the python bindings).

:param other: The subtrahend. :param result: The vectror to write the difference between this and other to.

Method Dune::XT::LA::VectorInterface::sub

template<class Traits, class ScalarImp>
virtual derived_type Dune::XT::LA::VectorInterface<Traits, ScalarImp>::sub(const derived_type &other) const

Subtracts two vectors.

Note

If you override this method please use exceptions instead of assertions (for the python bindings).

:param other: The subtrahend. :returns: The difference between this and other.

Method Dune::XT::LA::VectorInterface::isub

template<class Traits, class ScalarImp>
virtual void Dune::XT::LA::VectorInterface<Traits, ScalarImp>::isub(const derived_type &other)

Inplace variant of sub().

Note

If you override this method please use exceptions instead of assertions (for the python bindings).

:param other: The subtrahend.

Method Dune::XT::LA::VectorInterface::operator*

template<class Traits, class ScalarImp>
virtual ScalarType Dune::XT::LA::VectorInterface<Traits, ScalarImp>::operator*(const derived_type &other) const

Computes the scalar products between this and another vector.

See also: dot

:param other: The second factor. :returns: The scalar product.

Method Dune::XT::LA::VectorInterface::operator+=

template<class Traits, class ScalarImp>
virtual derived_type &Dune::XT::LA::VectorInterface<Traits, ScalarImp>::operator+=(const derived_type &other)

Adds another vector to this, in-place variant.

:param other: The second summand. :returns: The sum of this and other.

Method Dune::XT::LA::VectorInterface::operator-=

template<class Traits, class ScalarImp>
virtual derived_type &Dune::XT::LA::VectorInterface<Traits, ScalarImp>::operator-=(const derived_type &other)

Subtracts another vector from this, in-place variant.

:param other: The subtrahend. :returns: The difference between this and other.

Method Dune::XT::LA::VectorInterface::operator+

template<class Traits, class ScalarImp>
virtual derived_type Dune::XT::LA::VectorInterface<Traits, ScalarImp>::operator+(const derived_type &other) const

Adds two vectors.

:param other: The second summand. :returns: The sum of the two vectors.

Method Dune::XT::LA::VectorInterface::operator-

template<class Traits, class ScalarImp>
virtual derived_type Dune::XT::LA::VectorInterface<Traits, ScalarImp>::operator-(const derived_type &other) const

Substracts two vectors.

:param other: The subtrahend :returns: The difference.

Method Dune::XT::LA::VectorInterface::operator/=

template<class Traits, class ScalarImp>
derived_type &Dune::XT::LA::VectorInterface<Traits, ScalarImp>::operator/=(const ScalarType &scalar) override

No documentation provided.

Method Dune::XT::LA::VectorInterface::operator==

template<class Traits, class ScalarImp>
bool Dune::XT::LA::VectorInterface<Traits, ScalarImp>::operator==(const derived_type &other) const

Check vectors for equality (componentwise) using almost_equal()

See also: almost_equal

:param other: A vector of same size to compare with. :returns: Truth value of the comparison.

Method Dune::XT::LA::VectorInterface::operator!=

template<class Traits, class ScalarImp>
bool Dune::XT::LA::VectorInterface<Traits, ScalarImp>::operator!=(const derived_type &other) const

Check vectors for inequality using !almost_equal()

:param other: A vector of same size to compare with. :returns: Truth value of the comparison.

Method Dune::XT::LA::VectorInterface::begin

template<class Traits, class ScalarImp>
iterator Dune::XT::LA::VectorInterface<Traits, ScalarImp>::begin()

No documentation provided.

Method Dune::XT::LA::VectorInterface::begin

template<class Traits, class ScalarImp>
const_iterator Dune::XT::LA::VectorInterface<Traits, ScalarImp>::begin() const

No documentation provided.

Method Dune::XT::LA::VectorInterface::end

template<class Traits, class ScalarImp>
iterator Dune::XT::LA::VectorInterface<Traits, ScalarImp>::end()

No documentation provided.

Method Dune::XT::LA::VectorInterface::end

template<class Traits, class ScalarImp>
const_iterator Dune::XT::LA::VectorInterface<Traits, ScalarImp>::end() const

No documentation provided.

Destructor Dune::XT::LA::VectorInterface::~VectorInterface<Traits, ScalarImp>

template<>
template<class Traits, class ScalarImp>
Dune::XT::LA::VectorInterface<Traits, ScalarImp>::~VectorInterface<Traits, ScalarImp>() override = default

No documentation provided.

Variable Dune::XT::LA::VectorInterface::dense_matrix_type

const Backends Dune::XT::LA::VectorInterface::dense_matrix_type

No documentation provided.

Variable Dune::XT::LA::VectorInterface::sparse_matrix_type

const Backends Dune::XT::LA::VectorInterface::sparse_matrix_type

No documentation provided.

Type alias Dune::XT::LA::VectorInterface::BaseType

type Dune::XT::LA::VectorInterface::BaseType

No documentation provided.

Type alias Dune::XT::LA::VectorInterface::const_iterator

type Dune::XT::LA::VectorInterface::const_iterator

No documentation provided.

Type alias Dune::XT::LA::VectorInterface::iterator

type Dune::XT::LA::VectorInterface::iterator

No documentation provided.

Function template Dune::XT::LA::VectorInterface::assign_from

template<class Traits, class ScalarImp>
template<class Vector>
int Dune::XT::LA::VectorInterface<Traits, ScalarImp>::assign_from(const Vector &other)

No documentation provided.

Function template Dune::XT::LA::VectorInterface::operator=

template<class Traits, class ScalarImp>
template<class T, class S>
derived_type &Dune::XT::LA::VectorInterface<Traits, ScalarImp>::operator=(const VectorInterface<T, S> &other)

No documentation provided.

Function template Dune::XT::LA::VectorInterface::almost_equal

template<class Traits, class ScalarImp>
template<class T>
bool Dune::XT::LA::VectorInterface<Traits, ScalarImp>::almost_equal(const int &other, const ScalarType epsilon) const

Check vectors for equality (variant for arbitrary derived combinations). Equality of two vectors is defined as in Dune::FloatCmp componentwise.

See also: Dune::Common::FloatCmp

:param other: A vector of same size to compare with. :param epsilon: See Dune::FloatCmp. :returns: Truth value of the comparison.

Function template Dune::XT::LA::VectorInterface::operator+=

template<class Traits, class ScalarImp>
template<class T, class S>
derived_type &Dune::XT::LA::VectorInterface<Traits, ScalarImp>::operator+=(const VectorInterface<T, S> &other)

No documentation provided.

Function template Dune::XT::LA::VectorInterface::operator-=

template<class Traits, class ScalarImp>
template<class T, class S>
derived_type &Dune::XT::LA::VectorInterface<Traits, ScalarImp>::operator-=(const VectorInterface<T, S> &other)

No documentation provided.

Function template Dune::XT::LA::VectorInterface::operator+

template<class Traits, class ScalarImp>
template<class T, class S>
derived_type Dune::XT::LA::VectorInterface<Traits, ScalarImp>::operator+(const VectorInterface<T, S> &other) const

No documentation provided.

Function template Dune::XT::LA::VectorInterface::operator-

template<class Traits, class ScalarImp>
template<class T, class S>
derived_type Dune::XT::LA::VectorInterface<Traits, ScalarImp>::operator-(const VectorInterface<T, S> &other) const

No documentation provided.