pub struct IrsInfos { /* private fields */ }Implementations§
Source§impl IrsInfos
impl IrsInfos
Sourcepub fn create() -> Result<Self>
pub fn create() -> Result<Self>
Creates and initializes the Infos structure that holds refinement information for an Iterative Refinement Solver (IRS) call.
Such information includes the total number of iterations needed to converge (Niters), the number of outer iterations (meaningful when a two-level preconditioner such as IrsRefinement::ClassicalGmres is used), the maximum number of iterations allowed for that call, and a pointer to the convergence-history residual norm matrix.
Construct the Infos structure before calling an IRS solver.
The Infos structure is valid for only one call to an IRS solver, since it holds information about that solve; each solve requires its own Infos structure.
§Errors
Returns an error if cuSOLVER cannot allocate the required resources or does not return a valid handle.
Sourcepub fn niters(&self) -> Result<i32>
pub fn niters(&self) -> Result<i32>
Returns the total number of iterations performed by the IRS solver.
If this value is negative, the IRS solver did not converge. If fallback to full precision was enabled, the solver fell back to a full-precision solution.
See xgesv and xgels for the meaning of negative niters values.
§Errors
Returns an error if cuSOLVER rejects the Infos structure.
Sourcepub fn outer_niters(&self) -> Result<i32>
pub fn outer_niters(&self) -> Result<i32>
Returns the number of iterations performed by the outer refinement loop of the IRS solver.
For one-level solvers such as IrsRefinement::Classical or IrsRefinement::Gmres, this is the same as Niters.
For two-level solvers such as IrsRefinement::ClassicalGmres or IrsRefinement::GmresGmres, this is the number of outer-loop iterations.
See IrsRefinement for refinement mode details.
§Errors
Returns an error if cuSOLVER rejects the Infos structure.
Sourcepub fn max_iterations(&self) -> Result<i32>
pub fn max_iterations(&self) -> Result<i32>
Returns the maximum number of iterations allowed for the corresponding IRS solver call.
Setting used when that call happened, distinct from IrsParams::max_iterations, which returns the current setting in the params configuration structure.
The params structure can be reused for many IRS solver calls.
The allowed MaxIters value can change between calls, while this Infos structure contains information about one particular call and cannot be reused for different calls.
§Errors
Returns an error if cuSOLVER rejects the Infos structure.
Sourcepub fn request_residual_history(&mut self) -> Result<()>
pub fn request_residual_history(&mut self) -> Result<()>
Asks the IRS solver to store the convergence history
(residual norms) of the refinement phase so it can later be queried with
IrsInfos::residual_history_f32 or IrsInfos::residual_history_f64.
§Errors
Returns an error if cuSOLVER rejects the Infos structure.
Sourcepub fn residual_history_f32(&self) -> Result<ResidualHistory<f32>>
pub fn residual_history_f32(&self) -> Result<ResidualHistory<f32>>
Returns the convergence history stored by the IRS solver when IrsInfos::request_residual_history was called before solving.
The residual norm type depends on the input and output precision.
Double-precision real and complex configurations report f64 residuals, while single-precision real and complex configurations report f32 residuals.
The residual history matrix has two columns, even for multiple right-hand sides, and MaxIters + 1 rows.
Only the first OuterNiters + 1 rows contain residual norms; the remaining rows are undefined.
In the first column, each row i contains the total number of iterations performed up to outer iteration i.
In the second column, each row contains the residual norm for that outer iteration.
Row 0 contains the initial residual before the refinement loop starts, and subsequent rows contain residuals obtained at each outer iteration.
The history only covers the outer loop.
If the refinement solver was IrsRefinement::Classical or IrsRefinement::Gmres, then OuterNiters == Niters, and there are Niters + 1 rows of norms corresponding to the Niters outer iterations.
If the refinement solver was IrsRefinement::ClassicalGmres or IrsRefinement::GmresGmres, then OuterNiters <= Niters corresponds to the outer iterations performed by the outer refinement loop.
There are OuterNiters + 1 residual norms. Row i corresponds to outer iteration i; the first column contains the total number of outer and inner iterations performed up to that step, and the second column contains the residual norm at that step.
For example, if IrsRefinement::ClassicalGmres needs 3 outer iterations to converge and 4, 3, and 3 inner iterations at each outer iteration, it performs 10 total iterations.
Row 0 corresponds to the first residual before the refinement start, so it has 0 in its first column.
Row 1 corresponds to outer iteration 1 and contains 4 in its first column, row 2 contains 7, and row 3 contains 10.
In summary, let ldh = MaxIters + 1, the leading dimension of the residual matrix. Then residual_history[i] contains the total number of iterations performed at outer iteration i, and residual_history[i + ldh] contains the residual norm at that outer iteration.
§Errors
Returns an error if residual history was not requested before solving,
or if cuSOLVER rejects the Infos structure.
Sourcepub fn residual_history_f64(&self) -> Result<ResidualHistory<f64>>
pub fn residual_history_f64(&self) -> Result<ResidualHistory<f64>>
Returns the convergence history stored by the IRS solver when IrsInfos::request_residual_history was called before solving.
The residual norm type depends on the input and output precision.
Double-precision real and complex configurations report f64 residuals, while single-precision real and complex configurations report f32 residuals.
The residual history matrix has two columns, even for multiple right-hand sides, and MaxIters + 1 rows.
Only the first OuterNiters + 1 rows contain residual norms; the remaining rows are undefined.
In the first column, each row i contains the total number of iterations performed up to outer iteration i.
In the second column, each row contains the residual norm for that outer iteration.
Row 0 contains the initial residual before the refinement loop starts, and subsequent rows contain residuals obtained at each outer iteration.
The history only covers the outer loop.
If the refinement solver was IrsRefinement::Classical or IrsRefinement::Gmres, then OuterNiters == Niters, and there are Niters + 1 rows of norms corresponding to the Niters outer iterations.
If the refinement solver was IrsRefinement::ClassicalGmres or IrsRefinement::GmresGmres, then OuterNiters <= Niters corresponds to the outer iterations performed by the outer refinement loop.
There are OuterNiters + 1 residual norms. Row i corresponds to outer iteration i; the first column contains the total number of outer and inner iterations performed up to that step, and the second column contains the residual norm at that step.
For example, if IrsRefinement::ClassicalGmres needs 3 outer iterations to converge and 4, 3, and 3 inner iterations at each outer iteration, it performs 10 total iterations.
Row 0 corresponds to the first residual before the refinement start, so it has 0 in its first column.
Row 1 corresponds to outer iteration 1 and contains 4 in its first column, row 2 contains 7, and row 3 contains 10.
In summary, let ldh = MaxIters + 1, the leading dimension of the residual matrix. Then residual_history[i] contains the total number of iterations performed at outer iteration i, and residual_history[i + ldh] contains the residual norm at that outer iteration.
§Errors
Returns an error if residual history was not requested before solving,
or if cuSOLVER rejects the Infos structure.