Thyra_LinearOperatorDecl.hpp

00001 // @HEADER
00002 // ***********************************************************************
00003 // 
00004 //    Thyra: Interfaces and Support for Abstract Numerical Algorithms
00005 //                 Copyright (2004) Sandia Corporation
00006 // 
00007 // Under terms of Contract DE-AC04-94AL85000, there is a non-exclusive
00008 // license for use of this work by or on behalf of the U.S. Government.
00009 // 
00010 // This library is free software; you can redistribute it and/or modify
00011 // it under the terms of the GNU Lesser General Public License as
00012 // published by the Free Software Foundation; either version 2.1 of the
00013 // License, or (at your option) any later version.
00014 //  
00015 // This library is distributed in the hope that it will be useful, but
00016 // WITHOUT ANY WARRANTY; without even the implied warranty of
00017 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00018 // Lesser General Public License for more details.
00019 //  
00020 // You should have received a copy of the GNU Lesser General Public
00021 // License along with this library; if not, write to the Free Software
00022 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
00023 // USA
00024 // Questions? Contact Michael A. Heroux (maherou@sandia.gov) 
00025 // 
00026 // ***********************************************************************
00027 // @HEADER
00028 
00029 #ifndef THYRA_LINEAROPERATOR_DECL_HPP
00030 #define THYRA_LINEAROPERATOR_DECL_HPP
00031 
00032 #include "Teuchos_Handle.hpp"
00033 #include "Thyra_VectorSpaceDecl.hpp"
00034 #include "Thyra_ConfigDefs.hpp"
00035 #include "Thyra_LinearOpBaseDecl.hpp"
00036 
00037 namespace Thyra
00038 {
00039 
00045  template <class RangeScalar, class DomainScalar=RangeScalar>
00046   class ConstLinearOperator 
00047     : public virtual Teuchos::ConstHandle<LinearOpBase<RangeScalar, DomainScalar> >
00048   {
00049   public:
00050 
00051     typedef RangeScalar Scalar;
00052 
00054     ConstLinearOperator( const Teuchos::ENull _null = Teuchos::null )
00055       : Teuchos::ConstHandle<LinearOpBase<RangeScalar, DomainScalar> >(){;}
00056 
00058     ConstLinearOperator(Teuchos::ConstHandleable<LinearOpBase<RangeScalar, DomainScalar> >* rawPtr) 
00059       : Teuchos::ConstHandle<LinearOpBase<RangeScalar, DomainScalar> >(rawPtr){;}
00060 
00062     ConstLinearOperator(const Teuchos::RCP<const LinearOpBase<RangeScalar, DomainScalar> >& smartPtr) 
00063       : Teuchos::ConstHandle<LinearOpBase<RangeScalar, DomainScalar> >(smartPtr){;}
00064 
00066     const VectorSpace<DomainScalar> domain() const ;
00067 
00069     const VectorSpace<RangeScalar> range() const ;
00070 
00078     void apply(const ConstVector<DomainScalar>& in,
00079                Vector<RangeScalar>& out,
00080                const RangeScalar& alpha = 1.0,
00081                const RangeScalar& beta = 0.0) const ;
00082 
00090     void applyTranspose(const ConstVector<RangeScalar>& in,
00091                         Vector<DomainScalar>& out,
00092                         const DomainScalar& alpha = 1.0,
00093                         const DomainScalar& beta = 0.0) const ;
00094 
00095 
00097     int numBlockRows() const ;
00098 
00100     int numBlockCols() const ;
00101 
00103     ConstLinearOperator<RangeScalar, DomainScalar> getBlock(int blockRow, int blockCol) const ;
00104 
00105   };
00106 
00112   template <class RangeScalar, class DomainScalar=RangeScalar>
00113   class LinearOperator 
00114     : public Teuchos::Handle<LinearOpBase<RangeScalar, DomainScalar> >,
00115       public ConstLinearOperator<RangeScalar, DomainScalar>
00116   {
00117   public:
00118 
00119     typedef RangeScalar Scalar;
00120 
00122     LinearOperator( const Teuchos::ENull _null = Teuchos::null )
00123       : Teuchos::Handle<LinearOpBase<RangeScalar, DomainScalar> >(){;}
00124 
00126     LinearOperator(Teuchos::Handleable<LinearOpBase<RangeScalar, DomainScalar> >* rawPtr) 
00127       : Teuchos::Handle<LinearOpBase<RangeScalar, DomainScalar> >(rawPtr){;}
00128 
00130     LinearOperator(const Teuchos::RCP<LinearOpBase<RangeScalar, DomainScalar> >& smartPtr) 
00131       : Teuchos::Handle<LinearOpBase<RangeScalar, DomainScalar> >(smartPtr){;}
00132 
00134     LinearOperator<RangeScalar, DomainScalar> getBlock(int blockRow, int blockCol) ;
00135 
00136   };
00137 
00142   template <class Scalar>
00143   ConstLinearOperator<Scalar>
00144   operator*(const Scalar& a, 
00145             const ConstLinearOperator<Scalar>& A);
00146 
00151   template <class Scalar>
00152   LinearOperator<Scalar>
00153   operator*(const Scalar& a, 
00154             const LinearOperator<Scalar>& A);
00155 
00160   template <class Scalar>
00161   ConstLinearOperator<Scalar>
00162   operator*(const ConstLinearOperator<Scalar>& A,
00163             const Scalar& a);
00164 
00169   template <class Scalar>
00170   LinearOperator<Scalar>
00171   operator*(const LinearOperator<Scalar>& A,
00172             const Scalar& a);
00173 
00178   template <class Scalar>
00179   ConstLinearOperator<Scalar>
00180   operator*(const ConstLinearOperator<Scalar>& A,
00181             const ConstLinearOperator<Scalar>& B);
00182 
00187   template <class Scalar>
00188   LinearOperator<Scalar>
00189   operator*(const LinearOperator<Scalar>& A,
00190             const LinearOperator<Scalar>& B);
00191 
00196   template <class Scalar>
00197   ConstLinearOperator<Scalar>
00198   operator+(const ConstLinearOperator<Scalar>& A,
00199             const ConstLinearOperator<Scalar>& B);
00200 
00205   template <class Scalar>
00206   LinearOperator<Scalar>
00207   operator+(const LinearOperator<Scalar>& A,
00208             const LinearOperator<Scalar>& B);
00209     
00215   template<class Scalar>
00216   ConstLinearOperator<Scalar>
00217   block2x2(
00218            const ConstLinearOperator<Scalar>&   A00,
00219            const ConstLinearOperator<Scalar>&   A01,
00220            const ConstLinearOperator<Scalar>&   A10,
00221            const ConstLinearOperator<Scalar>&   A11
00222            );
00223 
00228   template<class Scalar>
00229   ConstLinearOperator<Scalar>
00230   block2x1(
00231            const ConstLinearOperator<Scalar>&    A00,
00232            const ConstLinearOperator<Scalar>&   A10
00233            );
00234 
00239   template<class Scalar>
00240   ConstLinearOperator<Scalar>
00241   block1x2(
00242            const ConstLinearOperator<Scalar>&    A00,
00243            const ConstLinearOperator<Scalar>&   A01
00244            );
00245   
00251   template<class Scalar>
00252   LinearOperator<Scalar>
00253   block2x2(
00254            const LinearOperator<Scalar>&    A00,
00255            const LinearOperator<Scalar>&   A01,
00256            const LinearOperator<Scalar>&   A10,
00257            const LinearOperator<Scalar>&   A11
00258            );
00259 
00264   template<class Scalar>
00265   LinearOperator<Scalar>
00266   block2x1(
00267            const LinearOperator<Scalar>&    A00,
00268            const LinearOperator<Scalar>&   A10
00269            );
00270 
00275   template<class Scalar>
00276   LinearOperator<Scalar>
00277   block1x2(
00278            const LinearOperator<Scalar>&    A00,
00279            const LinearOperator<Scalar>&   A01
00280            );
00281 
00283   template<class Scalar>
00284   ConstLinearOperator<Scalar>
00285   identity( const VectorSpace<Scalar> &space );
00286 
00288   template<class Scalar>
00289   ConstLinearOperator<Scalar>
00290   zero( const VectorSpace<Scalar> &range, const VectorSpace<Scalar> &domain );
00291 
00292 } // namespace Thyra
00293 
00294 #endif

Generated on Wed May 12 21:26:54 2010 for Thyra Operator/Vector Support by  doxygen 1.4.7