KASKADE 7 development version
Classes | Public Types | Public Member Functions | Public Attributes | Related Functions | List of all members
Kaskade::LinearProductSpace< Scalar_, Seq > Class Template Reference

More...

#include <linearspace.hh>

Detailed Description

template<class Scalar_, class Seq>
class Kaskade::LinearProductSpace< Scalar_, Seq >

A product space of linear spaces.

Access to the components of the product space is provided by the component function:

Arithmetic operations are delegated componentwise to the heterogeneous subspaces.

Template Parameters
Scalarthe scalar field type of the linear space
Seqa boost::fusion sequence type defining the variables of the cartesian product

Definition at line 76 of file linearspace.hh.

Public Types

typedef Scalar_ Scalar
 scalar type More...
 
typedef Scalar field_type
 
typedef Seq Sequence
 boost::fusion::vector of element vectors. More...
 
typedef Seq Functions
 
template<int m>
using Component = std::remove_reference_t< typename boost::fusion::result_of::at_c< Sequence const, m >::type >
 The type of the m-th component. More...
 

Public Member Functions

 LinearProductSpace ()=delete
 
size_t dim () const
 Number of scalar degrees of freedom. This computes the total number of degrees of freedom, i.e. the sum of the dimensions of the components. More...
 
template<class SequenceY >
Selfoperator+= (LinearProductSpace< Scalar, SequenceY > const &y)
 In place addition. More...
 
Selfoperator-= (Self const &y)
 In place subtraction. More...
 
Selfaxpy (Scalar a, Self const &y)
 this <- this + a*y More...
 
template<class InIterator >
void read (InIterator i)
 DEPRECATED use vectorFromSequence instead. More...
 
