Thyra::MultiplicativeLinearOp< Scalar > Class Template Reference
[Thyra Operator/Vector Interfaces as an API for the Development of Abstract Numerical Algorithms (ANAs)]

Concrete composite LinearOpBase subclass that creates a multiplicative linear operator out of one or more constituent LinearOpBase objects. More...

#include <Thyra_MultiplicativeLinearOpDecl.hpp>

Inheritance diagram for Thyra::MultiplicativeLinearOp< Scalar >:

[legend]
List of all members.

Constructors/initializers/accessors

 MultiplicativeLinearOp ()
 Constructs to uninitialized.
 MultiplicativeLinearOp (const int numOps, const Teuchos::RefCountPtr< const LinearOpBase< Scalar > > Ops[], const Scalar &gamma=Teuchos::ScalarTraits< Scalar >::one())
void initialize (const int numOps, const Teuchos::RefCountPtr< const LinearOpBase< Scalar > > Ops[], const Scalar &gamma=Teuchos::ScalarTraits< Scalar >::one())
 Initialize given a list of linear operators.
int numOps () const
 Returns the current number of constituent operators.
Teuchos::RefCountPtr< const
LinearOpBase< Scalar > > 
getOp (const int k) const
 Return the kth constituent operator.
void uninitialize (const int numOps=0, Teuchos::RefCountPtr< const LinearOpBase< Scalar > > Ops[]=NULL, Scalar *gamma=NULL)
 Set to uninitialized.

Overridden from Teuchos::Describable

std::string description () const
 Prints just the name MultiplicativeLinearOp along with the overall dimensions and the number of constituent operators.
std::ostream & describe (std::ostream &out, const Teuchos::EVerbosityLevel verbLevel, const std::string leadingIndent, const std::string indentSpacer) const
 Prints the details about the constituent linear operators.

Overridden from OpBase

Teuchos::RefCountPtr< const
VectorSpaceBase< Scalar > > 
range () const
 Returns this->getOp(0).range().
Teuchos::RefCountPtr< const
VectorSpaceBase< Scalar > > 
domain () const
 Returns this->getOp(this->numOps()-1).domain().
bool opSupported (ETransp M_trans) const
 Returns true only if all constituent operators support M_trans.

Overridden from LinearOpBase

void apply (const ETransp M_trans, const MultiVectorBase< Scalar > &X, MultiVectorBase< Scalar > *Y, const Scalar alpha, const Scalar beta) const
 
Teuchos::RefCountPtr< const
LinearOpBase< Scalar > > 
clone () const
 

Detailed Description

template<class Scalar>
class Thyra::MultiplicativeLinearOp< Scalar >

Concrete composite LinearOpBase subclass that creates a multiplicative linear operator out of one or more constituent LinearOpBase objects.

This class represents a multiplicative linear operator M of the form:

 
 M = gamma * Op[0] * Op[1] * ... * Op[numOps-1]
 

where Op[] is an array of numOps LinearOp objects and gamma is a scalar. Of course the operator M is not constructed explicitly but instead just applies the constituent linear operators accordingly using temporaries.

In other words, this class defines apply() as:


 y = alpha*M*x + beta*y
   = (alpha*gamma) * ( Op[0] * ( Op[1] * ( .... ( Op[numOps-1] * x ) ... ) ) ) + beta * y
 

for the case where M_trans==NOTRANS and as:


 y = alpha*M'*x + beta*y
   = (alpha*gamma) * ( Op[numOps-1]' * ( .... ( Op[1]' * ( Op[0]' * x ) ) ... ) ) + beta * y
 

for the case where M_trans!=NOTRANS (where the transpose ' either defines TRANS or CONJTRANS).

Constructing a multiplicative operator is easy. For example, suppose one wants to construct the multiplicative operator D = gamma * A * B' * C. To do so one would do:

 template<class Scalar>
 void constructD(
    const Scalar                                                   &gamma
    ,const Teuchos::RefCountPtr<const Thyra::LinearOpBase<Scalar> >  &A
    ,const Teuchos::RefCountPtr<const Thyra::LinearOpBase<Scalar> >  &B
    ,const Teuchos::RefCountPtr<const Thyra::LinearOpBase<Scalar> >  &C
    ,Teuchos::RefCountPtr<const Thyra::LinearOpBase<Scalar> >        *D
    )
 {
   typedef Teuchos::RefCountPtr<const Thyra::LinearOpBase<Scalar> > LOB;
   *D = Teuchos::rcp(
     new Thyra::MultiplicativeLinearOp<Scalar>(
       3, Teuchos::arrayArg<LOB>(A,adjoin(B),C)(), gamma
       )
     );
 }

Rather than calling the constructor directly, consider using the non-member helper functions described here.

Definition at line 101 of file Thyra_MultiplicativeLinearOpDecl.hpp.


Constructor & Destructor Documentation

template<class Scalar>
Thyra::MultiplicativeLinearOp< Scalar >::MultiplicativeLinearOp  ) 
 

Constructs to uninitialized.

Postconditions:

Definition at line 40 of file Thyra_MultiplicativeLinearOp.hpp.

template<class Scalar>
Thyra::MultiplicativeLinearOp< Scalar >::MultiplicativeLinearOp const int  numOps,
const Teuchos::RefCountPtr< const LinearOpBase< Scalar > >  Ops[],
const Scalar &  gamma = Teuchos::ScalarTraits< Scalar >::one()
 

Calls initialize().

Rather than calling this constructor directly, consider using the non-member helper functions described here.

Definition at line 44 of file Thyra_MultiplicativeLinearOp.hpp.


Member Function Documentation

template<class Scalar>
void Thyra::MultiplicativeLinearOp< Scalar >::initialize const int  numOps,
const Teuchos::RefCountPtr< const LinearOpBase< Scalar > >  Ops[],
const Scalar &  gamma = Teuchos::ScalarTraits< Scalar >::one()
 

Initialize given a list of linear operators.

Parameters:
numOps [in] Number of constituent operators.
Ops [in] Array (length numOps) of constituent linear operators and their aggregated default definitions of the non-transposed operator.
gamma [in] Scalar multiplier
Preconditions:
  • numOps > 0
  • Ops != NULL
  • Ops[k].op().get()!=NULL, for k=0...numOps-1

Postconditions:

  • this->numOps()==numOps
  • this->getOp(k).op().get()==Ops[k].op().get(), for k=0...numOps-1
  • this->gamma()==gamma

Definition at line 54 of file Thyra_MultiplicativeLinearOp.hpp.

template<class Scalar>
int Thyra::MultiplicativeLinearOp< Scalar >::numOps  )  const [inline]
 

Returns the current number of constituent operators.

A return value of 0 indicates that this is not fully initialized.

Definition at line 310 of file Thyra_MultiplicativeLinearOpDecl.hpp.

template<class Scalar>
Teuchos::RefCountPtr< const LinearOpBase< Scalar > > Thyra::MultiplicativeLinearOp< Scalar >::getOp const int  k  )  const [inline]
 

