Language Reference

GSORTH Call

computes the Gram-Schmidt orthonormalization

CALL GSORTH( p, t, lindep, a);

The inputs to the GSORTH subroutine are as follows:


p
is an m x n column-orthonormal output matrix.

t
is an upper triangular n x n output matrix.

lindep
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.

a
is an input m x n matrix.
The GSORTH subroutine computes the Gram-Schmidt orthonormal factorization of the m x n matrix a, where m is greater than or equal to n; that is, the GSORTH subroutine computes the column-orthonormal m x n matrix p and the upper triangular n x n matrix t such that
a= p*t
If the columns of a are linearly independent (that is, rank(a)=n), then p is full-rank column-orthonormal: p^'p=i_w, t is nonsingular, and the value of lindep (a scalar) is set to 0. If the columns of a are linearly dependent (say, rank(a)=k \lt n) then n-k columns of p are set to 0, the corresponding rows of t are set to 0 (t is singular), and lindep is set to 1. The pattern of zero columns in p corresponds to the pattern of linear dependencies of the columns of a when columns are considered in left-to-right order.

The GSORTH subroutines implements an algorithm described by Golub (1969).

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.

If lindep is 1, you can rearrange the columns of p and rows of t so that the zero columns of p are right-most - that is, p=(p(,1),p(,k),0, ... ,0), where k is the column rank of a and a=p*t is preserved. The following statements make this rearrangement:

  
    d=rank((ncol(t)-(1:ncol(t))`)#(vecdiag(t)=0)); 
    temp=p; 
    p[,d]=temp; 
    temp=t; 
    t[,d]=temp;
 
An example of a valid GSORTH call follows:
  
    x={1 1 1, 1 2 4, 1 3 9}; 
    xpx=x`*x; 
    call gsorth(p, t, l, xpx);
 
These statements produce the following output matrices:
  
                 P             3 rows      3 cols    (numeric) 
  
                          0.193247 -0.753259 0.6286946 
                          0.386494 -0.530521 -0.754434 
                         0.9018193 0.3887787 0.1886084 
  
  
                 T             3 rows      3 cols    (numeric) 
  
                         15.524175 39.035892 104.99753 
                                 0 2.0491877 8.4559365 
                                 0         0 0.1257389 
  
  
                 L             1 row       1 col     (numeric) 
  
                                           0
 

Previous Page | Next Page | Top of Page