Reference documentation for deal.II version Git 20e5cff 2017-01-17 12:52:29 -0500
Public Member Functions | Public Attributes | List of all members
LinearOperator< Range, Domain > Class Template Reference

#include <deal.II/lac/linear_operator.h>

Inheritance diagram for LinearOperator< Range, Domain >:
[legend]

Public Member Functions

 LinearOperator ()
 
 LinearOperator (const LinearOperator< Range, Domain > &)=default
 
template<typename Op , typename = typename std::enable_if<!std::is_base_of<LinearOperator<Range, Domain>, Op>::value>::type>
 LinearOperator (const Op &op)
 
LinearOperator< Range, Domain > & operator= (const LinearOperator< Range, Domain > &)=default
 
template<typename Op , typename = typename std::enable_if<!std::is_base_of<LinearOperator<Range, Domain>, Op>::value>::type>
LinearOperator< Range, Domain > & operator= (const Op &op)
 

Public Attributes

std::function< void(Range &v, const Domain &u)> vmult
 
std::function< void(Range &v, const Domain &u)> vmult_add
 
std::function< void(Domain &v, const Range &u)> Tvmult
 
std::function< void(Domain &v, const Range &u)> Tvmult_add
 
std::function< void(Range &v, bool omit_zeroing_entries)> reinit_range_vector
 
std::function< void(Domain &v, bool omit_zeroing_entries)> reinit_domain_vector
 

Related Functions

(Note that these are not member functions.)

Indirectly applying constraints to LinearOperator
template<typename Range , typename Domain >
LinearOperator< Range, Domain > distribute_constraints_linear_operator (const ConstraintMatrix &constraint_matrix, const LinearOperator< Range, Domain > &exemplar)
 
template<typename Range , typename Domain >
LinearOperator< Range, Domain > project_to_constrained_linear_operator (const ConstraintMatrix &constraint_matrix, const LinearOperator< Range, Domain > &exemplar)
 
template<typename Range , typename Domain >
LinearOperator< Range, Domain > constrained_linear_operator (const ConstraintMatrix &constraint_matrix, const LinearOperator< Range, Domain > &linop)
 
template<typename Range , typename Domain >
PackagedOperation< Range > constrained_right_hand_side (const ConstraintMatrix &constraint_matrix, const LinearOperator< Range, Domain > &linop, const Range &right_hand_side)
 
Vector space operations
template<typename Range , typename Domain >
LinearOperator< Range, Domain > operator+ (const LinearOperator< Range, Domain > &first_op, const LinearOperator< Range, Domain > &second_op)
 
template<typename Range , typename Domain >
LinearOperator< Range, Domain > operator- (const LinearOperator< Range, Domain > &first_op, const LinearOperator< Range, Domain > &second_op)
 
template<typename Range , typename Domain >
LinearOperator< Range, Domain > operator* (typename Range::value_type number, const LinearOperator< Range, Domain > &op)
 
template<typename Range , typename Domain >
LinearOperator< Range, Domain > operator* (const LinearOperator< Range, Domain > &op, typename Domain::value_type number)
 
Composition and manipulation of a LinearOperator
template<typename Range , typename Intermediate , typename Domain >
LinearOperator< Range, Domain > operator* (const LinearOperator< Range, Intermediate > &first_op, const LinearOperator< Intermediate, Domain > &second_op)
 
template<typename Range , typename Domain >
LinearOperator< Domain, Range > transpose_operator (const LinearOperator< Range, Domain > &op)
 
template<typename Solver , typename Preconditioner >
LinearOperator< typename Solver::vector_type, typename Solver::vector_typeinverse_operator (const LinearOperator< typename Solver::vector_type, typename Solver::vector_type > &op, Solver &solver, const Preconditioner &preconditioner)
 
Creation of a LinearOperator
template<typename Range >
LinearOperator< Range, Range > identity_operator (const std::function< void(Range &, bool)> &reinit_vector)
 
template<typename Range , typename Domain >
LinearOperator< Range, Domain > null_operator (const LinearOperator< Range, Domain > &op)
 
