Skip to content

Commit

Permalink
Teuchos: Issue #4258 (Remove SerialDense matrix inheritance from Object)
Browse files Browse the repository at this point in the history
 - fix client code in Trilinos needed to remove SerialDense matrix inheritance
   Teuchos::Object

These were identified and fixed using the GCC 4.8.4 PR test setup in
cmake/std/PullRequestLinuxGCC4.8.4TestingSettings.cmake with Teuchos
explicitly enabled and the HDF5 TPL disabled.
  • Loading branch information
rhoope committed Jan 24, 2019
1 parent 0598e02 commit 32bd71b
Show file tree
Hide file tree
Showing 22 changed files with 67 additions and 57 deletions.
14 changes: 8 additions & 6 deletions packages/anasazi/epetra/test/OrthoManager/cxx_gentest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -285,9 +285,10 @@ int main(int argc, char *argv[])
MyOM->stream(Warnings) << " ||<Y1,X1> - <X1,Y1>|| : " << err << endl;
// test s.p.d. of <Y1,X1>: try to compute a cholesky
lapack.POTRF('U',yTx1.numCols(),yTx1.values(),yTx1.stride(),&info);
TEUCHOS_TEST_FOR_EXCEPTION(info != 0,std::runtime_error,
"New <Y1,X1> not s.p.d.: couldn't computed Cholesky: info == " << info
<< "\nyTx1: \n" << yTx1);
std::ostringstream msg("New <Y1,X1> not s.p.d.: couldn't computed Cholesky: info == ");
msg << info << "\nyTx1: \n";
yTx1.print(msg);
TEUCHOS_TEST_FOR_EXCEPTION(info != 0,std::runtime_error, msg);

// X2 ortho to Y1
MVT::MvRandom(*X2);
Expand Down Expand Up @@ -345,9 +346,10 @@ int main(int argc, char *argv[])
MyOM->stream(Warnings) << " ||<Y2,X2> - <X2,Y2>|| : " << err << endl;
// test s.p.d. of <Y2,X2>: try to compute a cholesky
lapack.POTRF('U',yTx2.numCols(),yTx2.values(),yTx2.stride(),&info);
TEUCHOS_TEST_FOR_EXCEPTION(info != 0,std::runtime_error,
"New <Y2,X2> not s.p.d.: couldn't computed Cholesky: info == " << info
<< "\nyTx2: \n" << yTx2);
msg.str("New <Y2,X2> not s.p.d.: couldn't computed Cholesky: info == ");
msg << info << "\nyTx2: \n";
yTx2.print(msg);
TEUCHOS_TEST_FOR_EXCEPTION(info != 0,std::runtime_error, msg);
}
MyOM->stream(Warnings) << endl;

