47 #include "Teko_BlockLowerTriInverseOp.hpp"
49 #include "Teuchos_Utils.hpp"
55 BlockLowerTriInverseOp::BlockLowerTriInverseOp(BlockedLinearOp & L,
const std::vector<LinearOp> & invDiag)
61 int blocks = blockRowCount(
L_);
62 TEUCHOS_ASSERT(blocks>0);
63 TEUCHOS_ASSERT(blocks==blockColCount(
L_));
64 TEUCHOS_ASSERT(blocks==(
int)
invDiag_.size());
87 const double alpha,
const double beta)
const
89 int blocks = blockCount(src);
91 TEUCHOS_ASSERT(blocks==blockRowCount(
L_));
92 TEUCHOS_ASSERT(blocks==blockCount(dst));
95 srcScrap_ = datacopy(src,srcScrap_);
96 BlockedMultiVector dstCopy;
98 dstScrap_ = datacopy(dst,dstScrap_);
106 std::vector<MultiVector> dstVec;
107 std::vector<MultiVector> scrapVec;
108 for(
int b=0;b<blocks;b++) {
109 dstVec.push_back(getBlock(b,dstCopy));
110 scrapVec.push_back(getBlock(b,srcScrap_));
115 for(
int b=0;b<blocks;b++) {
116 applyOp(
invDiag_[b], scrapVec[b], dstVec[b]);
119 for(
int i=b+1;i<blocks;i++) {
120 LinearOp u_ib = getBlock(i,b,
L_);
121 if(u_ib!=Teuchos::null) {
122 applyOp(u_ib,dstVec[b],scrapVec[i],-1.0,1.0);
129 update(alpha,dstCopy,beta,dst);
134 void BlockLowerTriInverseOp::describe(Teuchos::FancyOStream & out_arg,
135 const Teuchos::EVerbosityLevel verbLevel)
const
137 using Teuchos::OSTab;
139 RCP<Teuchos::FancyOStream> out = rcp(&out_arg,
false);
142 case Teuchos::VERB_DEFAULT:
143 case Teuchos::VERB_LOW:
144 *out << this->description() << std::endl;
146 case Teuchos::VERB_MEDIUM:
147 case Teuchos::VERB_HIGH:
148 case Teuchos::VERB_EXTREME:
150 *out << Teuchos::Describable::description() <<
"{"
151 <<
"rangeDim=" << this->
range()->dim()
152 <<
",domainDim=" << this->
domain()->dim()
153 <<
",rows=" << blockRowCount(
L_)
154 <<
",cols=" << blockColCount(
L_)
158 *out <<
"[L Operator] = ";
159 *out << Teuchos::describe(*
L_,verbLevel);
163 *out <<
"[invDiag Operators]:\n";
165 for(
int i=0;i<blockRowCount(
L_);i++) {
166 *out <<
"[invD(" << i <<
")] = ";
167 *out << Teuchos::describe(*
invDiag_[i],verbLevel);
173 TEUCHOS_TEST_FOR_EXCEPT(
true);
virtual VectorSpace domain() const
Domain space of this operator.
const BlockedLinearOp L_
operator
Teuchos::RCP< const Thyra::ProductVectorSpaceBase< double > > productDomain_
Domain vector space.
virtual void implicitApply(const BlockedMultiVector &x, BlockedMultiVector &y, const double alpha=1.0, const double beta=0.0) const
Perform a matrix vector multiply with this operator.
std::vector< LinearOp > invDiag_
(Approximate) Inverses of the diagonal operators
Teuchos::RCP< const Thyra::ProductVectorSpaceBase< double > > productRange_
Range vector space.
virtual VectorSpace range() const
Range space of this operator.