本文整理汇总了C++中Thyra::subtract方法的典型用法代码示例。如果您正苦于以下问题:C++ Thyra::subtract方法的具体用法?C++ Thyra::subtract怎么用?C++ Thyra::subtract使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Thyra
的用法示例。
在下文中一共展示了Thyra::subtract方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: exampleImplicitlyComposedLinearOperators
int exampleImplicitlyComposedLinearOperators(
const int n0,
const int n1,
const int n2,
Teuchos::FancyOStream &out,
const Teuchos::EVerbosityLevel verbLevel,
typename Teuchos::ScalarTraits<Scalar>::magnitudeType errorTol,
const bool testAdjoint
)
{
// Using and other declarations
typedef Teuchos::ScalarTraits<Scalar> ST;
using Teuchos::as;
using Teuchos::RCP;
using Teuchos::OSTab;
using Thyra::VectorSpaceBase;
using Thyra::VectorBase;
using Thyra::MultiVectorBase;
using Thyra::LinearOpBase;
using Thyra::defaultSpmdVectorSpace;
using Thyra::randomize;
using Thyra::identity;
using Thyra::diagonal;
using Thyra::multiply;
using Thyra::add;
using Thyra::subtract;
using Thyra::scale;
using Thyra::adjoint;
using Thyra::block1x2;
using Thyra::block2x2;
using Thyra::block2x2;
out << "\n***"
<< "\n*** Demonstrating building linear operators for scalar type "
<< ST::name()
<< "\n***\n";
OSTab tab(out);
//
// A) Set up the basic objects and other inputs to build the implicitly
// composed linear operators.
//
// Create serial vector spaces in this case
const RCP<const VectorSpaceBase<Scalar> >
space0 = defaultSpmdVectorSpace<Scalar>(n0),
space1 = defaultSpmdVectorSpace<Scalar>(n1),
space2 = defaultSpmdVectorSpace<Scalar>(n2);
// Create the component linear operators first as multi-vectors
const RCP<MultiVectorBase<Scalar> >
mvA = createMembers(space2, n0, "A"),
mvB = createMembers(space0, n2, "B"),
mvC = createMembers(space0, n0, "C"),
mvE = createMembers(space0, n1, "E"),
mvF = createMembers(space0, n1, "F"),
mvJ = createMembers(space2, n1, "J"),
mvK = createMembers(space1, n2, "K"),
mvL = createMembers(space2, n1, "L"),
mvN = createMembers(space0, n1, "N"),
mvP = createMembers(space2, n1, "P"),
mvQ = createMembers(space0, n2, "Q");
// Create the vector diagonal for D
const RCP<VectorBase<Scalar> > d = createMember(space2);
// Get the constants
const Scalar
one = 1.0,
beta = 2.0,
gamma = 3.0,
eta = 4.0;
// Randomize the values in the Multi-Vector
randomize( -one, +one, mvA.ptr() );
randomize( -one, +one, mvB.ptr() );
randomize( -one, +one, mvC.ptr() );
randomize( -one, +one, d.ptr() );
randomize( -one, +one, mvE.ptr() );
randomize( -one, +one, mvF.ptr() );
randomize( -one, +one, mvJ.ptr() );
randomize( -one, +one, mvK.ptr() );
randomize( -one, +one, mvL.ptr() );
randomize( -one, +one, mvN.ptr() );
randomize( -one, +one, mvP.ptr() );
randomize( -one, +one, mvQ.ptr() );
// Get the linear operator forms of the basic component linear operators
const RCP<const LinearOpBase<Scalar> >
A = mvA,
B = mvB,
C = mvC,
E = mvE,
F = mvF,
J = mvJ,
K = mvK,
L = mvL,
N = mvN,
//.........这里部分代码省略.........