CALL GSORTH
(P, T, lindep, A) ;
The GSORTH subroutine computes the Gram-Schmidt orthonormal factorization of the matrix
, where
is greater than or equal to
. The GSORTH subroutine implements an algorithm described by Golub (1969).
The GSORTH subroutine has a single input argument:
is an input matrix.
The output arguments to the GSORTH subroutine are as follows:
is an column-orthonormal output matrix.
is an upper triangular output matrix.
is a flag with a value of 0 if columns of A are independent and a value of 1 if they are dependent. The lindep argument is an output scalar.
Specifically, the GSORTH subroutine computes the column-orthonormal matrix
and the upper triangular
matrix
such that
![]() |
If the columns of are linearly independent (that is, rank
), then
is full-rank column-orthonormal:
,
is nonsingular, and the value of lindep (a scalar) is set to 0. If the columns of
are linearly dependent (say, rank
) then
columns of
are set to 0, the corresponding rows of
are set to 0 (
is singular), and lindep is set to 1. The pattern of zero columns in
corresponds to the pattern of linear dependencies of the columns of
when columns are considered in left-to-right order.
The following statements call the GSORTH subroutine and print the output parameters to the call:
x = {1 1 3 1 2, 1 0 1 2 3, 1 1 3 3 4, 1 0 1 4 5, 1 1 3 5 6, 1 0 1 6 7}; call gsorth(P, T, lindep, x); reset fuzz; print P, T, lindep;
Figure 23.133: Results of a Gram-Schmidt Orthonormalization
P | ||||
---|---|---|---|---|
0.4082483 | 0.4082483 | 0 | -0.5 | 0 |
0.4082483 | -0.408248 | 0 | -0.5 | 0 |
0.4082483 | 0.4082483 | 0 | 0 | 0 |
0.4082483 | -0.408248 | 0 | 0 | 0 |
0.4082483 | 0.4082483 | 0 | 0.5 | 0 |
0.4082483 | -0.408248 | 0 | 0.5 | 0 |
T | ||||
---|---|---|---|---|
2.4494897 | 1.2247449 | 4.8989795 | 8.5732141 | 11.022704 |
0 | 1.2247449 | 2.4494897 | -1.224745 | -1.224745 |
0 | 0 | 0 | 0 | 0 |
0 | 0 | 0 | 4 | 4 |
0 | 0 | 0 | 0 | 0 |
lindep |
---|
1 |
If lindep is 1, you can permute the columns of and rows of
so that the zero columns of
are rightmost—that is,
, where
is the column rank of
and the equality
is preserved. The following statements show a permutation of columns:
d = loc(vecdiag(T)^=0) || loc(vecdiag(T)=0); temp = P; P[,d] = temp; temp = T; T[,d] = temp; print d, P, T;
Figure 23.134: Rearranging Columns
d | ||||
---|---|---|---|---|
1 | 2 | 4 | 3 | 5 |
P | ||||
---|---|---|---|---|
0.4082483 | 0.4082483 | -0.5 | 0 | 0 |
0.4082483 | -0.408248 | -0.5 | 0 | 0 |
0.4082483 | 0.4082483 | 0 | 0 | 0 |
0.4082483 | -0.408248 | 0 | 0 | 0 |
0.4082483 | 0.4082483 | 0.5 | 0 | 0 |
0.4082483 | -0.408248 | 0.5 | 0 | 0 |
T | ||||
---|---|---|---|---|
2.4494897 | 1.2247449 | 8.5732141 | 4.8989795 | 11.022704 |
0 | 1.2247449 | -1.224745 | 2.4494897 | -1.224745 |
0 | 0 | 0 | 0 | 0 |
0 | 0 | 4 | 0 | 4 |
0 | 0 | 0 | 0 | 0 |
The GSORTH subroutine is not recommended for the construction of matrices of values of orthogonal polynomials; the ORPOL function should be used for that purpose.