PDF version (NAG web site
, 64-bit version, 64-bit version)
NAG Toolbox: nag_lapack_dgbequ (f07bf)
Purpose
nag_lapack_dgbequ (f07bf) computes diagonal scaling matrices and intended to equilibrate a real by band matrix of band width , and reduce its condition number.
Syntax
[
r,
c,
rowcnd,
colcnd,
amax,
info] = f07bf(
m,
kl,
ku,
ab, 'n',
n)
[
r,
c,
rowcnd,
colcnd,
amax,
info] = nag_lapack_dgbequ(
m,
kl,
ku,
ab, 'n',
n)
Description
nag_lapack_dgbequ (f07bf) computes the diagonal scaling matrices. The diagonal scaling matrices are chosen to try to make the elements of largest absolute value in each row and column of the matrix
given by
have absolute value
. The diagonal elements of
and
are restricted to lie in the safe range
, where
is the value returned by function
nag_machine_real_safe (x02am). Use of these scaling factors is not guaranteed to reduce the condition number of
but works well in practice.
References
None.
Parameters
Compulsory Input Parameters
- 1:
– int64int32nag_int scalar
-
, the number of rows of the matrix .
Constraint:
.
- 2:
– int64int32nag_int scalar
-
, the number of subdiagonals of the matrix .
Constraint:
.
- 3:
– int64int32nag_int scalar
-
, the number of superdiagonals of the matrix .
Constraint:
.
- 4:
– double array
-
The first dimension of the array
ab must be at least
.
The second dimension of the array
ab must be at least
.
The
by
band matrix
whose scaling factors are to be computed.
The matrix is stored in rows
to
, more precisely, the element
must be stored in
See
Further Comments in
nag_lapack_dgbsv (f07ba) for further details.
Optional Input Parameters
- 1:
– int64int32nag_int scalar
-
Default:
the second dimension of the array
ab.
, the number of columns of the matrix .
Constraint:
.
Output Parameters
- 1:
– double array
-
If
or
,
r contains the row scale factors, the diagonal elements of
. The elements of
r will be positive.
- 2:
– double array
-
If
,
c contains the column scale factors, the diagonal elements of
. The elements of
c will be positive.
- 3:
– double scalar
-
If
or
,
rowcnd contains the ratio of the smallest value of
to the largest value of
. If
and
amax is neither too large nor too small, it is not worth scaling by
.
- 4:
– double scalar
-
If
,
colcnd contains the ratio of the smallest value of
to the largest value of
.
If , it is not worth scaling by .
- 5:
– double scalar
-
. If
amax is very close to overflow or underflow, the matrix
should be scaled.
- 6:
– int64int32nag_int scalar
unless the function detects an error (see
Error Indicators and Warnings).
Error Indicators and Warnings
Cases prefixed with W are classified as warnings and
do not generate an error of type NAG:error_n. See nag_issue_warnings.
-
If , argument had an illegal value. An explanatory message is output, and execution of the program is terminated.
- W
-
Row of is exactly zero.
- W
-
Column of is exactly zero.
Accuracy
The computed scale factors will be close to the exact scale factors.
Further Comments
The complex analogue of this function is
nag_lapack_zgbequ (f07bt).
Example
This example equilibrates the band matrix
given by
Details of the scaling factors, and the scaled matrix are output.
Open in the MATLAB editor:
f07bf_example
function f07bf_example
fprintf('f07bf example results\n\n');
m = int64(4);
kl = int64(1);
ku = int64(2);
a = [-2.30e-01, 2.54e+00, -3.66e-10, 0;
-6.98e+10, 2.46e+10, -2.73e+00 -2.13e+10;
0, 2.56e+00, 2.46e-10, 4.07e+00;
0, 0, -4.78e-10, -3.82e+00];
[~, ab, ifail] = f01zc(...
'p', kl, ku, a, zeros(m, m));
[r, c, rowcnd, colcnd, amax, info] = ...
f07bf(m, kl, ku, ab);
format shorte;
fprintf('\nrowcnd = %8.1e colcnd = %8.1e amax = %8.1e\n\n', ...
rowcnd, colcnd, amax);
fprintf('Row scale factors:\n');
disp(r');
fprintf('Column scale factors:\n');
disp(c');
small = x02am/(x02aj*double(x02bh));
big = 1/small;
thresh = 0.1;
if (rowcnd >= thresh) && (amax >= small) && (amax <= big)
if colcnd<thresh
as = a*diag(c);
end
elseif colcnd>=thresh
as = diag(r)*a;
else
as = diag(r)*a*diag(c);
end
format short;
fprintf('\nScaled Matrix:\n');
disp(as);
f07bf example results
rowcnd = 3.6e-11 colcnd = 1.4e-10 amax = 7.0e+10
Row scale factors:
3.9370e-01 1.4327e-11 2.4570e-01 2.6178e-01
Column scale factors:
1.0000e+00 1.0000e+00 6.9399e+09 1.0000e+00
Scaled Matrix:
-0.0906 1.0000 -1.0000 0
-1.0000 0.3524 -0.2714 -0.3052
0 0.6290 0.4195 1.0000
0 0 -0.8684 -1.0000
PDF version (NAG web site
, 64-bit version, 64-bit version)
© The Numerical Algorithms Group Ltd, Oxford, UK. 2009–2015