|
Thyra Package Browser (Single Doxygen Collection) Version of the Day
|
Here we show some simple examples of using code in the Thyra package with an example ANA algorithm for the iterative solution of symmetric positive-definite linear systems using the conjugate gradient (CG) method. More...
|
Modules | |
| Templated Serial Implementation of the CG Method | |
Here is an example program that shows the use of the example serial templated matrix class | |
| Templated SPMD Implementation of the CG Method | |
Here is an example program that shows the use of the example SPMD templated matrix class | |
Functions | |
| template<class Scalar > | |
| bool | sillyCgSolve (const Thyra::LinearOpBase< Scalar > &A, const Thyra::VectorBase< Scalar > &b, const int maxNumIters, const typename Teuchos::ScalarTraits< Scalar >::magnitudeType tolerance, const Teuchos::Ptr< Thyra::VectorBase< Scalar > > &x, std::ostream &out) |
| Silly little example unpreconditioned CG solver. | |
| template<class Scalar > | |
| void | sillyModifiedGramSchmidt (Thyra::MultiVectorBase< Scalar > *V_inout, Teuchos::RCP< Thyra::MultiVectorBase< Scalar > > *R_out) |
| Silly little implementation of the modified Gram-Schmidt algorithm to compute a QR factorization V=Q*R of a multi-vector V. | |
Here we show some simple examples of using code in the Thyra package with an example ANA algorithm for the iterative solution of symmetric positive-definite linear systems using the conjugate gradient (CG) method.
The CG ANA is implemented in the function sillyCgSolve() and its implementation is shown below:
Another version of this CG algorithm is demonstrated in the below function:
This above templated functions are used in the following various example implementations which use several different scalar types:
| bool sillyCgSolve | ( | const Thyra::LinearOpBase< Scalar > & | A, |
| const Thyra::VectorBase< Scalar > & | b, | ||
| const int | maxNumIters, | ||
| const typename Teuchos::ScalarTraits< Scalar >::magnitudeType | tolerance, | ||
| const Teuchos::Ptr< Thyra::VectorBase< Scalar > > & | x, | ||
| std::ostream & | out | ||
| ) |
Silly little example unpreconditioned CG solver.
This little function is just a silly little ANA that implements the CG (conjugate gradient) method for solving symmetric positive definite systems using the foundational Thyra operator/vector interfaces.
This function is small and is meant to be looked at so study its implementation by clicking on the below link to its definition.
Definition at line 49 of file sillyCgSolve.hpp.
References Thyra::apply(), Thyra::VectorSpaceBase< Scalar >::createMember(), Thyra::LinearOpBase< Scalar >::domain(), Thyra::VectorBase< Scalar >::inner(), Thyra::VectorBase< Scalar >::norm(), Thyra::NOTRANS, THYRA_ASSERT_LINEAR_OP_VEC_APPLY_SPACES, Thyra::VectorBase< Scalar >::V_V(), Thyra::V_V(), Thyra::VectorBase< Scalar >::Vp_StV(), Thyra::MultiVectorBase< Scalar >::Vp_V(), and Thyra::DefaultZeroLinearOp< Scalar >::zero().
Referenced by main(), and runCgSolveExample().
| void sillyModifiedGramSchmidt | ( | Thyra::MultiVectorBase< Scalar > * | V_inout, |
| Teuchos::RCP< Thyra::MultiVectorBase< Scalar > > * | R_out | ||
| ) |
Silly little implementation of the modified Gram-Schmidt algorithm to compute a QR factorization V=Q*R of a multi-vector V.
| V | [in/out] On input, contains the columns to compute the factorization for. On output, contains the columns of Q. |
| R | [out] On output, contains the upper triangular matrix R. |
ToDo: Finish documentation!
Definition at line 49 of file sillyModifiedGramSchmidt.hpp.
References Thyra::MultiVectorBase< Scalar >::col(), Thyra::LinearOpBase< Scalar >::domain(), Thyra::n, Thyra::scale(), and Thyra::update().
Referenced by Thyra::DefaultLumpedParameterModelEvaluator< Scalar >::generateParameterBasisMatrix().
1.7.4