diff --git a/Documentation/Examples/Solvers/Linear/IterativeLinearSolverExample.cpp b/Documentation/Examples/Solvers/Linear/IterativeLinearSolverExample.cpp index 229aab3690fcebec99eac681a87a01a101e2d367..fe4d42b14777b6c32530a93a1f8d4fc7e70751be 100644 --- a/Documentation/Examples/Solvers/Linear/IterativeLinearSolverExample.cpp +++ b/Documentation/Examples/Solvers/Linear/IterativeLinearSolverExample.cpp @@ -4,7 +4,7 @@ #include <TNL/Matrices/SparseMatrix.h> #include <TNL/Devices/Host.h> #include <TNL/Devices/Cuda.h> -#include <TNL/Solvers/Linear/GMRES.h> +#include <TNL/Solvers/Linear/TFQMR.h> template< typename Device > void iterativeLinearSolverExample() @@ -63,7 +63,7 @@ void iterativeLinearSolverExample() /*** * Solve the linear system */ - using LinearSolver = TNL::Solvers::Linear::GMRES< MatrixType >; + using LinearSolver = TNL::Solvers::Linear::TFQMR< MatrixType >; LinearSolver solver; solver.setMatrix( matrix_ptr ); solver.solve( b, x ); @@ -73,7 +73,7 @@ void iterativeLinearSolverExample() int main( int argc, char* argv[] ) { std::cout << "Solving linear system on host: " << std::endl; - iterativeLinearSolverExample< TNL::Devices::Host >(); + iterativeLinearSolverExample< TNL::Devices::Sequential >(); #ifdef HAVE_CUDA std::cout << "Solving linear system on CUDA device: " << std::endl; diff --git a/Documentation/Examples/Solvers/Linear/IterativeLinearSolverWithMonitorExample.cpp b/Documentation/Examples/Solvers/Linear/IterativeLinearSolverWithMonitorExample.cpp index ac3a8f83e46f5b381d08298f87711048bff7084a..a37da76bb31f4e55d4ff37d04f240a6691c5eb9e 100644 --- a/Documentation/Examples/Solvers/Linear/IterativeLinearSolverWithMonitorExample.cpp +++ b/Documentation/Examples/Solvers/Linear/IterativeLinearSolverWithMonitorExample.cpp @@ -4,7 +4,7 @@ #include <thread> #include <TNL/Algorithms/ParallelFor.h> #include <TNL/Matrices/SparseMatrix.h> -#include <TNL/Devices/Host.h> +#include <TNL/Devices/Sequential.h> #include <TNL/Devices/Cuda.h> #include <TNL/Solvers/Linear/Jacobi.h> @@ -14,11 +14,11 @@ void iterativeLinearSolverExample() /*** * Set the following matrix (dots represent zero matrix elements): * - * / 2 -1 . . . \ - * | -1 2 -1 . . | - * | . -1 2 -1. . | - * | . . -1 2 -1 | - * \ . . . -1 2 / + * / 2.5 -1 . . . \ + * | -1 2.5 -1 . . | + * | . -1 2.5 -1. . | + * | . . -1 2.5 -1 | + * \ . . . -1 2.5 / */ using MatrixType = TNL::Matrices::SparseMatrix< double, Device >; using Vector = TNL::Containers::Vector< double, Device >; @@ -68,23 +68,18 @@ void iterativeLinearSolverExample() using LinearSolver = TNL::Solvers::Linear::Jacobi< MatrixType >; LinearSolver solver; solver.setMatrix( matrix_ptr ); - + solver.setOmega( 0.0005 ); /*** * Setup monitor of the iterative solver */ using IterativeSolverMonitorType = TNL::Solvers::IterativeSolverMonitor< double, int >; IterativeSolverMonitorType monitor; - TNL::Solvers::SolverMonitorThread t(monitor); - monitor.setRefreshRate(100); // refresh rate = timeout in milliseconds + TNL::Solvers::SolverMonitorThread monitorThread(monitor); + monitor.setRefreshRate(10); // refresh rate in milliseconds monitor.setVerbose(1); monitor.setStage( "Jacobi stage:" ); - TNL::Timer timer; - monitor.setTimer( timer ); solver.setSolverMonitor(monitor); - solver.setOmega( 0.001 ); - //std::this_thread::sleep_for(std::chrono::milliseconds(3000)); // wait for 3 seconds to let the monitor doing something - timer.start(); solver.solve( b, x ); monitor.stopMainLoop(); std::cout << "Vector x = " << x << std::endl;