template<typename Range , typename Domain , typename Matrix >
LinearOperator< Range, Domain > linear_operator (const Matrix &matrix)
 
template<typename Range , typename Domain , typename OperatorExemplar , typename Matrix >
LinearOperator< Range, Domain > linear_operator (const OperatorExemplar &operator_exemplar, const Matrix &matrix)
 
Creation of a LinearOperator related to the Schur Complement
template<typename Range_1 , typename Domain_1 , typename Range_2 , typename Domain_2 >
LinearOperator< Range_2, Domain_2 > schur_complement (const LinearOperator< Domain_1, Range_1 > &A_inv, const LinearOperator< Range_1, Domain_2 > &B, const LinearOperator< Range_2, Domain_1 > &C, const LinearOperator< Range_2, Domain_2 > &D)
 

In-place vector space operations

bool is_null_operator
 
LinearOperator< Range, Domain > & operator+= (const LinearOperator< Range, Domain > &second_op)
 
LinearOperator< Range, Domain > & operator-= (const LinearOperator< Range, Domain > &second_op)
 
LinearOperator< Range, Domain > & operator*= (const LinearOperator< Domain, Domain > &second_op)
 
LinearOperator< Range, Domain > operator*= (typename Domain::value_type number)
 

Detailed Description

template<typename Range, typename Domain>
class LinearOperator< Range, Domain >

A class to store the abstract concept of a linear operator.

The class essentially consists of std::function objects that store the knowledge of how to apply the linear operator by implementing the abstract Matrix interface:

std::function<void(Range &, const Domain &)> vmult;
std::function<void(Range &, const Domain &)> vmult_add;
std::function<void(Domain &, const Range &)> Tvmult;
std::function<void(Domain &, const Range &)> Tvmult_add;

But, in contrast to a usual matrix object, the domain and range of the linear operator are also bound to the LinearOperator class on the type level. Because of this, LinearOperator <Range, Domain> has two additional function objects

std::function<void(Range &, bool)> reinit_range_vector;
std::function<void(Domain &, bool)> reinit_domain_vector;

that store the knowledge how to initialize (resize + internal data structures) an arbitrary vector of the Range and Domain space.

The primary purpose of this class is to provide syntactic sugar for complex matrix-vector operations and free the user from having to create, set up and handle intermediate storage locations by hand.

As an example consider the operation \((A+k\,B)\,C\), where \(A\), \(B\) and \(C\) denote (possible different) matrices. In order to construct a LinearOperator op that stores the knowledge of this operation, one can write:

const double k = ...;
// Setup and assembly of matrices
const auto op_a = linear_operator(A);
const auto op_b = linear_operator(B);
const auto op_c = linear_operator(C);
const auto op = (op_a + k * op_b) * op_c;
Note
This class makes heavy use of std::function objects and lambda functions. This flexibility comes with a run-time penalty. Only use this object to encapsulate matrix object of medium to large size (as a rule of thumb, sparse matrices with a size \(1000\times1000\), or larger).
This class is only available if deal.II was configured with C++11 support, i.e., if DEAL_II_WITH_CXX11 is enabled during cmake configure.
Author
Luca Heltai, Matthias Maier, 2015

Definition at line 36 of file linear_operator.h.

Constructor & Destructor Documentation

template<typename Range, typename Domain>
LinearOperator< Range, Domain >::LinearOperator ( )
inline

Create an empty LinearOperator object. All std::function member objects are initialized with default variants that throw an exception upon invocation.

Definition at line 124 of file linear_operator.h.

template<typename Range, typename Domain>
LinearOperator< Range, Domain >::LinearOperator ( const LinearOperator< Range, Domain > &  )
default

Default copy constructor.

template<typename Range, typename Domain>
template<typename Op , typename = typename std::enable_if<!std::is_base_of<LinearOperator<Range, Domain>, Op>::value>::type>
LinearOperator< Range, Domain >::LinearOperator ( const Op &  op)
inline

Templated copy constructor that creates a LinearOperator object from an object op for which the conversion function linear_operator is defined.

Definition at line 178 of file linear_operator.h.