Return the kth constituent operator.

Parameters:
k [in] The zero-based index of the constituent operator to return.
Preconditions:

Definition at line 317 of file Thyra_MultiplicativeLinearOpDecl.hpp.

template<class Scalar>
void Thyra::MultiplicativeLinearOp< Scalar >::uninitialize const int  numOps = 0,
Teuchos::RefCountPtr< const LinearOpBase< Scalar > >  Ops[] = NULL,
Scalar *  gamma = NULL
 

Set to uninitialized.

Parameters:
numOps [in] Number of operators (must be numOps==this->numOps()).
Ops [out] Array (length numOps) that if Ops!=NULL then Ops[k] will be set to this->getOp(k), for k=0...numOps-1.
gamma [out] Optional pointer to scalar gamma. If gamma!=NULL then on output *gamma is set to this->gamma() (before call).
Preconditions:

Postconditions:

Definition at line 78 of file Thyra_MultiplicativeLinearOp.hpp.

template<class Scalar>
std::string Thyra::MultiplicativeLinearOp< Scalar >::description  )  const
 

Prints just the name MultiplicativeLinearOp along with the overall dimensions and the number of constituent operators.

Definition at line 96 of file Thyra_MultiplicativeLinearOp.hpp.

template<class Scalar>
std::ostream & Thyra::MultiplicativeLinearOp< Scalar >::describe std::ostream &  out,
const Teuchos::EVerbosityLevel  verbLevel,
const std::string  leadingIndent,
const std::string  indentSpacer
const
 

Prints the details about the constituent linear operators.

This function outputs different levels of detail based on the value passed in for verbLevel:

ToDo: Finish documentation!

Definition at line 106 of file Thyra_MultiplicativeLinearOp.hpp.

template<class Scalar>
Teuchos::RefCountPtr< const VectorSpaceBase< Scalar > > Thyra::MultiplicativeLinearOp< Scalar >::range  )  const
 

Returns this->getOp(0).range().

Preconditions:

Definition at line 145 of file Thyra_MultiplicativeLinearOp.hpp.

template<class Scalar>
Teuchos::RefCountPtr< const VectorSpaceBase< Scalar > > Thyra::MultiplicativeLinearOp< Scalar >::domain  )  const
 

Returns this->getOp(this->numOps()-1).domain().

Preconditions:

Definition at line 153 of file Thyra_MultiplicativeLinearOp.hpp.

template<class Scalar>
bool Thyra::MultiplicativeLinearOp< Scalar >::opSupported ETransp  M_trans  )  const [virtual]
 

Returns true only if all constituent operators support M_trans.

Implements Thyra::SingleScalarLinearOpBase< Scalar >.

Definition at line 160 of file Thyra_MultiplicativeLinearOp.hpp.

template<class Scalar>
void Thyra::MultiplicativeLinearOp< Scalar >::apply const ETransp  M_trans,
const MultiVectorBase< Scalar > &  X,
MultiVectorBase< Scalar > *  Y,
const Scalar  alpha,
const Scalar  beta
const [virtual]
 

Implements Thyra::SingleScalarLinearOpBase< Scalar >.

Definition at line 172 of file Thyra_MultiplicativeLinearOp.hpp.

template<class Scalar>
Teuchos::RefCountPtr< const LinearOpBase< Scalar > > Thyra::MultiplicativeLinearOp< Scalar >::clone  )  const
 

Definition at line 226 of file Thyra_MultiplicativeLinearOp.hpp.


The documentation for this class was generated from the following files:
Generated on Thu Sep 18 12:39:54 2008 for Thyra ANA Operator/VectorBase Interfaces and Related Software by doxygen 1.3.9.1