naginterfaces.library.lapacklin.dsposv¶
- naginterfaces.library.lapacklin.dsposv(uplo, n, nrhs, a, b)[source]¶
dsposv
uses the Cholesky factorizationto compute the solution to a real system of linear equations
where is an symmetric positive definite matrix and and are matrices.
For full information please refer to the NAG Library document for f07fc
https://www.nag.com/numeric/nl/nagdoc_29.2/flhtml/f07/f07fcf.html
- Parameters
- uplostr, length 1
Specifies whether the upper or lower triangular part of is stored.
The upper triangular part of is stored.
The lower triangular part of is stored.
- nint
, the number of linear equations, i.e., the order of the matrix .
- nrhsint
, the number of right-hand sides, i.e., the number of columns of the matrix .
- afloat, array-like, shape
The symmetric positive definite matrix .
- bfloat, array-like, shape
The right-hand side matrix .
- Returns
- afloat, ndarray, shape
If iterative refinement has been successfully used (no exception or warning is raised and , see ), then is unchanged. If full precision factorization has been used (no exception or warning is raised and , see ), then the array contains the factor or from the Cholesky factorization or .
- xfloat, ndarray, shape
If no exception or warning is raised, the solution matrix .
- iteraint
Information on the progress of the interative refinement process.
Iterative refinement has failed for one of the reasons given below, full precision factorization has been performed instead.
The function fell back to full precision for implementation - or machine-specific reasons.
Narrowing the precision induced an overflow, the function fell back to full precision.
An intermediate reduced precision factorization failed.
The maximum permitted number of iterations was exceeded.
Iterative refinement has been sucessfully used. returns the number of iterations.
- Raises
- NagValueError
- (errno )
On entry, error in parameter .
Constraint: or .
- (errno )
On entry, error in parameter .
Constraint: .
- (errno )
On entry, error in parameter .
Constraint: .
- (errno )
The leading minor of order of is not positive definite, so the factorization could not be completed, and the solution has not been computed.
- Notes
No equivalent traditional C interface for this routine exists in the NAG Library.
dsposv
first attempts to factorize the matrix in reduced precision and use this factorization within an iterative refinement procedure to produce a solution with full precision normwise backward error quality (see below). If the approach fails the method switches to a full precision factorization and solve.The iterative refinement can be more efficient than the corresponding direct full precision algorithm. Since the strategy implemented by
dsposv
must perform iterative refinement on each right-hand side, any efficiency gains will reduce as the number of right-hand sides increases. Conversely, as the matrix size increases the cost of these iterative refinements become less significant relative to the cost of factorization. Thus, any efficiency gains will be greatest for a very small number of right-hand sides and for large matrix sizes. The cut-off values for the number of right-hand sides and matrix size, for which the iterative refinement strategy performs better, depends on the relative performance of the reduced and full precision factorization and back-substitution.dsposv
always attempts the iterative refinement strategy first; you are advised to compare the performance ofdsposv
with that of its full precision counterpartdposv()
to determine whether this strategy is worthwhile for your particular problem dimensions.The iterative refinement process is stopped if where is the number of iterations carried out thus far. The process is also stopped if for all right-hand sides we have
where is the -norm of the residual, is the -norm of the solution, is the -norm of the matrix and is the machine precision returned by
machine.precision
.
- References
Anderson, E, Bai, Z, Bischof, C, Blackford, S, Demmel, J, Dongarra, J J, Du Croz, J J, Greenbaum, A, Hammarling, S, McKenney, A and Sorensen, D, 1999, LAPACK Users’ Guide, (3rd Edition), SIAM, Philadelphia, https://www.netlib.org/lapack/lug
Golub, G H and Van Loan, C F, 1996, Matrix Computations, (3rd Edition), Johns Hopkins University Press, Baltimore
Higham, N J, 2002, Accuracy and Stability of Numerical Algorithms, (2nd Edition), SIAM, Philadelphia