template<class InIterator >
void read (int rbegin, int rend, InIterator i)
 Reads the coefficients of the subrange [rbegin,rend[ sequentially from an input iterator. The InIterator's value type must be convertible to field_type. More...
 
template<class OutIterator >
void write (OutIterator i) const
 DEPRECATED use vectorToSequence instead. More...
 
template<class DataOutIter >
void write (int rbegin, int rend, DataOutIter i) const
 Writes the coefficients of the subrange [rbegin,rend[ sequentially to an output iterator. The InIterator's value type must be convertible to field_type. More...
 
Construction
 LinearProductSpace (LinearProductSpace< Scalar, Sequence > const &y)
 Copy constructor. More...
 
 LinearProductSpace (LinearProductSpace< Scalar, Sequence > &&y)
 Move constructor. More...
 
template<class VSDescriptions >
 LinearProductSpace (const VariableSet< VSDescriptions > &y)
 Copy from VariableSet. More...
 
template<class S >
 LinearProductSpace (S const &init)
 Constructor with explicit data. More...
 
template<typename... Args>
 LinearProductSpace (boost::fusion::transform_view< Args... > const &data_)
 
Assignment
Selfoperator= (Self const &y)
 Assignment from the same type. More...
 
template<class VSDescriptions >
Selfoperator= (VariableSet< VSDescriptions > const &y)
 Assignment from a different (hopefully compatible) type. More...
 
template<class OtherSeq >
Selfoperator= (LinearProductSpace< Scalar, OtherSeq > const &y)
 Assignment from a different (hopefully compatible) type. More...
 
template<class FunctionSpace , int m>
Selfoperator= (FunctionSpaceElement< FunctionSpace, m > const &fse)
 Assignment from a (hopefully compatible) FunctionSpaceElement. More...
 
Selfoperator= (Scalar a)
 Assignment to constant scalar. More...
 
template<class First , class Last >
Selfoperator= (boost::fusion::iterator_range< First, Last > range)
 Assignment from a (hopefully compatible) boost::fusion iterator range. More...
 
Selfoperator*= (Scalar a)
 Scaling. More...
 
Scalar products and norms
field_type operator* (Self const &y) const
 Scalar product. More...
 
field_type dot (Self const &y) const
 Scalar product. More...
 
double two_norm2 () const
 squared euclidean norm More...
 
double two_norm () const
 euclidean norm More...
 

Public Attributes

Sequence data
 Data. More...
 

Related Functions

(Note that these are not member functions.)

template<int m, class Scalar , class Sequence >
auto const & component (LinearProductSpace< Scalar, Sequence > const &x)
 Provides access to the m-th component of a product space. More...
 
template<class X0 , class ... Xs>
auto cartesianProduct (X0 const &x0, Xs const &... xs)
 Creates a cartesian product of the given vectors, i.e. a LinearProductSpace object. More...
 
template<class Scalar , class Seq , class OutIter >
OutIter vectorToSequence (LinearProductSpace< Scalar, Seq > const &v, OutIter i)
 writes the coefficients of a vector to a flat scalar sequence <Scalar,Seq> More...
 
template<class Scalar , class Seq , class InIter >
InIter vectorFromSequence (LinearProductSpace< Scalar, Seq > &v, InIter i)
 reads the coefficients of a vector from a flat scalar sequence <Scalar,Seq> More...
 

Member Typedef Documentation

◆ Component

template<class Scalar_ , class Seq >
template<int m>
using Kaskade::LinearProductSpace< Scalar_, Seq >::Component = std::remove_reference_t<typename boost::fusion::result_of::at_c<Sequence const,m>::type>

The type of the m-th component.

Definition at line 104 of file linearspace.hh.

◆ field_type

template<class Scalar_ , class Seq >
typedef Scalar Kaskade::LinearProductSpace< Scalar_, Seq >::field_type

Definition at line 94 of file linearspace.hh.

◆ Functions

template<class Scalar_ , class Seq >
typedef Seq Kaskade::LinearProductSpace< Scalar_, Seq >::Functions

Definition at line 98 of file linearspace.hh.

◆ Scalar

template<class Scalar_ , class Seq >
typedef Scalar_ Kaskade::LinearProductSpace< Scalar_, Seq >::Scalar

scalar type

Definition at line 93 of file linearspace.hh.

◆ Sequence

template<class Scalar_ , class Seq >
typedef Seq Kaskade::LinearProductSpace< Scalar_, Seq >::Sequence

boost::fusion::vector of element vectors.

Definition at line 97 of file linearspace.hh.

Constructor & Destructor Documentation

◆ LinearProductSpace() [1/6]

template<class Scalar_ , class Seq >
Kaskade::LinearProductSpace< Scalar_, Seq >::LinearProductSpace ( )
delete

◆ LinearProductSpace() [2/6]

template<class Scalar_ , class Seq >
Kaskade::LinearProductSpace< Scalar_, Seq >::LinearProductSpace ( LinearProductSpace< Scalar, Sequence > const &  y)
inline

Copy constructor.

Definition at line 115 of file linearspace.hh.

◆ LinearProductSpace() [3/6]

template<class Scalar_ , class Seq >
Kaskade::LinearProductSpace< Scalar_, Seq >::LinearProductSpace ( LinearProductSpace< Scalar, Sequence > &&  y)
inline

Move constructor.

Definition at line 120 of file linearspace.hh.

◆ LinearProductSpace() [4/6]

template<class Scalar_ , class Seq >
template<class VSDescriptions >
Kaskade::LinearProductSpace< Scalar_, Seq >::LinearProductSpace ( const VariableSet< VSDescriptions > &  y)
inlineexplicit

Copy from VariableSet.

Definition at line 124 of file linearspace.hh.

◆ LinearProductSpace() [5/6]

template<class Scalar_ , class Seq >
template<class S >
Kaskade::LinearProductSpace< Scalar_, Seq >::LinearProductSpace ( S const &  init)
inlineexplicit

Constructor with explicit data.

Template Parameters
Sa type convertible to Sequence
Parameters
inita sequence type from which the components are initialized

Definition at line 136 of file linearspace.hh.

◆ LinearProductSpace() [6/6]

template<class Scalar_ , class Seq >
template<typename... Args>
Kaskade::LinearProductSpace< Scalar_, Seq >::LinearProductSpace ( boost::fusion::transform_view< Args... > const &  data_)
inlineexplicit

Definition at line 140 of file linearspace.hh.

Member Function Documentation

◆ axpy()

template<class Scalar_ , class Seq >
Self & Kaskade::LinearProductSpace< Scalar_, Seq >::axpy ( Scalar  a,
Self const &  y 
)
inline

this <- this + a*y

Definition at line 233 of file linearspace.hh.

◆ dim()

template<class Scalar_ , class Seq >
size_t Kaskade::LinearProductSpace< Scalar_, Seq >::dim ( ) const
inline

Number of scalar degrees of freedom. This computes the total number of degrees of freedom, i.e. the sum of the dimensions of the components.

Definition at line 154 of file linearspace.hh.

Referenced by Kaskade::LinearProductSpace< Scalar_, Seq >::dim().

◆ dot()

template<class Scalar_ , class Seq >
field_type Kaskade::LinearProductSpace< Scalar_, Seq >::dot ( Self const &  y) const
inline

Scalar product.

Definition at line 302 of file linearspace.hh.

◆ operator*()

template<class Scalar_ , class Seq >
field_type Kaskade::LinearProductSpace< Scalar_, Seq >::operator* ( Self const &  y) const
inline

Scalar product.

For two vectors \( (x_i)_{i=0,\dots,n-1} \) and \( (y_i)_{i=0,\dots,n-1}\) this computes and returns the euclidean scalar product

\[ \sum_{i=0}^{n-1} \langle x_i , y_i \rangle. \]

For the entries' scalar products, the operator*() is called.

Definition at line 292 of file linearspace.hh.

◆ operator*=()

template<class Scalar_ , class Seq >
Self & Kaskade::LinearProductSpace< Scalar_, Seq >::operator*= ( Scalar  a)
inline

Scaling.

Definition at line 213 of file linearspace.hh.

◆ operator+=()

template<class Scalar_ , class Seq >
template<class SequenceY >
Self & Kaskade::LinearProductSpace< Scalar_, Seq >::operator+= ( LinearProductSpace< Scalar, SequenceY > const &  y)
inline

In place addition.

Definition at line 221 of file linearspace.hh.

◆ operator-=()

template<class Scalar_ , class Seq >
Self & Kaskade::LinearProductSpace< Scalar_, Seq >::operator-= ( Self const &  y)
inline

In place subtraction.

Definition at line 227 of file linearspace.hh.

◆ operator=() [1/6]

template<class Scalar_ , class Seq >
template<class First , class Last >
Self & Kaskade::LinearProductSpace< Scalar_, Seq >::operator= ( boost::fusion::iterator_range< First, Last >  range)
inline

Assignment from a (hopefully compatible) boost::fusion iterator range.

Definition at line 204 of file linearspace.hh.

◆ operator=() [2/6]

template<class Scalar_ , class Seq >
template<class FunctionSpace , int m>
Self & Kaskade::LinearProductSpace< Scalar_, Seq >::operator= ( FunctionSpaceElement< FunctionSpace, m > const &  fse)
inline

Assignment from a (hopefully compatible) FunctionSpaceElement.

Definition at line 190 of file linearspace.hh.

◆ operator=() [3/6]

template<class Scalar_ , class Seq >
template<class OtherSeq >
Self & Kaskade::LinearProductSpace< Scalar_, Seq >::operator= ( LinearProductSpace< Scalar, OtherSeq > const &  y)
inline

Assignment from a different (hopefully compatible) type.

Definition at line 180 of file linearspace.hh.

◆ operator=() [4/6]

template<class Scalar_ , class Seq >
Self & Kaskade::LinearProductSpace< Scalar_, Seq >::operator= ( Scalar  a)
inline

Assignment to constant scalar.

Definition at line 197 of file linearspace.hh.

◆ operator=() [5/6]

template<class Scalar_ , class Seq >
Self & Kaskade::LinearProductSpace< Scalar_, Seq >::operator= ( Self const &  y)
inline

Assignment from the same type.

Definition at line 165 of file linearspace.hh.

◆ operator=() [6/6]

template<class Scalar_ , class Seq >
template<class VSDescriptions >
Self & Kaskade::LinearProductSpace< Scalar_, Seq >::operator= ( VariableSet< VSDescriptions > const &  y)
inline

Assignment from a different (hopefully compatible) type.

Definition at line 169 of file linearspace.hh.

◆ read() [1/2]

template<class Scalar_ , class Seq >
template<class InIterator >
void Kaskade::LinearProductSpace< Scalar_, Seq >::read ( InIterator  i)
inline

DEPRECATED use vectorFromSequence instead.

Reads the coefficients sequentially from an input iterator. The InIterator's value type must be convertible to field_type.

Definition at line 245 of file linearspace.hh.

Referenced by Kaskade::Bridge::VectorTraits< VariableSet< Descr > >::read().

◆ read() [2/2]

template<class Scalar_ , class Seq >
template<class InIterator >
void Kaskade::LinearProductSpace< Scalar_, Seq >::read ( int  rbegin,
int  rend,
InIterator  i 
)
inline

Reads the coefficients of the subrange [rbegin,rend[ sequentially from an input iterator. The InIterator's value type must be convertible to field_type.

Definition at line 255 of file linearspace.hh.

◆ two_norm()

template<class Scalar_ , class Seq >
double Kaskade::LinearProductSpace< Scalar_, Seq >::two_norm ( ) const
inline

euclidean norm

Definition at line 318 of file linearspace.hh.

Referenced by Kaskade::uniformEmbeddedErrorEstimation().

◆ two_norm2()

template<class Scalar_ , class Seq >
double Kaskade::LinearProductSpace< Scalar_, Seq >::two_norm2 ( ) const
inline

squared euclidean norm

Definition at line 310 of file linearspace.hh.

Referenced by Kaskade::LinearProductSpace< Scalar_, Seq >::two_norm().

◆ write() [1/2]

template<class Scalar_ , class Seq >
template<class DataOutIter >
void Kaskade::LinearProductSpace< Scalar_, Seq >::write ( int  rbegin,
int  rend,
DataOutIter  i 
) const
inline

Writes the coefficients of the subrange [rbegin,rend[ sequentially to an output iterator. The InIterator's value type must be convertible to field_type.

Definition at line 274 of file linearspace.hh.

◆ write() [2/2]

template<class Scalar_ , class Seq >
template<class OutIterator >
void Kaskade::LinearProductSpace< Scalar_, Seq >::write ( OutIterator  i) const
inline

DEPRECATED use vectorToSequence instead.

Writes the coefficients sequentially to an output iterator (flattening). The field_type must be convertible to the OutIterator's value type.

Definition at line 264 of file linearspace.hh.

Referenced by Kaskade::Bridge::VectorTraits< VariableSet< Descr > >::write().

Member Data Documentation

◆ data

template<class Scalar_ , class Seq >
Sequence Kaskade::LinearProductSpace< Scalar_, Seq >::data

Data.

Definition at line 328 of file linearspace.hh.

Referenced by Kaskade::LinearSpace_Detail::Copy< VariableSet< VSDescriptions >, Space, id >::apply(), Kaskade::LinearSpace_Detail::Copy< VariableSet< VSDescriptions >, Space, 0 >::apply(), Kaskade::coarsening(), Kaskade::component(), Kaskade::LinearProductSpace< Scalar_, Seq >::component(), LossyStorage< Grid, VariableSet, Space, QuantizationPolicy >::decode(), Kaskade::LinearProductSpace< Scalar_, Seq >::dim(), LossyStorage< Grid, VariableSet, Space, QuantizationPolicy >::encode(), Kaskade::EmbeddedErrorEstimator< VariableSetDescription, Scaling >::estimate(), Kaskade::evaluateVariables(), Kaskade::VTKReader::getCoefficients(), Kaskade::gridIterate(), Kaskade::YetAnotherHBErrorEstimator< Functional, VariableSetDescription, ExtensionVariableSetDescription, ExtensionSpace, NormFunctional, RefinementStrategy, lump, components, ReferenceSolution, ReferenceOperator >::operator()(), Kaskade::YetAnotherHBErrorEstimator_Elasticity< Functional, VariableSetDescription, ExtensionVariableSetDescription, ExtensionSpace, NormFunctional, RefinementStrategy, lump, components >::operator()(), Kaskade::HierarchicalBasisErrorEstimator2< Functional, VariableSetDescription, ExtensionVariableSetDescription, ExtensionSpace, NormFunctional, LinearSolverLA, LinearSolverHA, LinearSolverLM, LinearSolverHM, lumpM, RefinementStrategy >::operator()(), Kaskade::AdjointEquationLinearPropagationHBErrorEstimator< Functional, VariableSetDescription, ExtensionVariableSetDescription, ExtensionSpace, NormFunctional, LinearSolverLA, LinearSolverHA, LinearSolverLU, RefinementStrategy >::operator()(), Kaskade::AnotherHBErrorEstimator< Functional, VariableSetDescription, ExtensionVariableSetDescription, ExtensionSpace, NormFunctional, LinearSolverLA, LinearSolverHA, LinearSolverHU, LinearSolverLU, RefinementStrategy, lump >::operator()(), Kaskade::HierarchicalBasisErrorEstimator3< Functional, VariableSetDescription, ExtensionVariableSetDescription, ExtensionSpace, NormFunctional, LinearSolverLA, LinearSolverHA, LinearSolverLM, LinearSolverHM, lumpM, RefinementStrategy >::operator()(), Kaskade::DoRegularization< Linearization, VariableSet >::operator()(), Kaskade::LinearProductSpace< Scalar_, Seq >::operator*(), Kaskade::VariableSet< VSDescriptions >::operator=(), Kaskade::LinearProductSpace< Scalar_, Seq >::operator=(), Kaskade::projectHierarchically(), Kaskade::LinearProductSpace< Scalar_, Seq >::read(), Kaskade::Bridge::VectorTraits< VariableSet< Descr > >::scale(), Kaskade::LinearProductSpace< Scalar_, Seq >::vectorFromSequence(), Kaskade::LinearProductSpace< Scalar_, Seq >::vectorToSequence(), Kaskade::LinearProductSpace< Scalar_, Seq >::write(), Kaskade::writePartialFile(), and Kaskade::writeVTK().


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