hide long namesshow long names
hide short namesshow short names
Integer type:  int32  int64  nag_int  show int32  show int32  show int64  show int64  show nag_int  show nag_int

PDF version (NAG web site, 64-bit version, 64-bit version)
Chapter Contents
Chapter Introduction
NAG Toolbox

NAG Toolbox: nag_orthog_real_gram_schmidt (f05aa)

Purpose

nag_orthog_real_gram_schmidt (f05aa) applies the Schmidt orthogonalization process to nn vectors in mm-dimensional space, nmnm.

Syntax

[a, cc, icol, ifail] = f05aa(a, n1, 'm', m, 'n2', n2)
[a, cc, icol, ifail] = nag_orthog_real_gram_schmidt(a, n1, 'm', m, 'n2', n2)
Note: the interface to this routine has changed since earlier releases of the toolbox:
Mark 22: m has been made optional
.

Description

nag_orthog_real_gram_schmidt (f05aa) applies the Schmidt orthogonalization process to nn linearly independent vectors in mm-dimensional space, nmnm. The effect of this process is to replace the original nn vectors by nn orthonormal vectors which have the property that the rrth vector is linearly dependent on the first rr of the original vectors, and that the sum of squares of the elements of the rrth vector is equal to 11, for r = 1,2,,nr=1,2,,n. Inner-products are accumulated using additional precision.

References

None.

Parameters

Compulsory Input Parameters

1:     a(lda,n2) – double array
lda, the first dimension of the array, must satisfy the constraint ldamldam.
Columns n1 to n2 contain the vectors to be orthogonalized. The vectors are stored by columns in elements 11 to mm.
2:     n1 – int64int32nag_int scalar
The indices of the first and last columns of AA to be orthogonalized.
Constraint: n1n2n1n2.

Optional Input Parameters

1:     m – int64int32nag_int scalar
Default: The first dimension of the array a.
mm, the number of elements in each vector.
2:     n2 – int64int32nag_int scalar
Default: For n2, the second dimension of the array a.
The indices of the first and last columns of AA to be orthogonalized.
Constraint: n1n2n1n2.

Input Parameters Omitted from the MATLAB Interface

lda s

Output Parameters

1:     a(lda,n2) – double array
ldamldam.
These vectors store the orthonormal vectors.
2:     cc – double scalar
Is used to indicate linear dependence of the original vectors. The nearer cc is to 1.01.0, the more likely vector icol is dependent on vectors n1 to icol1icol-1. See Section [Further Comments].
3:     icol – int64int32nag_int scalar
The column number corresponding to cc. See Section [Further Comments].
4:     ifail – int64int32nag_int scalar
ifail = 0ifail=0 unless the function detects an error (see [Error Indicators and Warnings]).

Error Indicators and Warnings

Errors or warnings detected by the function:
  ifail = 1ifail=1
On entry,n1 > n2n1>n2.

Accuracy

Innerproducts are accumulated using additional precision arithmetic and full machine accuracy should be obtained except when cc > 0.99999cc>0.99999. (See Section [Further Comments].)

Further Comments

The time taken by nag_orthog_real_gram_schmidt (f05aa) is approximately proportional to nm2nm2, where n = n2n1 + 1n=n2-n1+1.
Parameters 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 [0.0,1.0][0.0,1.0] and the closer cc is to 1.01.0, the more likely the vector icol is to be linearly dependent on vectors n1 to icol1icol-1. Theoretically, when the vectors are linearly dependent, cc should be exactly 1.01.0. In practice, because of rounding errors, it may be difficult to decide whether or not a value of cc close to 1.01.0 indicates linear dependence. As a general guide a value of cc > 0.99999cc>0.99999 usually indicates linear dependence, but examples exist which give cc > 0.99999cc>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.01.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).

Example

function nag_orthog_real_gram_schmidt_example
a = [1, -2, 3, 1;
     -2, 1, -2, -1;
     3, -2, 1, 5;
     4, 1, 5, 3];
n1 = int64(2);
[aOut, cc, icol, ifail] = nag_orthog_real_gram_schmidt(a, n1)
 

aOut =

    1.0000   -0.6325    0.3310   -0.5404
   -2.0000    0.3162   -0.2483    0.2119
    3.0000   -0.6325   -0.0000    0.7735
    4.0000    0.3162    0.9104    0.2543


cc =

    0.5822


icol =

                    4


ifail =

                    0


function f05aa_example
a = [1, -2, 3, 1;
     -2, 1, -2, -1;
     3, -2, 1, 5;
     4, 1, 5, 3];
n1 = int64(2);
[aOut, cc, icol, ifail] = f05aa(a, n1)
 

aOut =

    1.0000   -0.6325    0.3310   -0.5404
   -2.0000    0.3162   -0.2483    0.2119
    3.0000   -0.6325   -0.0000    0.7735
    4.0000    0.3162    0.9104    0.2543


cc =

    0.5822


icol =

                    4


ifail =

                    0



PDF version (NAG web site, 64-bit version, 64-bit version)
Chapter Contents
Chapter Introduction
NAG Toolbox

© The Numerical Algorithms Group Ltd, Oxford, UK. 2009–2013