diff --git a/Documentation/Examples/Solvers/Linear/IterativeLinearSolverWithPreconditionerExample.cpp b/Documentation/Examples/Solvers/Linear/IterativeLinearSolverWithPreconditionerExample.cpp index 3a2141074403af91ec96a9f1f019114aa9adb4ea..035dbb6ce2fb8014166c4f201c031f278d5dda56 100644 --- a/Documentation/Examples/Solvers/Linear/IterativeLinearSolverWithPreconditionerExample.cpp +++ b/Documentation/Examples/Solvers/Linear/IterativeLinearSolverWithPreconditionerExample.cpp @@ -66,7 +66,7 @@ void iterativeLinearSolverExample() */ using LinearSolver = TNL::Solvers::Linear::TFQMR< MatrixType >; using Preconditioner = TNL::Solvers::Linear::Preconditioners::Diagonal< MatrixType >; - auto preconditioner_ptr = std::make_shared< Preconditioner >; + auto preconditioner_ptr = std::make_shared< Preconditioner >(); preconditioner_ptr->update( matrix_ptr ); LinearSolver solver; solver.setMatrix( matrix_ptr ); diff --git a/Documentation/Tutorials/Solvers/Linear/tutorial_Linear_solvers.md b/Documentation/Tutorials/Solvers/Linear/tutorial_Linear_solvers.md index 25e709ae663608d381f75575d48f7211cccbeec9..4832f4f12ef4debde2ec181b36cb5235459c86ee 100644 --- a/Documentation/Tutorials/Solvers/Linear/tutorial_Linear_solvers.md +++ b/Documentation/Tutorials/Solvers/Linear/tutorial_Linear_solvers.md @@ -85,7 +85,7 @@ Preconditioners of iterative solvers can significantly improve the performance o \includelineno Solvers/Linear/IterativeLinearSolverWithPreconditionerExample.cpp -In this example, we solve the same problem as in all other examples in this section. The only differences concerning the preconditioner happen on the lines (68-72). Similar to the matrix of the linear system, the preconditioner is passed to the solver by the means of smart shared pointer (\ref std::shared_ptr). The instance is created on the lines 68 and 69. Next we just need to connect the solver with the preconditioner (line 72, \ref TNL::Solvers::Linear::LinearSolver). +In this example, we solve the same problem as in all other examples in this section. The only differences concerning the preconditioner happen on the lines (68-72). Similar to the matrix of the linear system, the preconditioner is passed to the solver by the means of smart shared pointer (\ref std::shared_ptr). The instance is created on the lines 68 and 69. Next we have to initialize the preconditioner (line 70, \ref TNL::Solvers::Linear::Preconditioners::Preconditioner::update). The method `update` has to be called everytime the matrix of the linear system changes. This is important for example when solving time dependent PDEs but it does not happen in this example. Finally, we need to connect the solver with the preconditioner (line 73, \ref TNL::Solvers::Linear::LinearSolver). The result looks as follows: