The routine may be called by the names f05aaf or nagf_orthog_real_gram_schmidt.
f05aaf applies the Schmidt orthogonalization process to linearly independent vectors in -dimensional space, . The effect of this process is to replace the original vectors by orthonormal vectors which have the property that the th vector is linearly dependent on the first of the original vectors, and that the sum of squares of the elements of the th vector is equal to , for . Inner-products are accumulated using additional precision.
1: – Real (Kind=nag_wp) arrayInput/Output
On entry: columns n1 to n2 contain the vectors to be orthogonalized. The vectors are stored by columns in elements to .
On exit: these vectors are overwritten by the orthonormal vectors.
2: – IntegerInput
On entry: the first dimension of the array a as declared in the (sub)program from which f05aaf is called.
3: – IntegerInput
On entry: , the number of elements in each vector.
4: – IntegerInput
5: – IntegerInput
On entry: the indices of the first and last columns of to be orthogonalized.
6: – Real (Kind=nag_wp) arrayWorkspace
7: – Real (Kind=nag_wp)Output
On exit: is used to indicate linear dependence of the original vectors. The nearer cc is to , the more likely vector icol is dependent on vectors n1 to . See Section 9.
8: – IntegerOutput
On exit: the column number corresponding to cc. See Section 9.
9: – IntegerInput/Output
On entry: ifail must be set to , or to set behaviour on detection of an error; these values have no effect when no error is detected.
A value of causes the printing of an error message and program execution will be halted; otherwise program execution continues. A value of means that an error message is printed while a value of means that it is not.
If halting is not appropriate, the value or is recommended. If message printing is undesirable, then the value is recommended. Otherwise, the value is recommended. When the value or is used it is essential to test the value of ifail on exit.
On exit: unless the routine detects an error or a warning has been flagged (see Section 6).
6Error Indicators and Warnings
If on entry or , explanatory error messages are output on the current error message unit (as defined by x04aaf).
Errors or warnings detected by the routine:
On entry, , .
On entry, and .
An unexpected error has been triggered by this routine. Please
See Section 7 in the Introduction to the NAG Library FL Interface for further information.
Your licence key may have expired or may not have been installed correctly.
See Section 8 in the Introduction to the NAG Library FL Interface for further information.
Dynamic memory allocation failed.
See Section 9 in the Introduction to the NAG Library FL Interface for further information.
Innerproducts are accumulated using additional precision arithmetic and full machine accuracy should be obtained except when . (See Section 9.)
8Parallelism and Performance
Background information to multithreading can be found in the Multithreading documentation.
f05aaf is threaded by NAG for parallel execution in multithreaded implementations of the NAG Library.
Please consult the X06 Chapter Introduction for information on how to control and interrogate the OpenMP environment used within this routine. Please also consult the Users' Note for your implementation for any additional implementation-specific information.
The time taken by f05aaf is approximately proportional to , where .
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 routine. cc will be in the range and the closer cc is to , the more likely the vector icol is to be linearly dependent on vectors n1 to . Theoretically, when the vectors are linearly dependent, cc should be exactly . In practice, because of rounding errors, it may be difficult to decide whether or not a value of cc close to indicates linear dependence. As a general guide a value of usually indicates linear dependence, but examples exist which give 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 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 routine f08kbf.
This example orthonormalizes columns 2, 3 and 4 of the matrix: