Note: the interface to this routine has changed since earlier releases of the toolbox:
At Mark 22: |
m was made optional |
None.
Innerproducts are accumulated using
additional precision arithmetic and full machine accuracy should be obtained except when
${\mathbf{cc}}>0.99999$. (See
Further Comments.)
Arguments
cc and
icol have been included to give some indication of whether or not the vectors are nearly linearly independent, and their values should always be tested on exit from the function.
cc will be in the range
$\left[0.0,1.0\right]$ and the closer
cc is to
$1.0$, the more likely the vector
icol is to be linearly dependent on vectors
n1 to
${\mathbf{icol}}-1$. Theoretically, when the vectors are linearly dependent,
cc should be exactly
$1.0$. In practice, because of rounding errors, it may be difficult to decide whether or not a value of
cc close to
$1.0$ indicates linear dependence. As a general guide a value of
${\mathbf{cc}}>0.99999$ usually indicates linear dependence, but examples exist which give
${\mathbf{cc}}>0.99999$ for linearly independent vectors. If one of the original vectors is zero or if, possibly due to rounding errors, an exactly zero vector is produced by the Gram–Schmidt process, then
cc is set exactly to
$1.0$ and the vector is not, of course, normalized. If more than one such vector occurs then
icol references the last of these vectors.
If you are concerned about testing for near linear dependence in a set of vectors you may wish to consider using function
nag_lapack_dgesvd (f08kb).
This example orthonormalizes columns 2, 3 and 4 of the matrix:
function f05aa_example
fprintf('f05aa example results\n\n');
a = [ 1, -2, 3, 1;
-2, 1, -2, -1;
3, -2, 1, 5;
4, 1, 5, 3];
n1 = int64(2);
[a, cc, icol, ifail] = f05aa(a, n1);
fprintf('Linear dependence measure for column %1d = %6.4f\n', icol, cc);
fprintf('\nFinal orthonormalized columns\n');
disp(a(:,n1:end));