9 #ifndef Thyra_MultiVectorLinearOp_hpp
10 #define Thyra_MultiVectorLinearOp_hpp
12 #include "Thyra_RowStatLinearOpBase.hpp"
13 #include "Thyra_ScaledLinearOpBase.hpp"
14 #include "Thyra_DefaultMultiVectorProductVectorSpace.hpp"
15 #include "Thyra_DefaultMultiVectorProductVector.hpp"
16 #include "Teuchos_ConstNonconstObjectContainer.hpp"
17 #include "Thyra_VectorStdOps.hpp"
18 #include "Thyra_MultiVectorStdOps.hpp"
19 #include "Thyra_AssertOp.hpp"
20 #include "Teuchos_dyn_cast.hpp"
28 template<
class Scalar>
63 RCP<LinearOpBase<Scalar> >
66 RCP<const LinearOpBase<Scalar> >
84 RCP<const LinearOpBase<Scalar> >
clone()
const {
return Teuchos::null;
109 for (
Ordinal col_j = 0; col_j < numCols; ++col_j) {
111 const RCP<const VectorBase<Scalar> > x = XX.
col(col_j);
112 const RCP<VectorBase<Scalar> > y = YY->col(col_j);
114 RCP<const MultiVectorBase<Scalar> >
115 X =
dyn_cast<
const MVPV>(*x).getMultiVector().assert_not_null();
116 RCP<MultiVectorBase<Scalar> >
117 Y =
dyn_cast<MVPV>(*y).getNonconstMultiVector().assert_not_null();
119 Thyra::apply( *
op_.
getConstObj(), M_trans, *X, Y.ptr(), alpha, beta );
130 const RowStatLinearOpBaseUtils::ERowStat rowStat
132 {
using Teuchos::rcp_dynamic_cast;
140 const RowStatLinearOpBaseUtils::ERowStat rowStat,
152 using Teuchos::rcp_dynamic_cast;
153 RCP<MultiVectorBase<Scalar> > rowStatMultiVec =
154 dyn_cast<MVPV>(*rowStatVec).getNonconstMultiVector().assert_not_null();
155 const Ordinal numCols = rowStatMultiVec->domain()->dim();
158 for (
Ordinal col=1; col<numCols; ++col) {
159 Thyra::copy(*(rowStatMultiVec->col(0)),
160 rowStatMultiVec->col(col).ptr());
171 using Teuchos::rcp_dynamic_cast;
176 using Teuchos::rcp_dynamic_cast;
186 using Teuchos::rcp_dynamic_cast;
187 RCP<const MultiVectorBase<Scalar> > row_scaling_mv =
188 dyn_cast<
const MVPV>(row_scaling).getMultiVector().assert_not_null();
189 const Ordinal numCols = row_scaling_mv->domain()->dim();
203 using Teuchos::rcp_dynamic_cast;
204 RCP<const MultiVectorBase<Scalar> > col_scaling_mv =
205 dyn_cast<
const MVPV>(col_scaling).getMultiVector().assert_not_null();
206 const Ordinal numCols = col_scaling_mv->domain()->dim();
241 if (op->range() != Teuchos::null)
243 "MultiVectorLinearOp<Scalar>::initialize(op,multiVecRange,multiVecDomain)",
244 *op->range(), *multiVecRange->getBlock(0) );
245 if (op->domain() != Teuchos::null)
247 "MultiVectorLinearOp<Scalar>::initialize(op,multiVecRange,multiVecDomain)",
248 *op->domain(), *multiVecDomain->getBlock(0) );
252 (void)multiVecDomain;
262 template<
class Scalar>
263 RCP<MultiVectorLinearOp<Scalar> >
273 template<
class Scalar>
274 RCP<MultiVectorLinearOp<Scalar> >
281 RCP<MultiVectorLinearOp<Scalar> >
283 mvop->nonconstInitialize(op,multiVecRange,multiVecDomain);
291 template<
class Scalar>
292 RCP<MultiVectorLinearOp<Scalar> >
298 RCP<MultiVectorLinearOp<Scalar> >
300 RCP<const Thyra::DefaultMultiVectorProductVectorSpace<Scalar> > mv_domain =
301 Thyra::multiVectorProductVectorSpace(op->domain(), num_blocks);
302 RCP<const Thyra::DefaultMultiVectorProductVectorSpace<Scalar> > mv_range =
303 Thyra::multiVectorProductVectorSpace(op->range(), num_blocks);
304 mvop->nonconstInitialize(op,mv_range,mv_domain);
312 template<
class Scalar>
313 RCP<MultiVectorLinearOp<Scalar> >
320 RCP<MultiVectorLinearOp<Scalar> >
322 mvop->initialize(op,multiVecRange,multiVecDomain);
330 template<
class Scalar>
331 RCP<MultiVectorLinearOp<Scalar> >
337 RCP<MultiVectorLinearOp<Scalar> >
339 RCP<const Thyra::DefaultMultiVectorProductVectorSpace<Scalar> > mv_domain =
340 Thyra::multiVectorProductVectorSpace(op->domain(), num_blocks);
341 RCP<const Thyra::DefaultMultiVectorProductVectorSpace<Scalar> > mv_range =
342 Thyra::multiVectorProductVectorSpace(op->range(), num_blocks);
343 mvop->initialize(op,mv_range,mv_domain);
RCP< const DefaultMultiVectorProductVectorSpace< Scalar > > multiVecRange_
#define THYRA_ASSERT_VEC_SPACES(FUNC_NAME, VS1, VS2)
static void validateInitialize(const RCP< const LinearOpBase< Scalar > > &op, const RCP< const DefaultMultiVectorProductVectorSpace< Scalar > > &multiVecRange, const RCP< const DefaultMultiVectorProductVectorSpace< Scalar > > &multiVecDomain)
bool is_null(const boost::shared_ptr< T > &p)
RCP< const VectorSpaceBase< Scalar > > domain() const
RCP< MultiVectorLinearOp< Scalar > > multiVectorLinearOp()
Nonmember constructor function.
virtual void scaleRightImpl(const VectorBase< Scalar > &col_scaling)
void nonconstInitialize(const RCP< LinearOpBase< Scalar > > &op, const RCP< const DefaultMultiVectorProductVectorSpace< Scalar > > &multiVecRange, const RCP< const DefaultMultiVectorProductVectorSpace< Scalar > > &multiVecDomain)
T_To & dyn_cast(T_From &from)
RCP< LinearOpBase< Scalar > > getNonconstLinearOp()
void getRowStatImpl(const RowStatLinearOpBaseUtils::ERowStat rowStat, const Ptr< VectorBase< Scalar > > &rowStatVec) const
Get some statistics about a supported row.
void applyImpl(const EOpTransp M_trans, const MultiVectorBase< Scalar > &XX, const Ptr< MultiVectorBase< Scalar > > &YY, const Scalar alpha, const Scalar beta) const
Teuchos::ConstNonconstObjectContainer< LinearOpBase< Scalar > > CNOP
RCP< const LinearOpBase< Scalar > > clone() const
RCP< MultiVectorLinearOp< Scalar > > multiVectorLinearOp(const RCP< const LinearOpBase< Scalar > > &op, const int num_blocks)
Nonmember constructor function.
MultiVectorLinearOp()
Construct to uninitialized.
RCP< MultiVectorLinearOp< Scalar > > multiVectorLinearOp(const RCP< const LinearOpBase< Scalar > > &op, const RCP< const DefaultMultiVectorProductVectorSpace< Scalar > > &multiVecRange, const RCP< const DefaultMultiVectorProductVectorSpace< Scalar > > &multiVecDomain)
Nonmember constructor function.
RCP< MultiVectorLinearOp< Scalar > > nonconstMultiVectorLinearOp(const RCP< LinearOpBase< Scalar > > &op, const RCP< const DefaultMultiVectorProductVectorSpace< Scalar > > &multiVecRange, const RCP< const DefaultMultiVectorProductVectorSpace< Scalar > > &multiVecDomain)
Nonmember constructor function.
TEUCHOS_DEPRECATED RCP< T > rcp(T *p, Dealloc_T dealloc, bool owns_mem)
RCP< const ObjType > getConstObj() const
RCP< const VectorBase< Scalar > > col(Ordinal j) const
RCP< const DefaultMultiVectorProductVectorSpace< Scalar > > multiVecDomain_
bool opSupportedImpl(EOpTransp M_trans) const
virtual void scaleLeftImpl(const VectorBase< Scalar > &row_scaling)
virtual bool supportsScaleLeftImpl() const
Implicit concrete LinearOpBase subclass that takes a flattended out multi-vector and performs a multi...
virtual RCP< const VectorSpaceBase< Scalar > > domain() const =0
RCP< MultiVectorLinearOp< Scalar > > nonconstMultiVectorLinearOp(const RCP< LinearOpBase< Scalar > > &op, const int num_blocks)
Nonmember constructor function.
#define TEUCHOS_ASSERT(assertion_test)
RCP< ObjType > getNonconstObj() const
bool rowStatIsSupportedImpl(const RowStatLinearOpBaseUtils::ERowStat rowStat) const
Determine if a given row stat is supported.
void initialize(const RCP< const LinearOpBase< Scalar > > &op, const RCP< const DefaultMultiVectorProductVectorSpace< Scalar > > &multiVecRange, const RCP< const DefaultMultiVectorProductVectorSpace< Scalar > > &multiVecDomain)
RCP< const VectorSpaceBase< Scalar > > range() const
virtual bool supportsScaleRightImpl() const
#define TEUCHOS_TEST_FOR_EXCEPT(throw_exception_test)
RCP< const LinearOpBase< Scalar > > getLinearOp() const