PDF version (NAG web site
, 64-bit version, 64-bit version)
NAG Toolbox: nag_linsys_real_posdef_solve_1rhs (f04as)
Purpose
nag_linsys_real_posdef_solve_1rhs (f04as) calculates the accurate solution of a set of real symmetric positive definite linear equations with a single right-hand side, , using a Cholesky factorization and iterative refinement.
Syntax
[
a,
c,
ifail] = nag_linsys_real_posdef_solve_1rhs(
a,
b, 'n',
n)
Description
Given a set of real linear equations , where is a symmetric positive definite matrix, nag_linsys_real_posdef_solve_1rhs (f04as) first computes a Cholesky factorization of as where is lower triangular. An approximation to is found by forward and backward substitution. The residual vector is then calculated using additional precision and a correction to is found by solving . is then replaced by , and this iterative refinement of the solution is repeated until machine accuracy is obtained.
References
Wilkinson J H and Reinsch C (1971) Handbook for Automatic Computation II, Linear Algebra Springer–Verlag
Parameters
Compulsory Input Parameters
- 1:
– double array
-
The first dimension of the array
a must be at least
.
The second dimension of the array
a must be at least
.
The upper triangle of the by positive definite symmetric matrix . The elements of the array below the diagonal need not be set.
- 2:
– double array
-
The dimension of the array
b
must be at least
The right-hand side vector .
Optional Input Parameters
- 1:
– int64int32nag_int scalar
-
Default:
the first dimension of the array
a and the second dimension of the arrays
a,
b.
, the order of the matrix .
Constraint:
.
Output Parameters
- 1:
– double array
-
The first dimension of the array
a will be
.
The second dimension of the array
a will be
.
The elements of the array below the diagonal are overwritten; the upper triangle of is unchanged.
- 2:
– double array
-
The solution vector .
- 3:
– int64int32nag_int scalar
unless the function detects an error (see
Error Indicators and Warnings).
Error Indicators and Warnings
Errors or warnings detected by the function:
-
-
The matrix is not positive definite, possibly due to rounding errors.
-
-
Iterative refinement fails to improve the solution, i.e., the matrix is too ill-conditioned.
-
-
On entry, | , |
or | . |
-
An unexpected error has been triggered by this routine. Please
contact
NAG.
-
Your licence key may have expired or may not have been installed correctly.
-
Dynamic memory allocation failed.
Accuracy
The computed solutions should be correct to full machine accuracy. For a detailed error analysis see page 39 of
Wilkinson and Reinsch (1971).
Further Comments
The time taken by nag_linsys_real_posdef_solve_1rhs (f04as) is approximately proportional to .
The function
must not be called with the same name for arguments
b and
c.
Example
This example solves the set of linear equations
where
Open in the MATLAB editor:
f04as_example
function f04as_example
fprintf('f04as example results\n\n');
a = [5, 7, 6, 5;
7, 10, 8, 7;
6, 8, 10, 9;
5, 7, 9, 10];
b = [23;
32;
33;
31];
[afac, x, ifail] = f04as(a, b);
disp('Solution');
disp(x);
f04as example results
Solution
1
1
1
1
PDF version (NAG web site
, 64-bit version, 64-bit version)
© The Numerical Algorithms Group Ltd, Oxford, UK. 2009–2015