|
Thyra Package Browser (Single Doxygen Collection) Version of the Day
|
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_MULTI_VECTOR_ADAPTER_BASE_DEF_HPP 00030 #define THYRA_MULTI_VECTOR_ADAPTER_BASE_DEF_HPP 00031 00032 #include "Thyra_MultiVectorAdapterBase_decl.hpp" 00033 #include "Thyra_ScalarProdVectorSpaceBase.hpp" 00034 #include "Thyra_ScalarProdBase.hpp" 00035 00036 00037 namespace Thyra { 00038 00039 00040 // Overridden functions from LinearOp 00041 00042 00043 template<class Scalar> 00044 RCP<const VectorSpaceBase<Scalar> > 00045 MultiVectorAdapterBase<Scalar>::range() const 00046 { 00047 return rangeScalarProdVecSpc(); 00048 } 00049 00050 00051 template<class Scalar> 00052 RCP<const VectorSpaceBase<Scalar> > 00053 MultiVectorAdapterBase<Scalar>::domain() const 00054 { 00055 return domainScalarProdVecSpc(); 00056 } 00057 00058 00059 // Overridden protected functions from LinearOpBase 00060 00061 00062 template<class Scalar> 00063 bool MultiVectorAdapterBase<Scalar>::opSupportedImpl(EOpTransp M_trans) const 00064 { 00065 if (ScalarTraits<Scalar>::isComplex) 00066 return (M_trans == NOTRANS || M_trans == CONJTRANS); 00067 return true; 00068 } 00069 00070 00071 template<class Scalar> 00072 void MultiVectorAdapterBase<Scalar>::applyImpl( 00073 const EOpTransp M_trans, 00074 const MultiVectorBase<Scalar> &X, 00075 const Ptr<MultiVectorBase<Scalar> > &Y, 00076 const Scalar alpha, 00077 const Scalar beta 00078 ) const 00079 { 00080 // 00081 // Perform: 00082 // 00083 // NOTRANS: Y = beta*Y + alpha * M * Q_D * X 00084 // 00085 // CONJTRANS: Y = beta*Y + alpha * M^H * Q_R * X 00086 // 00087 // where T = Q_D * X or Q_R * X 00088 // 00089 RCP<const ScalarProdVectorSpaceBase<Scalar> > scalarProdVecSpc = 00090 ( real_trans(M_trans) == NOTRANS 00091 ? domainScalarProdVecSpc() 00092 : rangeScalarProdVecSpc() ); 00093 RCP<const ScalarProdBase<Scalar> > scalarProd = scalarProdVecSpc->getScalarProd(); 00094 if (scalarProd->isEuclidean()) { 00095 // Y = beta*Y + alpha * op(M) * X 00096 this->euclideanApply(M_trans, X, Y, alpha, beta); 00097 } 00098 else { 00099 // T = Q * X 00100 RCP<MultiVectorBase<Scalar> > T = createMembers(X.range(), X.domain()); 00101 ::Thyra::apply(*scalarProd->getLinearOp(), NOTRANS, X, T.ptr()); 00102 // Y = beta*Y + alpha * op(M) * T 00103 this->euclideanApply(M_trans, *T, Y, alpha, beta); 00104 } 00105 } 00106 00107 00108 } // namespace Thyra 00109 00110 00111 #endif // THYRA_MULTI_VECTOR_ADAPTER_BASE_DEF_HPP
1.7.4