10 #ifndef Thyra_MultiVectorLinearOp_hpp
11 #define Thyra_MultiVectorLinearOp_hpp
13 #include "Thyra_RowStatLinearOpBase.hpp"
14 #include "Thyra_ScaledLinearOpBase.hpp"
15 #include "Thyra_DefaultMultiVectorProductVectorSpace.hpp"
16 #include "Thyra_DefaultMultiVectorProductVector.hpp"
17 #include "Teuchos_ConstNonconstObjectContainer.hpp"
18 #include "Thyra_VectorStdOps.hpp"
19 #include "Thyra_MultiVectorStdOps.hpp"
20 #include "Thyra_AssertOp.hpp"
21 #include "Teuchos_dyn_cast.hpp"
29 template <
class Scalar>
90 RCP<const LinearOpBase<Scalar> >
clone()
const
106 const Scalar beta)
const
113 for (
Ordinal col_j = 0; col_j < numCols; ++col_j) {
114 const RCP<const VectorBase<Scalar> > x = XX.
col(col_j);
115 const RCP<VectorBase<Scalar> > y = YY->col(col_j);
117 RCP<const MultiVectorBase<Scalar> > X =
118 dyn_cast<
const MVPV>(*x).getMultiVector().assert_not_null();
119 RCP<MultiVectorBase<Scalar> > Y =
120 dyn_cast<MVPV>(*y).getNonconstMultiVector().assert_not_null();
122 Thyra::apply(*
op_.
getConstObj(), M_trans, *X, Y.ptr(), alpha, beta);
132 const RowStatLinearOpBaseUtils::ERowStat rowStat)
const
134 using Teuchos::rcp_dynamic_cast;
137 ->rowStatIsSupported(rowStat);
155 using Teuchos::rcp_dynamic_cast;
156 RCP<MultiVectorBase<Scalar> > rowStatMultiVec =
157 dyn_cast<MVPV>(*rowStatVec).getNonconstMultiVector().assert_not_null();
158 const Ordinal numCols = rowStatMultiVec->domain()->dim();
161 ->getRowStat(rowStat, rowStatMultiVec->col(0).ptr());
162 for (
Ordinal col = 1; col < numCols; ++col) {
163 Thyra::copy(*(rowStatMultiVec->col(0)),
164 rowStatMultiVec->col(col).ptr());
176 using Teuchos::rcp_dynamic_cast;
179 ->supportsScaleLeft();
184 using Teuchos::rcp_dynamic_cast;
187 ->supportsScaleRight();
197 using Teuchos::rcp_dynamic_cast;
198 RCP<const MultiVectorBase<Scalar> > row_scaling_mv =
199 dyn_cast<
const MVPV>(row_scaling).getMultiVector().assert_not_null();
200 const Ordinal numCols = row_scaling_mv->domain()->dim();
203 ->scaleLeft(*(row_scaling_mv->col(0)));
216 using Teuchos::rcp_dynamic_cast;
217 RCP<const MultiVectorBase<Scalar> > col_scaling_mv =
218 dyn_cast<
const MVPV>(col_scaling).getMultiVector().assert_not_null();
219 const Ordinal numCols = col_scaling_mv->domain()->dim();
222 ->scaleRight(*(col_scaling_mv->col(0)));
256 multiVecDomain->numBlocks());
257 if (op->range() != Teuchos::null)
259 "MultiVectorLinearOp<Scalar>::initialize(op,multiVecRange,"
261 *op->range(), *multiVecRange->getBlock(0));
262 if (op->domain() != Teuchos::null)
264 "MultiVectorLinearOp<Scalar>::initialize(op,multiVecRange,"
266 *op->domain(), *multiVecDomain->getBlock(0));
270 (void)multiVecDomain;
279 template <
class Scalar>
289 template <
class Scalar>
297 RCP<MultiVectorLinearOp<Scalar> > mvop =
299 mvop->nonconstInitialize(op, multiVecRange, multiVecDomain);
307 template <
class Scalar>
311 RCP<MultiVectorLinearOp<Scalar> > mvop =
313 RCP<const Thyra::DefaultMultiVectorProductVectorSpace<Scalar> > mv_domain =
314 Thyra::multiVectorProductVectorSpace(op->domain(), num_blocks);
315 RCP<const Thyra::DefaultMultiVectorProductVectorSpace<Scalar> > mv_range =
316 Thyra::multiVectorProductVectorSpace(op->range(), num_blocks);
317 mvop->nonconstInitialize(op, mv_range, mv_domain);
325 template <
class Scalar>
333 RCP<MultiVectorLinearOp<Scalar> > mvop =
335 mvop->initialize(op, multiVecRange, multiVecDomain);
343 template <
class Scalar>
347 RCP<MultiVectorLinearOp<Scalar> > mvop =
349 RCP<const Thyra::DefaultMultiVectorProductVectorSpace<Scalar> > mv_domain =
350 Thyra::multiVectorProductVectorSpace(op->domain(), num_blocks);
351 RCP<const Thyra::DefaultMultiVectorProductVectorSpace<Scalar> > mv_range =
352 Thyra::multiVectorProductVectorSpace(op->range(), num_blocks);
353 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< 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_
RCP< const VectorSpaceBase< Scalar > > range() const
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< const VectorSpaceBase< Scalar > > domain() const
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)
virtual bool supportsScaleRightImpl() const
#define TEUCHOS_TEST_FOR_EXCEPT(throw_exception_test)
RCP< const LinearOpBase< Scalar > > getLinearOp() const