#include <linop_base.hh>
Inheritance diagram for RVL::LinearOp< Scalar >:
Public Member Functions | |
LinearOp () | |
LinearOp (const LinearOp< Scalar > &Op) | |
virtual | ~LinearOp () |
void | applyOp (Vector< Scalar > const &x, Vector< Scalar > &y) const |
This function assigns to the value . | |
void | applyAdjOp (Vector< Scalar > const &x, Vector< Scalar > &y) const |
This function assigns to the value . | |
virtual void | applyPlusOp (Vector< Scalar > const &x, Vector< Scalar > &y) const |
Apply and increment, like axpy: . | |
virtual void | applyPlusAdjOp (Vector< Scalar > const &x, Vector< Scalar > &y) const |
Apply and increment, like axpy: . | |
virtual void | applyOp (Scalar alpha, Vector< Scalar > const &x, Scalar beta, Vector< Scalar > &y) const |
Apply and linear combination: . | |
virtual void | applyAdjOp (Scalar alpha, Vector< Scalar > const &x, Scalar beta, Vector< Scalar > &y) const |
Adjoint apply and linear combination: . | |
Protected Member Functions | |
void * | operator new (size_t size) |
operator new - not available to general public, but available to children who will use it to define a clone method, for example | |
virtual void | applyAdj (const Vector< Scalar > &x, Vector< Scalar > &y) const =0 |
Evaluation of adjoint linear operator on constant input vector x, output written on mutable vector y. | |
void | applyDeriv (const Vector< Scalar > &, const Vector< Scalar > &dx, Vector< Scalar > &dy) const |
implemented derivative method - a linear operator is its own derivative. | |
void | applyAdjDeriv (const Vector< Scalar > &, const Vector< Scalar > &dy, Vector< Scalar > &dx) const |
similar to applyDeriv. | |
void | applyDeriv2 (const Vector< Scalar > &, const Vector< Scalar > &, const Vector< Scalar > &, Vector< Scalar > &dy) const |
implemented deriv2 method - deriv2 of a linear operator is zero. | |
void | applyAdjDeriv2 (const Vector< Scalar > &, const Vector< Scalar > &, const Vector< Scalar > &, Vector< Scalar > &dx1) const |
similar to applyDeriv |
Since linear operators in Hilbert space have well-defined adjoints, this class really defines a pair of operators, adjoint to each other.
The abstract public interface consists of
The applyOp() method accepts a const RVL::Vector argument representing the input vector, and a mutable RVL::Vector argument representing the ouput. The input must be a member of the domain, and the output a member of the range, and these conditions are checked in the method body using RVL::Space::operator=, RVL::Vector::getSpace, and the getDomain and getRange methods of this class. Similarly the applyAdjOp method implements application of the adjoint, and sanity-checks its arguments as well. Note that both applyOp and applyAdjOp are implemented, and may not be overridden in child classes.
The applyOp and applyAdjOp methods delegate the computations inherent in the action of the linear operator and its adjoint to two pure virtual protected methods, apply and applyAdj, which accept the same arguments. The subclass writer will thus need to implement apply and applyAdj. This device permits the sanity tests for membership in domain and range to be hard-coded in applyOp and applyAdjOp, relieving the subclass writer of the necessity to test the dimensional and other conditions implicit in membership.
A protected pure virtual copy constructor (clone) must also be supplied; a typical implementation delegates to the copy constructor of the subclass.
In summary, the subclass writer must implement three protected methods:
and two public methods (usually by returning reference member data):
A unit test for validity of the adjoint relationship is supplied as part of RVL, in the form of a standalone function (AdjointTest). It is HIGHLY RECOMMENDED that every concrete LinearOp implementation be subjected to this test.
Definition at line 123 of file linop_base.hh.
RVL::LinearOp< Scalar >::LinearOp | ( | ) |
Definition at line 182 of file linop_base.hh.
RVL::LinearOp< Scalar >::LinearOp | ( | const LinearOp< Scalar > & | Op | ) |
Definition at line 183 of file linop_base.hh.
virtual RVL::LinearOp< Scalar >::~LinearOp | ( | ) | [virtual] |
Definition at line 184 of file linop_base.hh.
void* RVL::LinearOp< Scalar >::operator new | ( | size_t | size | ) | [protected] |
operator new - not available to general public, but available to children who will use it to define a clone method, for example
Version 1.0: user control, for the bold. "There are old sailors, and there are bold sailors, but there are no old, bold sailors."
Reimplemented from RVL::Operator< Scalar >.
Definition at line 137 of file linop_base.hh.
virtual void RVL::LinearOp< Scalar >::applyAdj | ( | const Vector< Scalar > & | x, | |
Vector< Scalar > & | y | |||
) | const [protected, pure virtual] |
Evaluation of adjoint linear operator on constant input vector x, output written on mutable vector y.
Accessed only through public applyOp method, so creator of subclasses may assume that input is in domain, output is in range
Implemented in RVL::BlockLinearOp< Scalar >, RVL::BlockLinearOpBlock< Scalar >, RVL::ColumnLinearOp< Scalar >, RVL::CompLinearOp< Scalar >, RVL::LinearOpFO< Scalar >, RVL::AdjLinearOp< Scalar >, RVL::NormalLinearOp< Scalar >, RVL::ScaleOpFwd< Scalar >, RVL::ScaleOpInv< Scalar >, RVL::LinCombLinearOp< Scalar >, RVL::LinearBilinearOp< Scalar >, RVL::LinearRestrictOp< Scalar >, RVL::DerivEvaluation< Scalar >, and RVL::PartialDerivEvaluation< Scalar >.
Referenced by RVL::LinearOp< Scalar >::applyAdjDeriv(), and RVL::LinearOp< Scalar >::applyAdjOp().
void RVL::LinearOp< Scalar >::applyDeriv | ( | const Vector< Scalar > & | , | |
const Vector< Scalar > & | dx, | |||
Vector< Scalar > & | dy | |||
) | const [protected, virtual] |
implemented derivative method - a linear operator is its own derivative.
First arg: position, of which result is independent.
Implements RVL::Operator< Scalar >.
Definition at line 156 of file linop_base.hh.
References RVL::Operator< Scalar >::apply().
void RVL::LinearOp< Scalar >::applyAdjDeriv | ( | const Vector< Scalar > & | , | |
const Vector< Scalar > & | dy, | |||
Vector< Scalar > & | dx | |||
) | const [protected, virtual] |
similar to applyDeriv.
First arg: position, of which result is independent.
Implements RVL::Operator< Scalar >.
Definition at line 161 of file linop_base.hh.
References RVL::LinearOp< Scalar >::applyAdj().
void RVL::LinearOp< Scalar >::applyDeriv2 | ( | const Vector< Scalar > & | , | |
const Vector< Scalar > & | , | |||
const Vector< Scalar > & | , | |||
Vector< Scalar > & | dy | |||
) | const [protected, virtual] |
implemented deriv2 method - deriv2 of a linear operator is zero.
First three args: position, two perturbation vectors in domain - result is independent of these.
Reimplemented from RVL::Operator< Scalar >.
Definition at line 169 of file linop_base.hh.
References RVL::Vector< Scalar >::zero().
void RVL::LinearOp< Scalar >::applyAdjDeriv2 | ( | const Vector< Scalar > & | , | |
const Vector< Scalar > & | , | |||
const Vector< Scalar > & | , | |||
Vector< Scalar > & | dx1 | |||
) | const [protected, virtual] |
similar to applyDeriv
Reimplemented from RVL::Operator< Scalar >.
Definition at line 175 of file linop_base.hh.
References RVL::Vector< Scalar >::zero().
void RVL::LinearOp< Scalar >::applyOp | ( | Vector< Scalar > const & | x, | |
Vector< Scalar > & | y | |||
) | const |
This function assigns to the value .
Output vector y may not be aliased with input vector x. Applies standard sanity test, then delegates to protected apply method.
Definition at line 193 of file linop_base.hh.
References RVL::Operator< Scalar >::apply(), RVL::Operator< Scalar >::getDomain(), RVL::Operator< Scalar >::getRange(), RVL::Vector< Scalar >::getSpace(), and RVL::Writeable::write().
Referenced by RVL::AdjointTest(), RVL::CompLinearOp< Scalar >::apply(), RVL::ScaleOpFwd< Scalar >::applyAdj(), RVL::NormalLinearOp< Scalar >::applyAdj(), RVL::LinearOp< Scalar >::applyOp(), and RVL::LinearOp< Scalar >::applyPlusOp().
void RVL::LinearOp< Scalar >::applyAdjOp | ( | Vector< Scalar > const & | x, | |
Vector< Scalar > & | y | |||
) | const |
This function assigns to the value .
Output vector y may not be aliased with input vector x. Applies standard sanity test, then delegates to protected applyAdj method.
Definition at line 252 of file linop_base.hh.
References RVL::LinearOp< Scalar >::applyAdj(), RVL::Operator< Scalar >::getDomain(), RVL::Operator< Scalar >::getRange(), RVL::Vector< Scalar >::getSpace(), and RVL::Writeable::write().
Referenced by RVL::AdjointTest(), RVL::CompLinearOp< Scalar >::applyAdj(), RVL::LinearOp< Scalar >::applyAdjOp(), and RVL::LinearOp< Scalar >::applyPlusAdjOp().
virtual void RVL::LinearOp< Scalar >::applyPlusOp | ( | Vector< Scalar > const & | x, | |
Vector< Scalar > & | y | |||
) | const [virtual] |
Apply and increment, like axpy: .
Obvious default implementation provided for convenience, can be overridden to fuse loops for efficiency, if desired. Output vector y may not be aliased with input vector x.
Definition at line 310 of file linop_base.hh.
References RVL::LinearOp< Scalar >::applyOp(), and RVL::Vector< Scalar >::linComb().
virtual void RVL::LinearOp< Scalar >::applyPlusAdjOp | ( | Vector< Scalar > const & | x, | |
Vector< Scalar > & | y | |||
) | const [virtual] |
Apply and increment, like axpy: .
Obvious default implementation provided for convenience, can be overridden to fuse loops for efficiency, if desired. Output vector y may not be aliased with input vector x.
Definition at line 328 of file linop_base.hh.
References RVL::LinearOp< Scalar >::applyAdjOp(), and RVL::Vector< Scalar >::linComb().
virtual void RVL::LinearOp< Scalar >::applyOp | ( | Scalar | alpha, | |
Vector< Scalar > const & | x, | |||
Scalar | beta, | |||
Vector< Scalar > & | y | |||
) | const [virtual] |
Apply and linear combination: .
Obvious default implementation provided for convenience, can be overridden to fuse loops for efficiency, if desired. Output vector y may not be aliased with input vector x.
Definition at line 346 of file linop_base.hh.
References RVL::LinearOp< Scalar >::applyOp(), and RVL::Vector< Scalar >::linComb().
virtual void RVL::LinearOp< Scalar >::applyAdjOp | ( | Scalar | alpha, | |
Vector< Scalar > const & | x, | |||
Scalar | beta, | |||
Vector< Scalar > & | y | |||
) | const [virtual] |
Adjoint apply and linear combination: .
Obvious default implementation provided for convenience, can be overridden to fuse loops for efficiency, if desired. Output vector y may not be aliased with input vector x.
Definition at line 365 of file linop_base.hh.
References RVL::LinearOp< Scalar >::applyAdjOp(), and RVL::Vector< Scalar >::linComb().