42 #ifndef THYRA_DESCRIBE_LINEAR_OP_HPP 43 #define THYRA_DESCRIBE_LINEAR_OP_HPP 45 #include "Thyra_describeLinearOp_def.hpp" 46 #include "Thyra_LinearOpBase.hpp" 47 #include "Thyra_MultiVectorBase.hpp" 48 #include "Thyra_VectorStdOps.hpp" 49 #include "Thyra_AssertOp.hpp" 50 #include "Thyra_AssertOp.hpp" 53 template<
class Scalar>
54 void Thyra::describeLinearOp(
55 const LinearOpBase<Scalar> &A,
56 Teuchos::FancyOStream &out_arg,
57 const Teuchos::EVerbosityLevel verbLevel
61 using Teuchos::FancyOStream;
63 typedef Teuchos::ScalarTraits<Scalar> DST;
65 RCP<FancyOStream> out = rcp(&out_arg,
false);
67 *out << A.description() <<
"\n";
69 const Teuchos::RCP<const VectorSpaceBase<Scalar> >
71 const Teuchos::RCP<const VectorSpaceBase<Scalar> >
78 const Ordinal dimDomain = domain->dim(), dimRange = range->dim();
79 if ( dimDomain > 0 && dimRange > 0 && verbLevel >= Teuchos::VERB_EXTREME ) {
81 Teuchos::RCP<VectorBase<Scalar> > e_j =
createMember(domain);
82 Teuchos::RCP<VectorBase<Scalar> > t =
createMember(range);
84 Array<Scalar> Md(dimRange*dimDomain);
90 for( j = 0; j < dimDomain; ++j ) {
91 Thyra::assign( e_j.ptr(), DST::zero() );
92 Thyra::set_ele( j, DST::one(), e_j.ptr() );
93 Thyra::apply<Scalar>(A,
NOTRANS, *e_j, t.ptr());
94 t->acquireDetachedView(
Range1D(),&sv);
95 for( i = 0; i < dimRange; ++i ) Md[ i*cs + j*rs ] = sv(i);
96 t->releaseDetachedView(&sv);
99 for( i = 0; i < dimRange; ++i ) {
100 for( j = 0; j < dimDomain; ++j )
101 *out <<
" " << i <<
":" << j <<
":" << Md[ i + j*dimRange ];
113 #define THYRA_DESCRIBE_LINEAR_INSTANT(SCALAR) \ 115 template void describeLinearOp( \ 116 const LinearOpBase<SCALAR > &A, \ 117 Teuchos::FancyOStream &out_arg, \ 118 const Teuchos::EVerbosityLevel verbLevel \ 123 #endif // THYRA_DESCRIBE_LINEAR_OP_HPP Use the non-transposed operator.
Teuchos::Ordinal Ordinal
Type for the dimension of a vector space. `*.
RCP< VectorBase< Scalar > > createMember(const RCP< const VectorSpaceBase< Scalar > > &vs, const std::string &label="")
Create a vector member from the vector space.