本文整理汇总了C++中thyra::LinearOpTester::adjoint_warning_tol方法的典型用法代码示例。如果您正苦于以下问题:C++ LinearOpTester::adjoint_warning_tol方法的具体用法?C++ LinearOpTester::adjoint_warning_tol怎么用?C++ LinearOpTester::adjoint_warning_tol使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类thyra::LinearOpTester
的用法示例。
在下文中一共展示了LinearOpTester::adjoint_warning_tol方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: run_composite_linear_ops_tests
bool run_composite_linear_ops_tests(
const Teuchos::RCP<const Teuchos::Comm<Thyra::Ordinal> > comm,
const int n,
const bool useSpmd,
const typename Teuchos::ScalarTraits<Scalar>::magnitudeType &tol,
const bool dumpAll,
Teuchos::FancyOStream *out_arg
)
{
using Teuchos::as;
typedef Teuchos::ScalarTraits<Scalar> ST;
typedef typename ST::magnitudeType ScalarMag;
typedef Teuchos::ScalarTraits<ScalarMag> STM;
using Teuchos::RCP;
using Teuchos::rcp;
using Teuchos::null;
using Teuchos::rcp_const_cast;
using Teuchos::rcp_dynamic_cast;
using Teuchos::dyn_cast;
using Teuchos::OSTab;
using Thyra::relErr;
using Thyra::passfail;
RCP<Teuchos::FancyOStream>
out = rcp(new Teuchos::FancyOStream(rcp(out_arg,false)));
const Teuchos::EVerbosityLevel
verbLevel = dumpAll?Teuchos::VERB_EXTREME:Teuchos::VERB_HIGH;
if (nonnull(out)) *out
<< "\n*** Entering run_composite_linear_ops_tests<"<<ST::name()<<">(...) ...\n";
bool success = true, result;
const ScalarMag warning_tol = ScalarMag(1e-2)*tol, error_tol = tol;
Thyra::LinearOpTester<Scalar> linearOpTester;
linearOpTester.linear_properties_warning_tol(warning_tol);
linearOpTester.linear_properties_error_tol(error_tol);
linearOpTester.adjoint_warning_tol(warning_tol);
linearOpTester.adjoint_error_tol(error_tol);
linearOpTester.dump_all(dumpAll);
Thyra::LinearOpTester<Scalar> symLinearOpTester(linearOpTester);
symLinearOpTester.check_for_symmetry(true);
symLinearOpTester.symmetry_warning_tol(STM::squareroot(warning_tol));
symLinearOpTester.symmetry_error_tol(STM::squareroot(error_tol));
RCP<const Thyra::VectorSpaceBase<Scalar> > space;
if(useSpmd) space = Thyra::defaultSpmdVectorSpace<Scalar>(comm,n,-1);
else space = Thyra::defaultSpmdVectorSpace<Scalar>(n);
if (nonnull(out)) *out
<< "\nUsing a basic vector space described as " << describe(*space,verbLevel) << " ...\n";
if (nonnull(out)) *out << "\nCreating random n x (n/2) multi-vector origA ...\n";
RCP<Thyra::MultiVectorBase<Scalar> >
mvOrigA = createMembers(space,n/2,"origA");
Thyra::seed_randomize<Scalar>(0);
//RTOpPack::show_spmd_apply_op_dump = true;
Thyra::randomize( as<Scalar>(as<Scalar>(-1)*ST::one()), as<Scalar>(as<Scalar>(+1)*ST::one()),
mvOrigA.ptr() );
RCP<const Thyra::LinearOpBase<Scalar> >
origA = mvOrigA;
if (nonnull(out)) *out << "\norigA =\n" << describe(*origA,verbLevel);
//RTOpPack::show_spmd_apply_op_dump = false;
if (nonnull(out)) *out << "\nTesting origA ...\n";
Thyra::seed_randomize<Scalar>(0);
result = linearOpTester.check(*origA, out.ptr());
if(!result) success = false;
if (nonnull(out)) *out
<< "\nCreating implicit scaled linear operator A1 = scale(0.5,origA) ...\n";
RCP<const Thyra::LinearOpBase<Scalar> >
A1 = scale(as<Scalar>(0.5),origA);
if (nonnull(out)) *out << "\nA1 =\n" << describe(*A1,verbLevel);
if (nonnull(out)) *out << "\nTesting A1 ...\n";
Thyra::seed_randomize<Scalar>(0);
result = linearOpTester.check(*A1,out.ptr());
if(!result) success = false;
if (nonnull(out)) *out << "\nTesting that A1.getOp() == origA ...\n";
Thyra::seed_randomize<Scalar>(0);
result = linearOpTester.compare(
*dyn_cast<const Thyra::DefaultScaledAdjointLinearOp<Scalar> >(*A1).getOp(),
*origA,out.ptr());
if(!result) success = false;
{
if (nonnull(out)) *out
<< "\nUnwrapping origA to get non-persisting pointer to origA_1, scalar and transp ...\n";
Scalar scalar;
Thyra::EOpTransp transp;
const Thyra::LinearOpBase<Scalar> *origA_1 = NULL;
unwrap( *origA, &scalar, &transp, &origA_1 );
TEUCHOS_TEST_FOR_EXCEPT( origA_1 == NULL );
if (nonnull(out)) *out << "\nscalar = " << scalar << " == 1 ? ";
result = (scalar == ST::one());
//.........这里部分代码省略.........