|
Thyra Package Browser (Single Doxygen Collection) Version of the Day
|
Here is an example program that shows the use of the example serial templated matrix class ExampleTridiagSerialLinearOp with the example linear ANA implementation sillyPowerMethod().
More...
|
Classes | |
| class | ExampleTridiagSerialLinearOp< Scalar > |
| Simple example subclass for serial tridiagonal matrices. More... | |
Here is an example program that shows the use of the example serial templated matrix class ExampleTridiagSerialLinearOp with the example linear ANA implementation sillyPowerMethod().
This example program is contained in the source file:
./example/operator_vector/sillyPowerMethod_serial.cpp
where ./ is the base source directory for Thyra (i.e. ???/Trilinos/packages/Thyra).
The class ExampleTridiagSerialLinearOp that derives from the base class Thyra::SpmdLinearOpBase is quite simple and its complete implementation looks like:
The above serial matrix class is used in an example program (see runPowerMethodExample() below) that calls sillyPowerMethod(). In this example program, the matrix constructed and used is the well-known tridiagonal matrix
The power method is then run on the matrix
run for a number of iterations (or until convergence to some tolerance).
After this, the first diagonal element
is then scaled to
and the power method is run again (which much faster convergence).
The following templated function implements the example described above:
The above templated function runPowerMethodExample() is instantiated with the following scalar types:
float and double std::complex<float> and std::complex<double> (if --enable-teuchos-complex was used at configuration time) mpf_class (if --enable-teuchos-gmp was used at configuration time) std::complex<mpf_class> (if --enable-teuchos-complex and --enable-teuchos-gmp where used at configuration time) and is called multiple times from within the following main() program function:
The above example program is built as part of the Thyra package (unless examples where disabled at configure time) and the executable can be found at:
./example/operator_vector/sillyPowerMethod_serial.exe
where ./ is the base build directory for Thyra (e.g. $TRILINOS_BUILD_DIR/packages/thyra).
This example program should run successfully with no arguments and produces the following output:
This example program also takes a number of command-line options. To see what the command-line options are, use the --help option. The command-line options returned from ./sillyPowerMethod_serial.exe --echo-command-line --help are:
To see the full listing of this example program click: sillyPowerMethod_serial.cpp
1.7.4