PDF version (NAG web site
, 64-bit version, 64-bit version)
NAG Toolbox: nag_linsys_real_square_solve_ref (f04ae)
Purpose
nag_linsys_real_square_solve_ref (f04ae) calculates the accurate solution of a set of real linear equations with multiple right-hand sides using an factorization with partial pivoting, and iterative refinement.
Syntax
[
c,
aa,
bb,
ifail] = nag_linsys_real_square_solve_ref(
a,
b, 'n',
n, 'm',
m)
Description
Given a set of real linear equations , the function first computes an factorization of with partial pivoting, , where is a permutation matrix, is lower triangular and is unit upper triangular. An approximation to is found by forward and backward substitution. The residual matrix is then calculated using additional precision, and a correction to is found by solving . is replaced by and this iterative refinement of the solution is repeated until full machine accuracy has been 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 by matrix .
- 2:
– double array
-
The first dimension of the array
b must be at least
.
The second dimension of the array
b must be at least
.
The by right-hand side matrix .
Optional Input Parameters
- 1:
– int64int32nag_int scalar
-
Default:
the first dimension of the arrays
a,
b and the second dimension of the array
a.
, the order of the matrix .
Constraint:
.
- 2:
– int64int32nag_int scalar
-
Default:
the second dimension of the array
b.
, the number of right-hand sides.
Constraint:
.
Output Parameters
- 1:
– double array
-
The first dimension of the array
c will be
.
The second dimension of the array
c will be
.
The by solution matrix .
- 2:
– double array
-
The first dimension of the array
aa will be
.
The second dimension of the array
aa will be
.
The triangular factors and , except that the unit diagonal elements of are not stored.
- 3:
– double array
-
The first dimension of the array
bb will be
.
The second dimension of the array
bb will be
.
The final by residual matrix .
- 4:
– 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 singular, possibly due to rounding errors.
-
-
Iterative refinement fails to improve the solution, i.e., the matrix is too ill-conditioned.
-
-
On entry, | , |
or | , |
or | , |
or | , |
or | , |
or | , |
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 107 of
Wilkinson and Reinsch (1971).
Further Comments
The time taken by nag_linsys_real_square_solve_ref (f04ae) is approximately proportional to .
If there is only one right-hand side, it is simpler to use
nag_linsys_real_square_solve_1rhs (f04at).
Example
This example solves the set of linear equations
where
Open in the MATLAB editor:
f04ae_example
function f04ae_example
fprintf('f04ae example results\n\n');
a = [ 33, 16, 72;
-24, -10, -57;
-8, -4, -17];
b = [-359; 281; 85];
[x, LU, resid, ifail] = f04ae(a, b);
disp('Solution');
disp(x);
f04ae example results
Solution
1
-2
-5
PDF version (NAG web site
, 64-bit version, 64-bit version)
© The Numerical Algorithms Group Ltd, Oxford, UK. 2009–2015