Member Function Documentation

template<typename Range, typename Domain>
LinearOperator<Range, Domain>& LinearOperator< Range, Domain >::operator= ( const LinearOperator< Range, Domain > &  )
default

Default copy assignment operator.

template<typename Range, typename Domain>
template<typename Op , typename = typename std::enable_if<!std::is_base_of<LinearOperator<Range, Domain>, Op>::value>::type>
LinearOperator<Range, Domain>& LinearOperator< Range, Domain >::operator= ( const Op &  op)
inline

Templated copy assignment operator for an object op for which the conversion function linear_operator is defined.

Definition at line 195 of file linear_operator.h.

template<typename Range, typename Domain>
LinearOperator<Range, Domain>& LinearOperator< Range, Domain >::operator+= ( const LinearOperator< Range, Domain > &  second_op)
inline

Addition with a LinearOperator second_op with the same Domain and Range.

Definition at line 253 of file linear_operator.h.

template<typename Range, typename Domain>
LinearOperator<Range, Domain>& LinearOperator< Range, Domain >::operator-= ( const LinearOperator< Range, Domain > &  second_op)
inline

Subtraction with a LinearOperator second_op with the same Domain and Range.

Definition at line 264 of file linear_operator.h.

template<typename Range, typename Domain>
LinearOperator<Range, Domain>& LinearOperator< Range, Domain >::operator*= ( const LinearOperator< Domain, Domain > &  second_op)
inline

Composition of the LinearOperator with an endomorphism second_op of the Domain space.

Definition at line 275 of file linear_operator.h.

template<typename Range, typename Domain>
LinearOperator<Range, Domain> LinearOperator< Range, Domain >::operator*= ( typename Domain::value_type  number)
inline

Scalar multiplication of the LinearOperator with number from the right.

Definition at line 286 of file linear_operator.h.

Member Data Documentation

template<typename Range, typename Domain>
std::function<void(Range &v, const Domain &u)> LinearOperator< Range, Domain >::vmult

Application of the LinearOperator object to a vector u of the Domain space giving a vector v of the Range space.

Definition at line 205 of file linear_operator.h.

template<typename Range, typename Domain>
std::function<void(Range &v, const Domain &u)> LinearOperator< Range, Domain >::vmult_add

Application of the LinearOperator object to a vector u of the Domain space. The result is added to the vector v.

Definition at line 211 of file linear_operator.h.

template<typename Range, typename Domain>
std::function<void(Domain &v, const Range &u)> LinearOperator< Range, Domain >::Tvmult

Application of the transpose LinearOperator object to a vector u of the Range space giving a vector v of the Domain space.

Definition at line 217 of file linear_operator.h.

template<typename Range, typename Domain>
std::function<void(Domain &v, const Range &u)> LinearOperator< Range, Domain >::Tvmult_add

Application of the transpose LinearOperator object to a vector u of the Range space.The result is added to the vector v.

Definition at line 223 of file linear_operator.h.

template<typename Range, typename Domain>
std::function<void(Range &v, bool omit_zeroing_entries)> LinearOperator< Range, Domain >::reinit_range_vector

Initializes a vector v of the Range space to be directly usable as the destination parameter in an application of vmult. Similar to the reinit functions of the vector classes, the boolean determines whether a fast initalization is done, i.e., if it is set to false the content of the vector is set to 0.

Definition at line 232 of file linear_operator.h.

template<typename Range, typename Domain>
std::function<void(Domain &v, bool omit_zeroing_entries)> LinearOperator< Range, Domain >::reinit_domain_vector

Initializes a vector of the Domain space to be directly usable as the source parameter in an application of vmult. Similar to the reinit functions of the vector classes, the boolean determines whether a fast initalization is done, i.e., if it is set to false the content of the vector is set to 0.

Definition at line 241 of file linear_operator.h.

template<typename Range, typename Domain>
bool LinearOperator< Range, Domain >::is_null_operator

This bool is used to determine whether a linear operator is a null operator. In this case the class is able to optimize some operations like multiplication or addition.

Definition at line 297 of file linear_operator.h.


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