64 template<
class Scalar,
class MV>
97 Array<RCP<MV> > V (numBlocks);
98 for (
int k = 0; k < numBlocks; ++k) {
104 RCP<Time> timer = TimeMonitor::getNewCounter (
"Baseline for OrthoManager benchmark");
110 TimeMonitor monitor (*timer);
111 for (
int trial = 0; trial < numTrials; ++trial) {
112 for (
int k = 0; k < numBlocks; ++k) {
113 for (
int j = 0; j < k; ++j)
154 const std::string& orthoManName,
155 const std::string& normalization,
161 std::ostream& resultStream,
162 const bool displayResultsCompactly=
false)
177 "numCols = " << numCols <<
" < 1");
179 "numBlocks = " << numBlocks <<
" < 1");
181 "numTrials = " << numTrials <<
" < 1");
183 std::ostream& debugOut = outMan->stream(
Debug);
195 Array<RCP<mat_type> >
C (numBlocks);
196 for (
int k = 0; k < numBlocks; ++k) {
199 RCP<mat_type>
B (
new mat_type (numCols, numCols));
205 Array<RCP<MV> > V (numBlocks);
206 for (
int k = 0; k < numBlocks; ++k) {
214 RCP<Time> firstRunTimer;
216 std::ostringstream os;
217 os <<
"OrthoManager: " << orthoManName <<
" first run";
218 firstRunTimer = TimeMonitor::getNewCounter (os.str());
222 std::ostringstream os;
223 os <<
"OrthoManager: " << orthoManName <<
" total over " 224 << numTrials <<
" trials (excluding first run above)";
225 timer = TimeMonitor::getNewCounter (os.str());
231 TimeMonitor monitor (*firstRunTimer);
233 (void) orthoMan->normalize (*V[0],
B);
234 for (
int k = 1; k < numBlocks; ++k) {
240 ArrayView<RCP<MV> > V_0k_nonconst = V.view (0, k);
241 ArrayView<RCP<const MV> > V_0k =
242 Teuchos::av_reinterpret_cast<RCP<const MV> > (V_0k_nonconst);
243 (void) orthoMan->projectAndNormalize (*V[k],
C,
B, V_0k);
255 debugOut <<
"Orthogonality of V[0:" << (numBlocks-1)
257 for (
int k = 0; k < numBlocks; ++k) {
259 debugOut <<
"For block V[" << k <<
"]:" << endl;
260 debugOut <<
" ||<V[" << k <<
"], V[" << k <<
"]> - I|| = " 261 << orthoMan->orthonormError(*V[k]) << endl;
263 for (
int j = 0; j < k; ++j) {
264 debugOut <<
" ||< V[" << j <<
"], V[" << k <<
"] >|| = " 265 << orthoMan->orthogError(*V[j], *V[k]) << endl;
273 TimeMonitor monitor (*timer);
275 for (
int trial = 0; trial < numTrials; ++trial) {
276 (void) orthoMan->normalize (*V[0],
B);
277 for (
int k = 1; k < numBlocks; ++k) {
278 ArrayView<RCP<MV> > V_0k_nonconst = V.view (0, k);
279 ArrayView<RCP<const MV> > V_0k =
280 Teuchos::av_reinterpret_cast<RCP<const MV> > (V_0k_nonconst);
281 (void) orthoMan->projectAndNormalize (*V[k],
C,
B, V_0k);
287 if (displayResultsCompactly)
295 resultStream <<
"#orthoManName" 300 <<
",firstRunTimeInSeconds" 304 resultStream << orthoManName
305 <<
"," << (orthoManName==
"Simple" ? normalization :
"N/A")
309 <<
"," << firstRunTimer->totalElapsedTime()
310 <<
"," << timer->totalElapsedTime()
315 TimeMonitor::summarize (resultStream);
323 template<
class Scalar,
class MV >
354 const bool isRankRevealing,
364 using Teuchos::rcp_dynamic_cast;
365 using Teuchos::tuple;
379 std::ostream& debugOut = MyOM->stream(
Debug);
388 debugOut <<
"Generating X1,X2 for testing... ";
391 debugOut <<
"done." << endl;
398 debugOut <<
"Filling X1 with random values... ";
400 debugOut <<
"done." << endl
401 <<
"Calling normalize() on X1... ";
406 const int initialX1Rank = OM->normalize(*X1, Teuchos::null);
409 "normalize(X1) returned rank " 410 << initialX1Rank <<
" from " << sizeX1
411 <<
" vectors. Cannot continue.");
412 debugOut <<
"done." << endl
413 <<
"Calling orthonormError() on X1... ";
414 err = OM->orthonormError(*X1);
416 "After normalize(X1), orthonormError(X1) = " 417 << err <<
" > TOL = " << TOL);
418 debugOut <<
"done: ||<X1,X1> - I|| = " << err << endl;
424 debugOut <<
"Filling X2 with random values... ";
426 debugOut <<
"done." << endl
427 <<
"Calling projectAndNormalize(X2, C, B, tuple(X1))... " 438 Array<RCP<mat_type> >
C (1);
439 RCP<mat_type>
B = Teuchos::null;
441 OM->projectAndNormalize (*X2,
C,
B, tuple<RCP<const MV> >(X1));
445 "projectAndNormalize(X2,X1) returned rank " 446 << initialX2Rank <<
" from " << sizeX2
447 <<
" vectors. Cannot continue.");
448 debugOut <<
"done." << endl
449 <<
"Calling orthonormError() on X2... ";
450 err = OM->orthonormError (*X2);
453 "projectAndNormalize(X2,X1) did not meet tolerance: " 454 "orthonormError(X2) = " << err <<
" > TOL = " << TOL);
455 debugOut <<
"done: || <X2,X2> - I || = " << err << endl
456 <<
"Calling orthogError(X2, X1)... ";
457 err = OM->orthogError (*X2, *X1);
460 "projectAndNormalize(X2,X1) did not meet tolerance: " 461 "orthogError(X2,X1) = " << err <<
" > TOL = " << TOL);
462 debugOut <<
"done: || <X2,X1> || = " << err << endl;
471 RCP<mixin_type> tsqr = rcp_dynamic_cast<mixin_type>(OM);
472 if (! tsqr.is_null())
476 <<
"=== OutOfPlaceNormalizerMixin tests ===" 486 debugOut <<
"Filling X1_in with random values... ";
488 debugOut <<
"done." << endl;
489 debugOut <<
"Filling X1_out with different random values...";
492 debugOut <<
"done." << endl
493 <<
"Calling normalizeOutOfPlace(*X1_in, *X1_out, null)... ";
494 const int initialX1Rank =
495 tsqr->normalizeOutOfPlace(*X1_in, *X1_out, Teuchos::null);
497 "normalizeOutOfPlace(*X1_in, *X1_out, null) " 498 "returned rank " << initialX1Rank <<
" from " 499 << sizeX1 <<
" vectors. Cannot continue.");
500 debugOut <<
"done." << endl
501 <<
"Calling orthonormError() on X1_out... ";
502 err = OM->orthonormError(*X1_out);
504 "After calling normalizeOutOfPlace(*X1_in, " 505 "*X1_out, null), orthonormError(X1) = " 506 << err <<
" > TOL = " << TOL);
507 debugOut <<
"done: ||<X1_out,X1_out> - I|| = " << err << endl;
518 debugOut <<
"Filling X2_in with random values... ";
520 debugOut <<
"done." << endl
521 <<
"Filling X2_out with different random values...";
524 debugOut <<
"done." << endl
525 <<
"Calling projectAndNormalizeOutOfPlace(X2_in, X2_out, " 526 <<
"C, B, X1_out)...";
529 Array<RCP<mat_type> >
C (1);
530 RCP<mat_type>
B = Teuchos::null;
532 tsqr->projectAndNormalizeOutOfPlace (*X2_in, *X2_out,
C,
B,
533 tuple<RCP<const MV> >(X1_out));
537 "projectAndNormalizeOutOfPlace(*X2_in, " 538 "*X2_out, C, B, tuple(X1_out)) returned rank " 539 << initialX2Rank <<
" from " << sizeX2
540 <<
" vectors. Cannot continue.");
541 debugOut <<
"done." << endl
542 <<
"Calling orthonormError() on X2_out... ";
543 err = OM->orthonormError (*X2_out);
545 "projectAndNormalizeOutOfPlace(*X2_in, *X2_out, " 546 "C, B, tuple(X1_out)) did not meet tolerance: " 547 "orthonormError(X2_out) = " 548 << err <<
" > TOL = " << TOL);
549 debugOut <<
"done: || <X2_out,X2_out> - I || = " << err << endl
550 <<
"Calling orthogError(X2_out, X1_out)... ";
551 err = OM->orthogError (*X2_out, *X1_out);
553 "projectAndNormalizeOutOfPlace(*X2_in, *X2_out, " 554 "C, B, tuple(X1_out)) did not meet tolerance: " 555 "orthogError(X2_out, X1_out) = " 556 << err <<
" > TOL = " << TOL);
557 debugOut <<
"done: || <X2_out,X1_out> || = " << err << endl;
559 <<
"=== Done with OutOfPlaceNormalizerMixin tests ===" 570 debugOut <<
"Testing project() by projecting a random multivector S " 571 "against various combinations of X1 and X2 " << endl;
572 const int thisNumFailed =
testProject(OM,S,X1,X2,MyOM);
573 numFailed += thisNumFailed;
574 if (thisNumFailed > 0)
575 debugOut <<
" *** " << thisNumFailed
576 << (thisNumFailed > 1 ?
" tests" :
" test")
577 <<
" failed." << endl;
588 mat_type C1(sizeX1,sizeS), C2(sizeX2,sizeS);
596 debugOut <<
"Testing project() by projecting [X1 X2]-range multivector " 597 "against P_X1 P_X2 " << endl;
598 const int thisNumFailed =
testProject(OM,S,X1,X2,MyOM);
599 numFailed += thisNumFailed;
600 if (thisNumFailed > 0)
601 debugOut <<
" *** " << thisNumFailed
602 << (thisNumFailed > 1 ?
" tests" :
" test")
603 <<
" failed." << endl;
608 if (isRankRevealing && sizeS > 2)
614 std::vector<int> ind(1);
618 debugOut <<
"Testing normalize() on a rank-deficient multivector " << endl;
620 numFailed += thisNumFailed;
621 if (thisNumFailed > 0)
622 debugOut <<
" *** " << thisNumFailed
623 << (thisNumFailed > 1 ?
" tests" :
" test")
624 <<
" failed." << endl;
629 if (isRankRevealing && sizeS > 1)
635 for (
int i=0; i<sizeS; i++)
637 std::vector<int> ind(1);
642 debugOut <<
"Testing normalize() on a rank-1 multivector " << endl;
644 numFailed += thisNumFailed;
645 if (thisNumFailed > 0)
646 debugOut <<
" *** " << thisNumFailed
647 << (thisNumFailed > 1 ?
" tests" :
" test")
648 <<
" failed." << endl;
652 std::vector<int> ind(1);
655 debugOut <<
"Testing projectAndNormalize() on a random multivector " << endl;
657 numFailed += thisNumFailed;
658 if (thisNumFailed > 0)
659 debugOut <<
" *** " << thisNumFailed
660 << (thisNumFailed > 1 ?
" tests" :
" test")
661 <<
" failed." << endl;
672 mat_type C1(sizeX1,sizeS), C2(sizeX2,sizeS);
678 debugOut <<
"Testing projectAndNormalize() by projecting [X1 X2]-range " 679 "multivector against P_X1 P_X2 " << endl;
681 numFailed += thisNumFailed;
682 if (thisNumFailed > 0)
683 debugOut <<
" *** " << thisNumFailed
684 << (thisNumFailed > 1 ?
" tests" :
" test")
685 <<
" failed." << endl;
690 if (isRankRevealing && sizeS > 2)
696 std::vector<int> ind(1);
700 debugOut <<
"Testing projectAndNormalize() on a rank-deficient " 701 "multivector " << endl;
703 numFailed += thisNumFailed;
704 if (thisNumFailed > 0)
705 debugOut <<
" *** " << thisNumFailed
706 << (thisNumFailed > 1 ?
" tests" :
" test")
707 <<
" failed." << endl;
712 if (isRankRevealing && sizeS > 1)
718 for (
int i=0; i<sizeS; i++)
720 std::vector<int> ind(1);
725 debugOut <<
"Testing projectAndNormalize() on a rank-1 multivector " << endl;
726 bool constantStride =
true;
728 debugOut <<
"-- S does not have constant stride" << endl;
729 constantStride =
false;
732 debugOut <<
"-- X1 does not have constant stride" << endl;
733 constantStride =
false;
736 debugOut <<
"-- X2 does not have constant stride" << endl;
737 constantStride =
false;
739 if (! constantStride) {
740 debugOut <<
"-- Skipping this test, since TSQR does not work on " 741 "multivectors with nonconstant stride" << endl;
745 numFailed += thisNumFailed;
746 if (thisNumFailed > 0) {
747 debugOut <<
" *** " << thisNumFailed
748 << (thisNumFailed > 1 ?
" tests" :
" test")
749 <<
" failed." << endl;
754 if (numFailed != 0) {
755 MyOM->stream(
Errors) << numFailed <<
" total test failures." << endl;
775 "MVDiff: X and Y should have the same number of columns." 776 " X has " << numCols <<
" column(s) and Y has " 801 for (
int i = 0; i < numCols; ++i)
833 using Teuchos::tuple;
847 std::ostringstream sout;
883 sout <<
" || <S,X1> || before : " << err << endl;
887 sout <<
" || <S,X2> || before : " << err << endl;
890 for (
int t=0; t<numtests; t++) {
892 Array< RCP< const MV > > theX;
894 Array<RCP<mat_type > >
C;
895 if ( (t % 3) == 0 ) {
899 else if ( (t % 3) == 1 ) {
904 else if ( (t % 3) == 2 ) {
929 Array<RCP<MV> > S_outs;
930 Array<Array<RCP<mat_type > > > C_outs;
931 Array<RCP<mat_type > > B_outs;
949 int ret = OM->projectAndNormalize(*Scopy,
C,
B,theX);
950 sout <<
"projectAndNormalize() returned rank " << ret << endl;
952 sout <<
" *** Error: returned rank is zero, cannot continue tests" << endl;
966 std::vector<int> ind(ret);
967 for (
int i=0; i<ret; i++) {
974 S_outs.push_back( Scopy );
977 C_outs.push_back( Array<RCP<mat_type > >(0) );
986 if ( (t % 3) == 3 ) {
999 theX = tuple( theX[1], theX[0] );
1003 ret = OM->projectAndNormalize(*Scopy,
C,
B,theX);
1004 sout <<
"projectAndNormalize() returned rank " << ret << endl;
1006 sout <<
" *** Error: returned rank is zero, cannot continue tests" << endl;
1020 std::vector<int> ind(ret);
1021 for (
int i=0; i<ret; i++) {
1028 S_outs.push_back( Scopy );
1031 C_outs.push_back( Array<RCP<mat_type > >() );
1036 theX = tuple( theX[1], theX[0] );
1041 for (
size_type o=0; o<S_outs.size(); o++) {
1047 <<
" *** Test (number " << (t+1) <<
" of " << numtests
1048 <<
" total tests) failed: Tolerance exceeded! Error = " 1049 << err <<
" > TOL = " << TOL <<
"." 1053 sout <<
" || <S,S> - I || after : " << err << endl;
1059 if (C_outs[o].size() > 0) {
1061 if (C_outs[o].size() > 1) {
1066 if (err > ATOL*TOL) {
1068 <<
" *** Test (number " << (t+1) <<
" of " << numtests
1069 <<
" total tests) failed: Tolerance exceeded! Error = " 1070 << err <<
" > ATOL*TOL = " << (ATOL*TOL) <<
"." 1074 sout <<
" " << t <<
"|| S_in - X1*C1 - X2*C2 - S_out*B || : " << err << endl;
1077 if (theX.size() > 0 && theX[0] != null) {
1081 <<
" *** Test (number " << (t+1) <<
" of " << numtests
1082 <<
" total tests) failed: Tolerance exceeded! Error = " 1083 << err <<
" > TOL = " << TOL <<
"." 1087 sout <<
" " << t <<
"|| <X[0],S> || after : " << err << endl;
1090 if (theX.size() > 1 && theX[1] != null) {
1094 <<
" *** Test (number " << (t+1) <<
" of " << numtests
1095 <<
" total tests) failed: Tolerance exceeded! Error = " 1096 << err <<
" > TOL = " << TOL <<
"." 1100 sout <<
" " << t <<
"|| <X[1],S> || after : " << err << endl;
1105 sout <<
" *** Error: OrthoManager threw exception: " << e.what() << endl;
1116 const int msgType = (numerr > 0) ?
1117 (static_cast<int>(
Debug) |
static_cast<int>(
Errors)) :
1118 static_cast<int>(
Debug);
1122 MyOM->stream(static_cast< MsgType >(msgType)) << sout.str() << endl;
1138 using Teuchos::tuple;
1141 std::ostringstream sout;
1186 sout <<
"The test matrix S has Frobenius norm " << ATOL
1187 <<
", and the relative error tolerance is TOL = " 1188 << TOL <<
"." << endl;
1190 const int numtests = 1;
1191 for (
int t = 0; t < numtests; ++t) {
1203 RCP< mat_type >
B (
new mat_type (sizeS, sizeS));
1210 const int reportedRank = OM->normalize (*S_copy,
B);
1211 sout <<
"normalize() returned rank " << reportedRank << endl;
1212 if (reportedRank == 0) {
1213 sout <<
" *** Error: Cannot continue, since normalize() " 1214 "reports that S has rank 0" << endl;
1228 std::vector<int> indices (reportedRank);
1229 for (
int j = 0; j < reportedRank; ++j)
1246 sout <<
" *** Error: Tolerance exceeded: err = " 1247 << err <<
" > TOL = " << TOL << endl;
1250 sout <<
" || <S,S> - I || after : " << err << endl;
1268 if (err > ATOL*TOL) {
1269 sout <<
" *** Error: Tolerance exceeded: err = " 1270 << err <<
" > ATOL*TOL = " << (ATOL*TOL) << endl;
1273 sout <<
" " << t <<
"|| S - Q*B || : " << err << endl;
1277 sout <<
" *** Error: the OrthoManager's normalize() method " 1278 "threw an exception: " << e.what() << endl;
1284 const MsgType type = (numerr == 0) ?
Debug : static_cast<MsgType> (static_cast<int>(
Errors) |
static_cast<int>(
Debug));
1285 MyOM->stream(type) << sout.str();
1286 MyOM->stream(type) << endl;
1303 using Teuchos::null;
1306 using Teuchos::tuple;
1310 std::ostringstream sout;
1347 sout <<
"-- The test matrix S has Frobenius norm " << ATOL
1348 <<
", and the relative error tolerance is TOL = " 1349 << TOL <<
"." << endl;
1357 const int num_X = 2;
1358 Array< RCP< const MV > > X (num_X);
1363 RCP< mat_type >
B (
new mat_type (sizeS, sizeS));
1368 Array< RCP< mat_type > >
C (num_X);
1369 for (
int k = 0; k < num_X; ++k)
1376 const int reportedRank = OM->projectAndNormalize (*Q,
C,
B, X);
1379 std::vector<int> indices (reportedRank);
1380 for (
int j = 0; j < reportedRank; ++j)
1388 sout <<
"-- ||Q(1:" << reportedRank <<
")^* Q(1:" << reportedRank
1389 <<
") - I||_F = " << orthoError << endl;
1390 if (orthoError > TOL)
1392 sout <<
" *** Error: ||Q(1:" << reportedRank <<
")^* Q(1:" 1393 << reportedRank <<
") - I||_F = " << orthoError
1394 <<
" > TOL = " << TOL <<
"." << endl;
1415 for (
int k = 0; k < num_X; ++k)
1418 sout <<
"-- ||S - Q(:, 1:" << reportedRank <<
")*B(1:" 1419 << reportedRank <<
", :) - X1*C1 - X2*C2||_F = " 1420 << residErr << endl;
1421 if (residErr > ATOL * TOL)
1423 sout <<
" *** Error: ||S - Q(:, 1:" << reportedRank
1424 <<
")*B(1:" << reportedRank <<
", :) " 1425 <<
"- X1*C1 - X2*C2||_F = " << residErr
1426 <<
" > ATOL*TOL = " << (ATOL*TOL) <<
"." << endl;
1431 if (reportedRank == 0)
1433 sout <<
"-- Reported rank of Q is zero: skipping Q, X[k] " 1434 "orthogonality test." << endl;
1438 for (
int k = 0; k < num_X; ++k)
1442 sout <<
"-- ||<Q(1:" << reportedRank <<
"), X[" << k
1443 <<
"]>||_F = " << projErr << endl;
1444 if (projErr > ATOL*TOL)
1446 sout <<
" *** Error: ||<Q(1:" << reportedRank <<
"), X[" 1447 << k <<
"]>||_F = " << projErr <<
" > ATOL*TOL = " 1448 << (ATOL*TOL) <<
"." << endl;
1454 sout <<
" *** Error: The OrthoManager subclass instance threw " 1455 "an exception: " << e.what() << endl;
1461 const MsgType type = (numerr == 0) ?
Debug : static_cast<MsgType> (static_cast<int>(
Errors) |
static_cast<int>(
Debug));
1462 MyOM->stream(type) << sout.str();
1463 MyOM->stream(type) << endl;
1480 using Teuchos::null;
1483 using Teuchos::tuple;
1487 std::ostringstream sout;
1524 sout <<
"The test matrix S has Frobenius norm " << ATOL
1525 <<
", and the relative error tolerance is TOL = " 1526 << TOL <<
"." << endl;
1533 const int num_X = 2;
1534 Array< RCP< const MV > > X (num_X);
1541 Array< RCP< mat_type > >
C (num_X);
1542 for (
int k = 0; k < num_X; ++k)
1549 OM->project(*S_copy,
C, X);
1558 for (
int k = 0; k < num_X; ++k)
1561 sout <<
" ||S - S_copy - X1*C1 - X2*C2||_F = " << residErr;
1562 if (residErr > ATOL * TOL)
1564 sout <<
" *** Error: ||S - S_copy - X1*C1 - X2*C2||_F = " << residErr
1565 <<
" > ATOL*TOL = " << (ATOL*TOL) <<
".";
1568 for (
int k = 0; k < num_X; ++k)
1574 sout <<
" *** Error: S is not orthogonal to X[" << k
1575 <<
"] by a factor of " << projErr <<
" > TOL = " 1581 sout <<
" *** Error: The OrthoManager subclass instance threw " 1582 "an exception: " << e.what() << endl;
1588 const MsgType type = (numerr == 0) ?
Debug : static_cast<MsgType> (static_cast<int>(
Errors) |
static_cast<int>(
Debug));
1589 MyOM->stream(type) << sout.str();
1590 MyOM->stream(type) << endl;
1616 using Teuchos::null;
1619 using Teuchos::tuple;
1624 std::ostringstream sout;
1663 sout <<
"The test matrix S has Frobenius norm " << ATOL
1664 <<
", and the relative error tolerance is TOL = " 1665 << TOL <<
"." << endl;
1701 sout <<
" || <S,X1> || before : " << err << endl;
1705 sout <<
" || <S,X2> || before : " << err << endl;
1708 for (
int t = 0; t < numtests; ++t)
1710 Array< RCP< const MV > > theX;
1711 Array< RCP< mat_type > >
C;
1712 if ( (t % 3) == 0 ) {
1716 else if ( (t % 3) == 1 ) {
1721 else if ( (t % 3) == 2 ) {
1728 theX = tuple(X1,X2);
1742 Array< RCP< MV > > S_outs;
1743 Array< Array< RCP< mat_type > > > C_outs;
1755 OM->project(*Scopy,
C,theX);
1758 S_outs.push_back( Scopy );
1759 C_outs.push_back( Array< RCP< mat_type > >(0) );
1768 if ( (t % 3) == 3 ) {
1776 theX = tuple( theX[1], theX[0] );
1780 OM->project(*Scopy,
C,theX);
1783 S_outs.push_back( Scopy );
1786 C_outs.push_back( Array<RCP<mat_type > >() );
1791 theX = tuple( theX[1], theX[0] );
1795 for (
size_type o = 0; o < S_outs.size(); ++o) {
1799 if (C_outs[o].size() > 0) {
1801 if (C_outs[o].size() > 1) {
1806 if (err > ATOL*TOL) {
1807 sout <<
" vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv tolerance exceeded! test failed!" << endl;
1810 sout <<
" " << t <<
"|| S_in - X1*C1 - X2*C2 - S_out || : " << err << endl;
1813 if (theX.size() > 0 && theX[0] != null) {
1816 sout <<
" vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv tolerance exceeded! test failed!" << endl;
1819 sout <<
" " << t <<
"|| <X[0],S> || after : " << err << endl;
1822 if (theX.size() > 1 && theX[1] != null) {
1825 sout <<
" vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv tolerance exceeded! test failed!" << endl;
1828 sout <<
" " << t <<
"|| <X[1],S> || after : " << err << endl;
1837 for (
size_type o1=0; o1<S_outs.size(); o1++) {
1838 for (
size_type o2=o1+1; o2<S_outs.size(); o2++) {
1846 sout <<
" vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv tolerance exceeded! test failed!" << endl;
1854 sout <<
" ------------------------------------------- project() threw exception" << endl;
1855 sout <<
" Error: " << e.what() << endl;
1861 if (numerr>0) type =
Errors;
1862 MyOM->stream(type) << sout.str();
1863 MyOM->stream(type) << endl;
Class which manages the output and verbosity of the Belos solvers.
static int testNormalize(const Teuchos::RCP< Belos::OrthoManager< Scalar, MV > > &OM, const Teuchos::RCP< const MV > &S, const Teuchos::RCP< Belos::OutputManager< Scalar > > &MyOM)
Test OrthoManager::normalize() for the specific OrthoManager instance.
static void baseline(const Teuchos::RCP< const MV > &X, const int numCols, const int numBlocks, const int numTrials)
Establish baseline run time for OrthoManager benchmark.
static int testProjectAndNormalizeOld(const Teuchos::RCP< Belos::OrthoManager< Scalar, MV > > &OM, const Teuchos::RCP< const MV > &S, const Teuchos::RCP< const MV > &X1, const Teuchos::RCP< const MV > &X2, const Teuchos::RCP< Belos::OutputManager< Scalar > > &MyOM)
Test OrthoManager::projectAndNormalize() for the specific OrthoManager instance.
static magnitudeType eps()
static void MvRandom(MV &mv)
Replace the vectors in mv with random vectors.
Mixin for out-of-place orthogonalization.
MsgType
Available message types recognized by the linear solvers.
#define TEUCHOS_TEST_FOR_EXCEPTION(throw_exception_test, Exception, msg)
static Teuchos::RCP< const MV > CloneView(const MV &mv, const std::vector< int > &index)
Creates a new const MV that shares the selected contents of mv (shallow copy).
Declaration of basic traits for the multivector type.
Teuchos::SerialDenseMatrix< int, scalar_type > mat_type
MultiVecTraits< scalar_type, MV > MVT
static void MvTransMv(const ScalarType alpha, const MV &A, const MV &mv, Teuchos::SerialDenseMatrix< int, ScalarType > &B)
Compute a dense matrix B through the matrix-matrix multiply .
Teuchos::ScalarTraits< scalar_type > SCT
static int GetNumberVecs(const MV &mv)
Obtain the number of vectors in mv.
static void Assign(const MV &A, MV &mv)
mv := A
static void benchmark(const Teuchos::RCP< OrthoManager< Scalar, MV > > &orthoMan, const std::string &orthoManName, const std::string &normalization, const Teuchos::RCP< const MV > &X, const int numCols, const int numBlocks, const int numTrials, const Teuchos::RCP< OutputManager< Scalar > > &outMan, std::ostream &resultStream, const bool displayResultsCompactly=false)
Benchmark the given orthogonalization manager.
static void MvAddMv(const ScalarType alpha, const MV &A, const ScalarType beta, const MV &B, MV &mv)
Replace mv with .
Traits class which defines basic operations on multivectors.
SCT::magnitudeType magnitude_type
static void SetBlock(const MV &A, const std::vector< int > &index, MV &mv)
Copy the vectors in A to a set of vectors in mv indicated by the indices given in index...
static Teuchos::RCP< MV > CloneViewNonConst(MV &mv, const std::vector< int > &index)
Creates a new MV that shares the selected contents of mv (shallow copy).
static Teuchos::RCP< MV > Clone(const MV &mv, const int numvecs)
Creates a new empty MV containing numvecs columns.
TEUCHOS_DEPRECATED RCP< T > rcp(T *p, Dealloc_T dealloc, bool owns_mem)
bool is_null(const RCP< T > &p)
static int testProjectNew(const Teuchos::RCP< Belos::OrthoManager< Scalar, MV > > OM, const Teuchos::RCP< const MV > &S, const Teuchos::RCP< const MV > &X1, const Teuchos::RCP< const MV > &X2, const Teuchos::RCP< Belos::OutputManager< Scalar > > &MyOM)
Test OrthoManager::project() for the specific OrthoManager instance.
static int testProject(const Teuchos::RCP< Belos::OrthoManager< Scalar, MV > > OM, const Teuchos::RCP< const MV > &S, const Teuchos::RCP< const MV > &X1, const Teuchos::RCP< const MV > &X2, const Teuchos::RCP< Belos::OutputManager< Scalar > > &MyOM)
Teuchos::ScalarTraits< Scalar >::magnitudeType magnitude_type
Exception thrown to signal error in an orthogonalization manager method.
static int runTests(const Teuchos::RCP< OrthoManager< Scalar, MV > > &OM, const bool isRankRevealing, const Teuchos::RCP< MV > &S, const int sizeX1, const int sizeX2, const Teuchos::RCP< OutputManager< Scalar > > &MyOM)
Run all the tests.
static Teuchos::RCP< MV > CloneCopy(const MV &mv)
Creates a new MV and copies contents of mv into the new vector (deep copy).
static int testProjectAndNormalizeNew(const Teuchos::RCP< Belos::OrthoManager< Scalar, MV > > OM, const Teuchos::RCP< const MV > &S, const Teuchos::RCP< const MV > &X1, const Teuchos::RCP< const MV > &X2, const Teuchos::RCP< Belos::OutputManager< Scalar > > &MyOM)
Test OrthoManager::projectAndNormalize() for the specific OrthoManager instance.
static void MvTimesMatAddMv(const ScalarType alpha, const MV &A, const Teuchos::SerialDenseMatrix< int, ScalarType > &B, const ScalarType beta, MV &mv)
Update mv with .
static bool HasConstantStride(const MV &mv)
Whether the given multivector mv has constant stride.
static magnitudeType magnitude(T a)
Teuchos::ScalarTraits< magnitude_type > SMT
static ptrdiff_t GetGlobalLength(const MV &mv)
Return the number of rows in the given multivector mv.
void push_back(const value_type &x)
static magnitude_type MVDiff(const MV &X, const MV &Y)
Compute and return $|X - Y|_F$, the Frobenius (sum of squares) norm of the difference between X and Y...
static int testProjectOld(const Teuchos::RCP< Belos::OrthoManager< Scalar, MV > > OM, const Teuchos::RCP< const MV > &S, const Teuchos::RCP< const MV > &X1, const Teuchos::RCP< const MV > &X2, const Teuchos::RCP< Belos::OutputManager< Scalar > > &MyOM)
Test OrthoManager::project() for the specific OrthoManager instance.
Teuchos::Array< Teuchos::RCP< MV > >::size_type size_type
Teuchos::SerialDenseMatrix< int, Scalar > mat_type
static magnitude_type frobeniusNorm(const MV &X)
Compute and return the Frobenius norm of X.
Belos header file which uses auto-configuration information to include necessary C++ headers...
Wrapper around OrthoManager test functionality.
MultiVecTraits< Scalar, MV > MVT
static int testProjectAndNormalize(const Teuchos::RCP< Belos::OrthoManager< Scalar, MV > > OM, const Teuchos::RCP< const MV > &S, const Teuchos::RCP< const MV > &X1, const Teuchos::RCP< const MV > &X2, const Teuchos::RCP< Belos::OutputManager< Scalar > > &MyOM)