Expand Down
6 changes: 3 additions & 3 deletions packages/anasazi/epetra/test/OrthoManager/cxx_mattest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -661,13 +661,13 @@ int testProjectAndNormalizeMat(RCP<MatOrthoManager<ST,MV,OP> > OM,
if (err > ATOL*TOL) {
sout << "S\n" << *S << endl;
sout << "S_out\n" << *S_outs[o] << endl;
sout << "B_out\n" << *B_outs[o] << endl;
sout << "B_out\n"; B_outs[o]->print(sout); sout << endl;
if (C_outs[o].size() > 0) {
sout << "X1\n" << *X1 << endl;
sout << "C_out[1]\n" << *C_outs[o][0] << endl;
sout << "C_out[1]\n"; C_outs[o][0]->print(sout); sout << endl;
if (C_outs[o].size() > 1) {
sout << "X22n" << *X2 << endl;
sout << "C_out[2]\n" << *C_outs[o][1] << endl;
sout << "C_out[2]\n"; C_outs[o][1]->print(sout); sout << endl;
}
}
}
Expand Down
25 changes: 15 additions & 10 deletions packages/anasazi/src/AnasaziBlockDavidsonSolMgr.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -679,8 +679,9 @@ BlockDavidsonSolMgr<ScalarType,MV,OP>::solve() {
# ifdef TEUCHOS_DEBUG
{
std::stringstream os;
os << "KK before HEEV...\n"
<< *state.KK << "\n";
os << "KK before HEEV...\n";
state.KK->print(os);
os << "\n";
*out << os.str();
}
# endif
Expand All @@ -695,8 +696,9 @@ BlockDavidsonSolMgr<ScalarType,MV,OP>::solve() {
std::stringstream os;
*out << "Ritz values from heev(KK):\n";
for (unsigned int i=0; i<theta.size(); i++) *out << theta[i] << " ";
os << "\nRitz vectors from heev(KK):\n"
<< S << "\n";
os << "\nRitz vectors from heev(KK):\n";
S.print(os);
os << "\n";
*out << os.str();
}
# endif
Expand All @@ -715,8 +717,9 @@ BlockDavidsonSolMgr<ScalarType,MV,OP>::solve() {
std::stringstream os;
*out << "Ritz values from heev(KK) after sorting:\n";
std::copy(theta.begin(), theta.end(), std::ostream_iterator<ScalarType>(*out, " "));
os << "\nRitz vectors from heev(KK) after sorting:\n"
<< S << "\n";
os << "\nRitz vectors from heev(KK) after sorting:\n";
S.print(os);
os << "\n";
*out << os.str();
}
# endif
Expand All @@ -726,8 +729,9 @@ BlockDavidsonSolMgr<ScalarType,MV,OP>::solve() {
# ifdef TEUCHOS_DEBUG
{
std::stringstream os;
os << "Significant primitive Ritz vectors:\n"
<< Sr << "\n";
os << "Significant primitive Ritz vectors:\n";
Sr.print(os);
os << "\n";
*out << os.str();
}
# endif
Expand Down Expand Up @@ -756,8 +760,9 @@ BlockDavidsonSolMgr<ScalarType,MV,OP>::solve() {
# ifdef TEUCHOS_DEBUG
{
std::stringstream os;
os << "Sr'*KK*Sr:\n"
<< newKK << "\n";
os << "Sr'*KK*Sr:\n";
newKK.print(os);
os << "\n";
*out << os.str();
}
# endif
Expand Down
6 changes: 3 additions & 3 deletions packages/anasazi/src/AnasaziIRTR.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -889,15 +889,15 @@ namespace Anasazi {
MVT::MvTransMv(ONE,*this->delta_,*this->Adelta_,AA);
MVT::MvTransMv(ONE,*this->delta_,*this->Bdelta_,BB);
}
this->om_->stream(Debug) << "AA: " << std::endl << AA << std::endl;;
this->om_->stream(Debug) << "BB: " << std::endl << BB << std::endl;;
this->om_->stream(Debug) << "AA: " << std::endl; AA.print(this->om_->stream(Debug)); this->om_->stream(Debug) << std::endl;
this->om_->stream(Debug) << "BB: " << std::endl; BB.print(this->om_->stream(Debug)); this->om_->stream(Debug) << std::endl;
{
#ifdef ANASAZI_TEUCHOS_TIME_MONITOR
TimeMonitor lcltimer( *this->timerDS_ );
#endif
ret = Utils::directSolver(AA.numRows(),AA,Teuchos::rcpFromRef(BB),S,newtheta,rank,1);
}
this->om_->stream(Debug) << "S: " << std::endl << S << std::endl;;
this->om_->stream(Debug) << "S: " << std::endl; S.print(this->om_->stream(Debug)); this->om_->stream(Debug) << std::endl;
TEUCHOS_TEST_FOR_EXCEPTION(ret != 0,std::logic_error,"Anasazi::IRTR::iterate(): failure solving projected eigenproblem after retraction. ret == " << ret);
TEUCHOS_TEST_FOR_EXCEPTION(rank != AA.numRows(),RTRRitzFailure,"Anasazi::IRTR::iterate(): retracted iterate failed in Ritz analysis. rank == " << rank);

Expand Down
11 changes: 7 additions & 4 deletions packages/anasazi/src/AnasaziSIRTR.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -925,8 +925,8 @@ namespace Anasazi {
#endif
MVT::MvTransMv(ONE,*XpEta,*XpEta,BB);
}
this->om_->stream(Debug) << "AA: " << std::endl << AA << std::endl;;
this->om_->stream(Debug) << "BB: " << std::endl << BB << std::endl;;
this->om_->stream(Debug) << "AA: " << std::endl; AA.print(this->om_->stream(Debug)); this->om_->stream(Debug) << std::endl;
this->om_->stream(Debug) << "BB: " << std::endl; BB.print(this->om_->stream(Debug)); this->om_->stream(Debug) << std::endl;
// do the direct solve
// save old theta first
std::vector<MagnitudeType> oldtheta(this->theta_);
Expand All @@ -936,8 +936,11 @@ namespace Anasazi {
#endif
ret = Utils::directSolver(this->blockSize_,AA,Teuchos::rcpFromRef(BB),S,this->theta_,rank,1);
}
this->om_->stream(Debug) << "S: " << std::endl << S << std::endl;;
TEUCHOS_TEST_FOR_EXCEPTION(ret != 0,std::logic_error,"Anasazi::SIRTR::iterate(): failure solving projected eigenproblem after retraction. ret == " << ret << "AA: " << AA << std::endl << "BB: " << BB << std::endl);
this->om_->stream(Debug) << "S: " << std::endl; S.print(this->om_->stream(Debug)); this->om_->stream(Debug) << std::endl;;
std::ostringstream msg("Anasazi::SIRTR::iterate(): failure solving projected eigenproblem after retraction. ret == ");
msg << ret << "AA: "; AA.print(msg);
msg << std::endl << "BB: "; BB.print(msg); msg << std::endl;
TEUCHOS_TEST_FOR_EXCEPTION(ret != 0,std::logic_error, msg);
TEUCHOS_TEST_FOR_EXCEPTION(rank != this->blockSize_,RTRRitzFailure,"Anasazi::SIRTR::iterate(): retracted iterate failed in Ritz analysis. rank == " << rank);

//
Expand Down
4 changes: 2 additions & 2 deletions packages/belos/src/BelosLSQRIter.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -578,13 +578,13 @@ class LSQRIter : virtual public Belos::Iteration<ScalarType,MV,OP> {
// 2. confirm that U is a unit vector
Teuchos::SerialDenseMatrix<int,ScalarType> uotuo(1,1);
MVT::MvTransMv( one, *U_, *U_, uotuo );
std::cout << "<U, U> = " << uotuo << std::endl;
std::cout << "<U, U> = "; uotuo.print(std::cout); std::cout << std::endl;
// 3. print alpha = <V, A'U>
std::cout << "alpha = " << alpha[0] << std::endl;
// 4. compute < AV, U> which ought to be alpha
Teuchos::SerialDenseMatrix<int,ScalarType> utav(1,1);
MVT::MvTransMv( one, *AV, *U_, utav );
std::cout << "<AV, U> = alpha = " << utav << std::endl;
std::cout << "<AV, U> = alpha = "; utav.print(std::cout); std::cout << std::endl;
}

MVT::MvAddMv( one, *AV, -alpha[0], *U_, *U_ ); // uNew := Av - uOld alphaOld
Expand Down
8 changes: 4 additions & 4 deletions packages/rol/adapters/teuchos/test/function/test_01.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -243,10 +243,10 @@ int main( int argc, char *argv[] ) {
}
}

*outStream << "\nA = " << *A;
*outStream << "\nb = " << *b;
*outStream << "\nC = " << *C;
*outStream << "\nd = " << *d;
*outStream << "\nA = "; A->print(*outStream);
*outStream << "\nb = "; b->print(*outStream);
*outStream << "\nC = "; C->print(*outStream);
*outStream << "\nd = "; d->print(*outStream);


auto x = rcp( new Vector{Nopt,1} );
Expand Down
4 changes: 2 additions & 2 deletions packages/rol/example/dense-hessian/example_01.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -113,8 +113,8 @@ int main(int argc, char *argv[]) {
// Compute dense Hessian.
Teuchos::SerialDenseMatrix<int, RealT> H = ROL::computeDenseHessian(obj, x);
Teuchos::SerialDenseMatrix<int, RealT> H_scaled = ROL::computeScaledDenseHessian(obj, x);
*outStream << H;
*outStream << H_scaled;
H.print(*outStream);
H_scaled.print(*outStream);

// Compute Hessian error.
Teuchos::SerialDenseMatrix<int, RealT> H_true(2, 2);
Expand Down
6 changes: 3 additions & 3 deletions packages/rythmos/src/Rythmos_ExplicitRKStepper_def.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -433,9 +433,9 @@ void ExplicitRKStepper<Scalar>::describe(
}
out << "ktemp_vector = " << std::endl;
out << Teuchos::describe(*ktemp_vector_,verbLevel);
out << "ERK Butcher Tableau A matrix: " << erkButcherTableau_->A() << std::endl;
out << "ERK Butcher Tableau b vector: " << erkButcherTableau_->b() << std::endl;
out << "ERK Butcher Tableau c vector: " << erkButcherTableau_->c() << std::endl;
out << "ERK Butcher Tableau A matrix: "; erkButcherTableau_->A().print(out); out << std::endl;
out << "ERK Butcher Tableau b vector: "; erkButcherTableau_->b().print(out); out << std::endl;
out << "ERK Butcher Tableau c vector: "; erkButcherTableau_->c().print(out); out << std::endl;
out << "t = " << t_ << std::endl;
}
}
Expand Down
6 changes: 3 additions & 3 deletions packages/rythmos/src/Rythmos_RKButcherTableau.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -200,9 +200,9 @@ class RKButcherTableauDefaultBase :
out << this->description() << std::endl;
out << this->getMyDescription() << std::endl;
out << "number of Stages = " << this->numStages() << std::endl;
out << "A = " << this->A() << std::endl;
out << "b = " << this->b() << std::endl;
out << "c = " << this->c() << std::endl;
out << "A = "; this->A().print(out); out << std::endl;
out << "b = "; this->b().print(out); out << std::endl;
out << "c = "; this->c().print(out); out << std::endl;
out << "order = " << this->order() << std::endl;
}
}
Expand Down
2 changes: 1 addition & 1 deletion packages/stokhos/src/Stokhos_GSReducedPCEBasisBaseImp.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -226,7 +226,7 @@ print(std::ostream& os) const
{
os << "Gram-Schmidt basis of order " << p << ", dimension " << d
<< ", and size " << sz << ". Matrix coefficients:\n";
os << Qp << std::endl;
Qp.print(os); os << std::endl;
os << "Basis vector norms (squared):\n\t";
for (ordinal_type i=0; i<sz; i++)
os << norms[i] << " ";
Expand Down
2 changes: 1 addition & 1 deletion packages/stokhos/src/Stokhos_GramSchmidtBasisImp.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -259,7 +259,7 @@ print(std::ostream& os) const
{
os << "Gram-Schmidt basis of order " << p << ", dimension " << d
<< ", and size " << sz << ". Matrix coefficients:\n";
os << gs_mat << std::endl;
gs_mat.print(os); os << std::endl;
os << "Basis vector norms (squared):\n\t";
for (ordinal_type i=0; i<sz; i++)
os << norms[i] << " ";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -379,7 +379,7 @@ print(std::ostream& os) const
{
os << "Gram-Schmidt basis of order " << p << ", dimension " << d
<< ", and size " << sz << ". Matrix coefficients:\n";
os << Qp << std::endl;
Qp.print(os); os << std::endl;
os << "Basis vector norms (squared):\n\t";
for (ordinal_type i=0; i<sz; i++)
os << norms[i] << " ";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -309,7 +309,7 @@ print(std::ostream& os) const
os << "Product Lanczos Gram-Schmidt basis of order " << p << ", dimension "
<< d
<< ", and size " << sz << ". Matrix coefficients:\n";
os << Qp << std::endl;
Qp.print(os); os << std::endl;
os << "Basis vector norms (squared):\n\t";
for (ordinal_type i=0; i<sz; i++)
os << norms[i] << " ";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -235,7 +235,7 @@ namespace GramSchmidtTest {
if (!success) {
out << "\n Error, mat.normInf() < tol = " << mat.normInf()
<< " < " << tol << ": failed!\n";
out << "mat = " << mat << std::endl;
out << "mat = "; mat.print(out); out << std::endl;
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ namespace HermiteBasisUnitTest {
if (!success) {
out << "\n Error, mat.normInf() < atol = " << mat.normInf()
<< " < " << setup.atol << ": failed!\n";
out << "mat = " << mat << std::endl;
out << "mat = "; mat.print(out); out << std::endl;
}
}

Expand Down
2 changes: 1 addition & 1 deletion packages/stokhos/test/UnitTest/Stokhos_LanczosUnitTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,7 @@ namespace BASENAME ## TAG { \
if (!success) { \
out << "\n Error, mat.normInf() < atol = " << mat.normInf() \
<< " < " << setup.atol << ": failed!\n"; \
out << "mat = " << mat << std::endl; \
out << "mat = "; mat.print(out); out << std::endl; \
} \
} \
\
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ namespace LegendreBasisUnitTest {
if (!success) {
out << "\n Error, mat.normInf() < atol = " << mat.normInf()
<< " < " << setup.atol << ": failed!\n";
out << "mat = " << mat << std::endl;
out << "mat = "; mat.print(out); out << std::endl;
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ namespace HermiteBasisUnitTest {
if (!success) {
out << "\n Error, mat.normInf() < atol = " << mat.normInf()
<< " < " << setup.atol << ": failed!\n";
out << "mat = " << mat << std::endl;
out << "mat = "; mat.print(out); out << std::endl;
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ namespace LegendreBasisUnitTest {
if (!success) {
out << "\n Error, mat.normInf() < atol = " << mat.normInf()
<< " < " << setup.atol << ": failed!\n";
out << "mat = " << mat << std::endl;
out << "mat = "; mat.print(out); out << std::endl;
}
}

Expand Down
6 changes: 3 additions & 3 deletions packages/stokhos/test/UnitTest/Stokhos_StieltjesUnitTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,7 @@ namespace StieltjesCosTest {
if (!success) {
out << "\n Error, mat.normInf() < atol = " << mat.normInf()
<< " < " << setup.atol << ": failed!\n";
out << "mat = " << mat << std::endl;
out << "mat = "; mat.print(out); out << std::endl;
}
}

Expand Down Expand Up @@ -285,7 +285,7 @@ namespace StieltjesSinTest {
if (!success) {
out << "\n Error, mat.normInf() < atol = " << mat.normInf()
<< " < " << setup.atol << ": failed!\n";
out << "mat = " << mat << std::endl;
out << "mat = "; mat.print(out); out << std::endl;
}
}

Expand Down Expand Up @@ -368,7 +368,7 @@ namespace StieltjesExpTest {
if (!success) {
out << "\n Error, mat.normInf() < atol = " << mat.normInf()
<< " < " << setup.atol << ": failed!\n";
out << "mat = " << mat << std::endl;
out << "mat = "; mat.print(out); out << std::endl;
}
}

Expand Down
8 changes: 4 additions & 4 deletions packages/tempus/src/Tempus_RKButcherTableau.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -172,10 +172,10 @@ class RKButcherTableau :
out << this->description() << std::endl;
out << this->getDescription() << std::endl;
out << "number of Stages = " << this->numStages() << std::endl;
out << "A = " << this->A() << std::endl;
out << "b = " << this->b() << std::endl;
out << "c = " << this->c() << std::endl;
out << "bstar = " << this->bstar() << std::endl;
out << "A = "; this->A().print(out); out << std::endl;
out << "b = "; this->b().print(out); out << std::endl;
out << "c = "; this->c().print(out); out << std::endl;
out << "bstar = "; this->bstar().print(out); out << std::endl;
out << "order = " << this->order() << std::endl;
out << "orderMin = " << this->orderMin() << std::endl;
out << "orderMax = " << this->orderMax() << std::endl;
Expand Down

0 comments on commit 32bd71b

Please sign in to comment.