296 typedef typename Teuchos::Array<Teuchos::RCP<MV> >::size_type size_type;
300 typedef Teuchos::ScalarTraits<scalar_type>
SCT;
302 typedef Teuchos::ScalarTraits<magnitude_type>
SMT;
324 const bool isRankRevealing,
325 const Teuchos::RCP<MV>& S,
330 using Teuchos::Array;
334 using Teuchos::rcp_dynamic_cast;
335 using Teuchos::tuple;
349 std::ostream& debugOut = MyOM->stream(
Debug);
358 debugOut <<
"Generating X1,X2 for testing... ";
361 debugOut <<
"done." << endl;
368 debugOut <<
"Filling X1 with random values... ";
370 debugOut <<
"done." << endl
371 <<
"Calling normalize() on X1... ";
376 const int initialX1Rank = OM->normalize(*X1, Teuchos::null);
377 TEUCHOS_TEST_FOR_EXCEPTION(initialX1Rank != sizeX1,
379 "normalize(X1) returned rank "
380 << initialX1Rank <<
" from " << sizeX1
381 <<
" vectors. Cannot continue.");
382 debugOut <<
"done." << endl
383 <<
"Calling orthonormError() on X1... ";
384 err = OM->orthonormError(*X1);
385 TEUCHOS_TEST_FOR_EXCEPTION(err > TOL, std::runtime_error,
386 "After normalize(X1), orthonormError(X1) = "
387 << err <<
" > TOL = " << TOL);
388 debugOut <<
"done: ||<X1,X1> - I|| = " << err << endl;
394 debugOut <<
"Filling X2 with random values... ";
396 debugOut <<
"done." << endl
397 <<
"Calling projectAndNormalize(X2, C, B, tuple(X1))... "
401 Array<RCP<DM> > C (1);
402 RCP<DM> B = Teuchos::null;
404 OM->projectAndNormalize (*X2, C, B, tuple<RCP<const MV> >(X1));
406 TEUCHOS_TEST_FOR_EXCEPTION(initialX2Rank != sizeX2,
408 "projectAndNormalize(X2,X1) returned rank "
409 << initialX2Rank <<
" from " << sizeX2
410 <<
" vectors. Cannot continue.");
411 debugOut <<
"done." << endl
412 <<
"Calling orthonormError() on X2... ";
413 err = OM->orthonormError (*X2);
414 TEUCHOS_TEST_FOR_EXCEPTION(err > TOL,
416 "projectAndNormalize(X2,X1) did not meet tolerance: "
417 "orthonormError(X2) = " << err <<
" > TOL = " << TOL);
418 debugOut <<
"done: || <X2,X2> - I || = " << err << endl
419 <<
"Calling orthogError(X2, X1)... ";
420 err = OM->orthogError (*X2, *X1);
421 TEUCHOS_TEST_FOR_EXCEPTION(err > TOL,
423 "projectAndNormalize(X2,X1) did not meet tolerance: "
424 "orthogError(X2,X1) = " << err <<
" > TOL = " << TOL);
425 debugOut <<
"done: || <X2,X1> || = " << err << endl;
428#ifdef HAVE_BELOS_TSQR
434 RCP<mixin_type> tsqr = rcp_dynamic_cast<mixin_type>(OM);
435 if (! tsqr.is_null())
439 <<
"=== OutOfPlaceNormalizerMixin tests ==="
449 debugOut <<
"Filling X1_in with random values... ";
451 debugOut <<
"done." << endl;
452 debugOut <<
"Filling X1_out with different random values...";
455 debugOut <<
"done." << endl
456 <<
"Calling normalizeOutOfPlace(*X1_in, *X1_out, null)... ";
457 const int initialX1Rank =
458 tsqr->normalizeOutOfPlace(*X1_in, *X1_out, Teuchos::null);
459 TEUCHOS_TEST_FOR_EXCEPTION(initialX1Rank != sizeX1, std::runtime_error,
460 "normalizeOutOfPlace(*X1_in, *X1_out, null) "
461 "returned rank " << initialX1Rank <<
" from "
462 << sizeX1 <<
" vectors. Cannot continue.");
463 debugOut <<
"done." << endl
464 <<
"Calling orthonormError() on X1_out... ";
465 err = OM->orthonormError(*X1_out);
466 TEUCHOS_TEST_FOR_EXCEPTION(err > TOL, std::runtime_error,
467 "After calling normalizeOutOfPlace(*X1_in, "
468 "*X1_out, null), orthonormError(X1) = "
469 << err <<
" > TOL = " << TOL);
470 debugOut <<
"done: ||<X1_out,X1_out> - I|| = " << err << endl;
481 debugOut <<
"Filling X2_in with random values... ";
483 debugOut <<
"done." << endl
484 <<
"Filling X2_out with different random values...";
487 debugOut <<
"done." << endl
488 <<
"Calling projectAndNormalizeOutOfPlace(X2_in, X2_out, "
489 <<
"C, B, X1_out)...";
492 Array<RCP<DM> > C (1);
493 RCP<DM> B = Teuchos::null;
495 tsqr->projectAndNormalizeOutOfPlace (*X2_in, *X2_out, C, B,
496 tuple<RCP<const MV> >(X1_out));
498 TEUCHOS_TEST_FOR_EXCEPTION(initialX2Rank != sizeX2,
500 "projectAndNormalizeOutOfPlace(*X2_in, "
501 "*X2_out, C, B, tuple(X1_out)) returned rank "
502 << initialX2Rank <<
" from " << sizeX2
503 <<
" vectors. Cannot continue.");
504 debugOut <<
"done." << endl
505 <<
"Calling orthonormError() on X2_out... ";
506 err = OM->orthonormError (*X2_out);
507 TEUCHOS_TEST_FOR_EXCEPTION(err > TOL, std::runtime_error,
508 "projectAndNormalizeOutOfPlace(*X2_in, *X2_out, "
509 "C, B, tuple(X1_out)) did not meet tolerance: "
510 "orthonormError(X2_out) = "
511 << err <<
" > TOL = " << TOL);
512 debugOut <<
"done: || <X2_out,X2_out> - I || = " << err << endl
513 <<
"Calling orthogError(X2_out, X1_out)... ";
514 err = OM->orthogError (*X2_out, *X1_out);
515 TEUCHOS_TEST_FOR_EXCEPTION(err > TOL, std::runtime_error,
516 "projectAndNormalizeOutOfPlace(*X2_in, *X2_out, "
517 "C, B, tuple(X1_out)) did not meet tolerance: "
518 "orthogError(X2_out, X1_out) = "
519 << err <<
" > TOL = " << TOL);
520 debugOut <<
"done: || <X2_out,X1_out> || = " << err << endl;
522 <<
"=== Done with OutOfPlaceNormalizerMixin tests ==="
534 debugOut <<
"Testing project() by projecting a random multivector S "
535 "against various combinations of X1 and X2 " << endl;
536 const int thisNumFailed = testProject(OM,S,X1,X2,MyOM);
537 numFailed += thisNumFailed;
538 if (thisNumFailed > 0)
539 debugOut <<
" *** " << thisNumFailed
540 << (thisNumFailed > 1 ?
" tests" :
" test")
541 <<
" failed." << endl;
548 debugOut <<
"Testing normalize() on bad multivectors " << endl;
549 const int thisNumFailed = testNormalize(OM,S,MyOM);
550 numFailed += thisNumFailed;
569 debugOut <<
"Testing project() by projecting [X1 X2]-range multivector "
570 "against P_X1 P_X2 " << endl;
571 const int thisNumFailed = testProject(OM,S,X1,X2,MyOM);
572 numFailed += thisNumFailed;
573 if (thisNumFailed > 0)
574 debugOut <<
" *** " << thisNumFailed
575 << (thisNumFailed > 1 ?
" tests" :
" test")
576 <<
" failed." << endl;
581 if (isRankRevealing && sizeS > 2)
587 std::vector<int> ind(1);
591 debugOut <<
"Testing normalize() on a rank-deficient multivector " << endl;
592 const int thisNumFailed = testNormalizeRankReveal(OM,S,MyOM);
593 numFailed += thisNumFailed;
594 if (thisNumFailed > 0)
595 debugOut <<
" *** " << thisNumFailed
596 << (thisNumFailed > 1 ?
" tests" :
" test")
597 <<
" failed." << endl;
602 if (isRankRevealing && sizeS > 1)
610 for (
int i=0; i<sizeS; i++)
612 std::vector<int> ind(1);
617 debugOut <<
"Testing normalize() on a rank-1 multivector " << endl;
618 const int thisNumFailed = testNormalizeRankReveal(OM,S,MyOM);
619 numFailed += thisNumFailed;
620 if (thisNumFailed > 0)
621 debugOut <<
" *** " << thisNumFailed
622 << (thisNumFailed > 1 ?
" tests" :
" test")
623 <<
" failed." << endl;
627 std::vector<int> ind(1);
630 debugOut <<
"Testing projectAndNormalize() on a random multivector " << endl;
631 const int thisNumFailed = testProjectAndNormalize(OM,S,X1,X2,MyOM);
632 numFailed += thisNumFailed;
633 if (thisNumFailed > 0)
634 debugOut <<
" *** " << thisNumFailed
635 << (thisNumFailed > 1 ?
" tests" :
" test")
636 <<
" failed." << endl;
653 debugOut <<
"Testing projectAndNormalize() by projecting [X1 X2]-range "
654 "multivector against P_X1 P_X2 " << endl;
655 const int thisNumFailed = testProjectAndNormalize(OM,S,X1,X2,MyOM);
656 numFailed += thisNumFailed;
657 if (thisNumFailed > 0)
658 debugOut <<
" *** " << thisNumFailed
659 << (thisNumFailed > 1 ?
" tests" :
" test")
660 <<
" failed." << endl;
665 if (isRankRevealing && sizeS > 2)
671 std::vector<int> ind(1);
675 debugOut <<
"Testing projectAndNormalize() on a rank-deficient "
676 "multivector " << endl;
677 const int thisNumFailed = testProjectAndNormalize(OM,S,X1,X2,MyOM);
678 numFailed += thisNumFailed;
679 if (thisNumFailed > 0)
680 debugOut <<
" *** " << thisNumFailed
681 << (thisNumFailed > 1 ?
" tests" :
" test")
682 <<
" failed." << endl;
687 if (isRankRevealing && sizeS > 1)
695 for (
int i=0; i<sizeS; i++)
697 std::vector<int> ind(1);
702 debugOut <<
"Testing projectAndNormalize() on a rank-1 multivector " << endl;
703 bool constantStride =
true;
705 debugOut <<
"-- S does not have constant stride" << endl;
706 constantStride =
false;
709 debugOut <<
"-- X1 does not have constant stride" << endl;
710 constantStride =
false;
713 debugOut <<
"-- X2 does not have constant stride" << endl;
714 constantStride =
false;
716 if (! constantStride) {
717 debugOut <<
"-- Skipping this test, since TSQR does not work on "
718 "multivectors with nonconstant stride" << endl;
721 const int thisNumFailed = testProjectAndNormalize(OM,S,X1,X2,MyOM);
722 numFailed += thisNumFailed;
723 if (thisNumFailed > 0) {
724 debugOut <<
" *** " << thisNumFailed
725 << (thisNumFailed > 1 ?
" tests" :
" test")
726 <<
" failed." << endl;
731 if (numFailed != 0) {
732 MyOM->stream(
Errors) << numFailed <<
" total test failures." << endl;
744 MVDiff (
const MV& X,
const MV& Y)
752 "MVDiff: X and Y should have the same number of columns."
753 " X has " << numCols <<
" column(s) and Y has "
760 return frobeniusNorm (*Resid);
768 frobeniusNorm (
const MV& X)
781 for (
int i = 0; i < numCols; ++i)
784 return SCT::magnitude (SCT::squareroot (err));
790 const Teuchos::RCP< const MV >& S,
791 const Teuchos::RCP< const MV >& X1,
792 const Teuchos::RCP< const MV >& X2,
795 return testProjectAndNormalizeNew (OM, S, X1, X2, MyOM);
803 testProjectAndNormalizeOld (
const Teuchos::RCP< Belos::OrthoManager< Scalar, MV, DM > >& OM,
804 const Teuchos::RCP< const MV >& S,
805 const Teuchos::RCP< const MV >& X1,
806 const Teuchos::RCP< const MV >& X2,
807 const Teuchos::RCP< Belos::OutputManager< Scalar > >& MyOM)
809 using Teuchos::Array;
813 using Teuchos::tuple;
827 std::ostringstream sout;
863 sout <<
" || <S,X1> || before : " << err << endl;
867 sout <<
" || <S,X2> || before : " << err << endl;
870 for (
int t=0; t<numtests; t++) {
872 Array< RCP< const MV > > theX;
875 if ( (t % 3) == 0 ) {
879 else if ( (t % 3) == 1 ) {
884 else if ( (t % 3) == 2 ) {
909 Array<RCP<MV> > S_outs;
910 Array<Array<RCP<DM > > > C_outs;
911 Array<RCP<DM > > B_outs;
919 for (size_type i=0; i<C.size(); i++) {
929 int ret = OM->projectAndNormalize(*Scopy,C,B,theX);
930 sout <<
"projectAndNormalize() returned rank " << ret << endl;
932 sout <<
" *** Error: returned rank is zero, cannot continue tests" << endl;
936 ret_out.push_back(ret);
946 std::vector<int> ind(ret);
947 for (
int i=0; i<ret; i++) {
954 S_outs.push_back( Scopy );
957 C_outs.push_back( Array<RCP<DM> >(0) );
966 if ( (t % 3) == 3 ) {
975 for (size_type i=0; i<C.size(); i++) {
979 theX = tuple( theX[1], theX[0] );
983 ret = OM->projectAndNormalize(*Scopy,C,B,theX);
984 sout <<
"projectAndNormalize() returned rank " << ret << endl;
986 sout <<
" *** Error: returned rank is zero, cannot continue tests" << endl;
990 ret_out.push_back(ret);
1000 std::vector<int> ind(ret);
1001 for (
int i=0; i<ret; i++) {
1008 S_outs.push_back( Scopy );
1011 C_outs.push_back( Array<RCP<DM> >() );
1016 theX = tuple( theX[1], theX[0] );
1021 for (size_type o=0; o<S_outs.size(); o++) {
1027 <<
" *** Test (number " << (t+1) <<
" of " << numtests
1028 <<
" total tests) failed: Tolerance exceeded! Error = "
1029 << err <<
" > TOL = " << TOL <<
"."
1033 sout <<
" || <S,S> - I || after : " << err << endl;
1039 if (C_outs[o].size() > 0) {
1041 if (C_outs[o].size() > 1) {
1046 if (err > ATOL*TOL) {
1048 <<
" *** Test (number " << (t+1) <<
" of " << numtests
1049 <<
" total tests) failed: Tolerance exceeded! Error = "
1050 << err <<
" > ATOL*TOL = " << (ATOL*TOL) <<
"."
1054 sout <<
" " << t <<
"|| S_in - X1*C1 - X2*C2 - S_out*B || : " << err << endl;
1057 if (theX.size() > 0 && theX[0] != null) {
1061 <<
" *** Test (number " << (t+1) <<
" of " << numtests
1062 <<
" total tests) failed: Tolerance exceeded! Error = "
1063 << err <<
" > TOL = " << TOL <<
"."
1067 sout <<
" " << t <<
"|| <X[0],S> || after : " << err << endl;
1070 if (theX.size() > 1 && theX[1] != null) {
1074 <<
" *** Test (number " << (t+1) <<
" of " << numtests
1075 <<
" total tests) failed: Tolerance exceeded! Error = "
1076 << err <<
" > TOL = " << TOL <<
"."
1080 sout <<
" " << t <<
"|| <X[1],S> || after : " << err << endl;
1084 catch (Belos::OrthoError& e) {
1085 sout <<
" *** Error: OrthoManager threw exception: " << e.what() << endl;
1096 const int msgType = (numerr > 0) ?
1097 (
static_cast<int>(
Debug) |
static_cast<int>(
Errors)) :
1098 static_cast<int>(
Debug);
1102 MyOM->stream(
static_cast< MsgType >(msgType)) << sout.str() << endl;
1111 testNormalize (
const Teuchos::RCP< Belos::OrthoManager< Scalar, MV, DM > >& OM,
1112 const Teuchos::RCP< const MV >& S,
1113 const Teuchos::RCP< Belos::OutputManager< Scalar > >& MyOM)
1117 int numFailures = 0;
1120 const int msgType = (
static_cast<int>(
Debug) |
static_cast<int>(
Errors));
1125 std::vector< magnitude_type > zeroNorm( 1 );
1128 OM->normalize( *zeroVec, bZero );
1131 if ( zeroNorm[0] != ZERO )
1133 MyOM->stream(
static_cast< MsgType >(msgType)) <<
" --> Normalization of zero vector FAILED!" << std::endl;
1145 testNormalizeRankReveal (
const Teuchos::RCP< Belos::OrthoManager< Scalar, MV, DM > >& OM,
1146 const Teuchos::RCP< const MV >& S,
1147 const Teuchos::RCP< Belos::OutputManager< Scalar > >& MyOM)
1149 using Teuchos::Array;
1152 using Teuchos::tuple;
1155 std::ostringstream sout;
1200 sout <<
"The test matrix S has Frobenius norm " << ATOL
1201 <<
", and the relative error tolerance is TOL = "
1202 << TOL <<
"." << endl;
1204 const int numtests = 1;
1205 for (
int t = 0; t < numtests; ++t) {
1224 const int reportedRank = OM->normalize (*S_copy, B);
1225 sout <<
"normalize() returned rank " << reportedRank << endl;
1226 if (reportedRank == 0) {
1227 sout <<
" *** Error: Cannot continue, since normalize() "
1228 "reports that S has rank 0" << endl;
1242 std::vector<int> indices (reportedRank);
1243 for (
int j = 0; j < reportedRank; ++j)
1257 sout <<
" *** Error: Tolerance exceeded: err = "
1258 << err <<
" > TOL = " << TOL << endl;
1261 sout <<
" || <S,S> - I || after : " << err << endl;
1279 if (err > ATOL*TOL) {
1280 sout <<
" *** Error: Tolerance exceeded: err = "
1281 << err <<
" > ATOL*TOL = " << (ATOL*TOL) << endl;
1284 sout <<
" " << t <<
"|| S - Q*B || : " << err << endl;
1287 catch (Belos::OrthoError& e) {
1288 sout <<
" *** Error: the OrthoManager's normalize() method "
1289 "threw an exception: " << e.what() << endl;
1296 MyOM->stream(type) << sout.str();
1297 MyOM->stream(type) << endl;
1307 testProjectAndNormalizeNew (
const Teuchos::RCP< Belos::OrthoManager< Scalar, MV, DM > > OM,
1308 const Teuchos::RCP< const MV >& S,
1309 const Teuchos::RCP< const MV >& X1,
1310 const Teuchos::RCP< const MV >& X2,
1311 const Teuchos::RCP< Belos::OutputManager< Scalar > >& MyOM)
1313 using Teuchos::Array;
1314 using Teuchos::null;
1317 using Teuchos::tuple;
1321 std::ostringstream sout;
1358 sout <<
"-- The test matrix S has Frobenius norm " << ATOL
1359 <<
", and the relative error tolerance is TOL = "
1360 << TOL <<
"." << endl;
1368 const int num_X = 2;
1369 Array< RCP< const MV > > X (num_X);
1379 Array< RCP< DM > > C (num_X);
1380 for (
int k = 0; k < num_X; ++k)
1387 const int reportedRank = OM->projectAndNormalize (*Q, C, B, X);
1390 std::vector<int> indices (reportedRank);
1391 for (
int j = 0; j < reportedRank; ++j)
1399 sout <<
"-- ||Q(1:" << reportedRank <<
")^* Q(1:" << reportedRank
1400 <<
") - I||_F = " << orthoError << endl;
1401 if (orthoError > TOL)
1403 sout <<
" *** Error: ||Q(1:" << reportedRank <<
")^* Q(1:"
1404 << reportedRank <<
") - I||_F = " << orthoError
1405 <<
" > TOL = " << TOL <<
"." << endl;
1415 MVT::MvAddMv (SCT::one(), *S, SCT::zero(), *Residual, *Residual);
1426 for (
int k = 0; k < num_X; ++k)
1429 sout <<
"-- ||S - Q(:, 1:" << reportedRank <<
")*B(1:"
1430 << reportedRank <<
", :) - X1*C1 - X2*C2||_F = "
1431 << residErr << endl;
1432 if (residErr > ATOL * TOL)
1434 sout <<
" *** Error: ||S - Q(:, 1:" << reportedRank
1435 <<
")*B(1:" << reportedRank <<
", :) "
1436 <<
"- X1*C1 - X2*C2||_F = " << residErr
1437 <<
" > ATOL*TOL = " << (ATOL*TOL) <<
"." << endl;
1442 if (reportedRank == 0)
1444 sout <<
"-- Reported rank of Q is zero: skipping Q, X[k] "
1445 "orthogonality test." << endl;
1449 for (
int k = 0; k < num_X; ++k)
1453 sout <<
"-- ||<Q(1:" << reportedRank <<
"), X[" << k
1454 <<
"]>||_F = " << projErr << endl;
1455 if (projErr > ATOL*TOL)
1457 sout <<
" *** Error: ||<Q(1:" << reportedRank <<
"), X["
1458 << k <<
"]>||_F = " << projErr <<
" > ATOL*TOL = "
1459 << (ATOL*TOL) <<
"." << endl;
1464 }
catch (Belos::OrthoError& e) {
1465 sout <<
" *** Error: The OrthoManager subclass instance threw "
1466 "an exception: " << e.what() << endl;
1473 MyOM->stream(type) << sout.str();
1474 MyOM->stream(type) << endl;
1484 testProjectNew (
const Teuchos::RCP< Belos::OrthoManager< Scalar, MV, DM > > OM,
1485 const Teuchos::RCP< const MV >& S,
1486 const Teuchos::RCP< const MV >& X1,
1487 const Teuchos::RCP< const MV >& X2,
1488 const Teuchos::RCP< Belos::OutputManager< Scalar > >& MyOM)
1490 using Teuchos::Array;
1491 using Teuchos::null;
1494 using Teuchos::tuple;
1498 std::ostringstream sout;
1535 sout <<
"The test matrix S has Frobenius norm " << ATOL
1536 <<
", and the relative error tolerance is TOL = "
1537 << TOL <<
"." << endl;
1544 const int num_X = 2;
1545 Array< RCP< const MV > > X (num_X);
1552 Array< RCP< DM > > C (num_X);
1553 for (
int k = 0; k < num_X; ++k)
1560 OM->project(*S_copy, C, X);
1567 MVT::MvAddMv (SCT::one(), *S, -SCT::one(), *S_copy, *Residual);
1569 for (
int k = 0; k < num_X; ++k)
1572 sout <<
" ||S - S_copy - X1*C1 - X2*C2||_F = " << residErr;
1573 if (residErr > ATOL * TOL)
1575 sout <<
" *** Error: ||S - S_copy - X1*C1 - X2*C2||_F = " << residErr
1576 <<
" > ATOL*TOL = " << (ATOL*TOL) <<
".";
1579 for (
int k = 0; k < num_X; ++k)
1585 sout <<
" *** Error: S is not orthogonal to X[" << k
1586 <<
"] by a factor of " << projErr <<
" > TOL = "
1591 }
catch (Belos::OrthoError& e) {
1592 sout <<
" *** Error: The OrthoManager subclass instance threw "
1593 "an exception: " << e.what() << endl;
1600 MyOM->stream(type) << sout.str();
1601 MyOM->stream(type) << endl;
1607 testProject (
const Teuchos::RCP< Belos::OrthoManager< Scalar, MV, DM > > OM,
1608 const Teuchos::RCP< const MV >& S,
1609 const Teuchos::RCP< const MV >& X1,
1610 const Teuchos::RCP< const MV >& X2,
1611 const Teuchos::RCP< Belos::OutputManager< Scalar > >& MyOM)
1613 return testProjectNew (OM, S, X1, X2, MyOM);
1620 testProjectOld (
const Teuchos::RCP< Belos::OrthoManager< Scalar, MV, DM > > OM,
1621 const Teuchos::RCP< const MV >& S,
1622 const Teuchos::RCP< const MV >& X1,
1623 const Teuchos::RCP< const MV >& X2,
1624 const Teuchos::RCP< Belos::OutputManager< Scalar > >& MyOM)
1626 using Teuchos::Array;
1627 using Teuchos::null;
1630 using Teuchos::tuple;
1635 std::ostringstream sout;
1674 sout <<
"The test matrix S has Frobenius norm " << ATOL
1675 <<
", and the relative error tolerance is TOL = "
1676 << TOL <<
"." << endl;
1712 sout <<
" || <S,X1> || before : " << err << endl;
1716 sout <<
" || <S,X2> || before : " << err << endl;
1719 for (
int t = 0; t < numtests; ++t)
1721 Array< RCP< const MV > > theX;
1722 Array< RCP< DM > > C;
1723 if ( (t % 3) == 0 ) {
1727 else if ( (t % 3) == 1 ) {
1732 else if ( (t % 3) == 2 ) {
1739 theX = tuple(X1,X2);
1753 Array< RCP< MV > > S_outs;
1754 Array< Array< RCP< DM > > > C_outs;
1760 for (size_type i = 0; i < C.size(); ++i) {
1766 OM->project(*Scopy,C,theX);
1769 S_outs.push_back( Scopy );
1770 C_outs.push_back( Array< RCP< DM > >(0) );
1779 if ( (t % 3) == 3 ) {
1783 for (size_type i = 0; i < C.size(); ++i) {
1787 theX = tuple( theX[1], theX[0] );
1791 OM->project(*Scopy,C,theX);
1794 S_outs.push_back( Scopy );
1797 C_outs.push_back( Array<RCP<DM> >() );
1802 theX = tuple( theX[1], theX[0] );
1806 for (size_type o = 0; o < S_outs.size(); ++o) {
1810 if (C_outs[o].size() > 0) {
1812 if (C_outs[o].size() > 1) {
1817 if (err > ATOL*TOL) {
1818 sout <<
" vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv tolerance exceeded! test failed!" << endl;
1821 sout <<
" " << t <<
"|| S_in - X1*C1 - X2*C2 - S_out || : " << err << endl;
1824 if (theX.size() > 0 && theX[0] != null) {
1827 sout <<
" vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv tolerance exceeded! test failed!" << endl;
1830 sout <<
" " << t <<
"|| <X[0],S> || after : " << err << endl;
1833 if (theX.size() > 1 && theX[1] != null) {
1836 sout <<
" vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv tolerance exceeded! test failed!" << endl;
1839 sout <<
" " << t <<
"|| <X[1],S> || after : " << err << endl;
1848 for (size_type o1=0; o1<S_outs.size(); o1++) {
1849 for (size_type o2=o1+1; o2<S_outs.size(); o2++) {
1857 sout <<
" vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv tolerance exceeded! test failed!" << endl;
1864 catch (Belos::OrthoError& e) {
1865 sout <<
" ------------------------------------------- project() threw exception" << endl;
1866 sout <<
" Error: " << e.what() << endl;
1872 if (numerr>0) type =
Errors;
1873 MyOM->stream(type) << sout.str();
1874 MyOM->stream(type) << endl;