Language Reference

COMPORT Call

provides complete orthogonal decomposition by Householder transformations

CALL COMPORT( q, r, p, piv, lindep, a\lt, b<, sing>);

The COMPORT subroutine returns the following values:


q
If b is not specified, q is the m x m orthogonal matrix {q} that is the product of the \min(m,n) separate Householder transformations. If b is specified, q is the m x p matrix {q}^' {b} that has the transposed Householder transformations {q}^' applied on the p columns of the argument matrix {b}.

r
is the n x n upper triangular matrix {{r}} that contains the r x r nonsingular upper triangular matrix {l}^' of the complete orthogonal decomposition, where r\leq n is the rank of {a}. The full m x n upper triangular matrix {{r}} of the orthogonal decomposition of matrix {a} can be obtained by vertical concatenation (IML operator //) of the (m-n) x n zero matrix to the result r.

p
is an n x n matrix that is the product {p}{{{{\pi}}}} of a permutation matrix {{{{\pi}}}} with an orthogonal matrix {p}. The permutation matrix is determined by the vector piv.

piv
is an n x 1 vector of permutations of the columns of {a}. That is, the QR decomposition is computed, not of {a}, but of the matrix with columns [{a}_{piv[1]} ... {a}_{piv[n]}]. The vector piv corresponds to an n x n permutation matrix, {{{{\pi}}}}, of the pivoted QR decomposition in the first step of orthogonal decomposition.

lindep
specifies the number of linearly dependent columns in the matrix {a} detected by applying the r Householder transformation in the order specified by the argument piv. That is, lindep=n-r.

The inputs to the COMPORT subroutine are as follows:


a
specifies the m x n matrix {a}, with m \geq n, which is to be decomposed into the product of the m x m orthogonal matrix {q}, the n x n upper triangular matrix {{r}}, and the n x n orthogonal matrix {p},
{a}= {q}[ {{r}}\ 0    ] {{{{\pi}}}}^' {p}^' {{{{\pi}}}}

b
specifies an optional m x p matrix {b} that is to be left multiplied by the transposed m x m matrix {q}^'.

sing
is an optional scalar specifying a singularity criterion.


The complete orthogonal decomposition of the singular matrix {a} can be used to compute the Moore-Penrose inverse {a}^-, r = {\rm rank}({a}) \lt n, or to compute the minimum 2-norm solution of the (rank deficient) least squares problem \vert {a}{x}- {b}\vert^2_2.
  1. Use the QR decomposition of {a} with column pivoting,
    {a}= {q}[ {{r}}\ 0    ] {{{{\pi}}}}^'    = [ {y}& {z}   ]    [ {{r}}_1 & {{r}}_2 \    0 & 0    ] {{{{\pi}}}}^'
    where {{r}}= [ {{r}}_1 & {{r}}_2    ] \in{\cal r}^{r x t} is upper trapezoidal, {{r}}_1\in{\cal r}^{r x r} is upper triangular and invertible, {{r}}_2\in{\cal r}^{r x s}, {q}= [{y}& {z}] is orthogonal, {y}\in{\cal r}^{t x r}, {z}\in{\cal r}^{t x s}, and {{{{\pi}}}} permutes the columns of {a}.
  2. Use the transpose {l}_{12} of the upper trapezoidal matrix {{r}}= [ {{r}}_1 & {{r}}_2    ],
    {l}_{12} = [ {l}_1 \ {l}_2    ]    = {{r}}^' \in{\cal r}^{t x r}
    with {\rm rank}({l}_{12}) = {\rm rank}({l}_1) = r, {l}_1\in{\cal r}^{r x r} lower triangular, {l}_2\in{\cal r}^{s x r}. The lower trapezoidal matrix {l}_{12}\in{\cal r}^{t x r} is premultiplied with r Householder transformations {p}_1, ... ,{p}_r:
    {p}_r  ...  {p}_1 [ {l}_1 \ {l}_2    ]    = [ {l}\ 0    ]
    each zeroing out one of the r columns of {l}_2 and producing the nonsingular lower triangular matrix {l}\in{\cal r}^{r x r}. Therefore, you obtain
    {a}= {q}[ {l}^' & 0 \    0 & 0    ]{{{{\pi}}}}^' {p}^'    = {y}[ {l}^' & 0    ] {{{{\pi}}}}^' {p}^'
    with {p}= {{{{\pi}}}}{p}_r ... {p}_1\in{\cal r}^{t x t} and upper triangular {l}^'. This second step is described in Golub and Van Loan (1989, p. 220 and p. 236).

  3. Compute the Moore-Penrose inverse {a}^- explicitly:
    {a}^- = {p}{{{{\pi}}}}[ ({l}^')^{-1} & 0 \    0 & 0    ] {q}^'    = {p}{{{{\pi}}}}[ ({l}^')^{-1} \ 0    ] {y}^'
    (a)
    Obtain {y} in {q}= [{y}& {z}   ] explicitly by applying the r Householder transformations obtained in the first step to [ {i}_r \ 0    ].

    (b)
    Solve the r x r lower triangular system ({l}^')^{-1}{y}^' with t right-hand sides by using backward substitution, which yields an r x t intermediate matrix.

    (c)
    Left-apply the r Householder transformations in {p} on the r x t intermediate matrix [ ({l}^')^{-1}{y}^' \    0 \    ], which results in the symmetric matrix {a}^-\in{\cal r}^{t x t}.

The GINV function computes the Moore-Penrose inverse {a}^- by using the singular value decomposition of {a}. Using complete orthogonal decomposition to compute {a}^- usually requires far fewer floating-point operations. However, it can be slightly more sensitive to rounding errors, which can disturb the detection of the true rank of {a}, than singular value decomposition.

The following example demonstrates the use of the APPCORT subroutine, as well as the resulting output:

  
    /* Only four linearly independent columns */ 
    A = {1 0 1 0 0, 
         1 0 0 1 0, 
         1 0 0 0 1, 
         0 1 1 0 0, 
         0 1 0 1 0, 
         0 1 0 0 1 }; 
    m = nrow(A); 
    n = ncol(A); 
  
    call comport(q,r,p,piv,lindep,A); 
    fullR = r // j(m-n, n, 0); 
    perm = i(n); 
    perm[piv,] = i(n); 
  
    /* recover A from factorization */ 
    A2 = q*fullR*p`*perm`; 
    reset fuzz; 
    print A2; 
  
    /* compute Moore-Penrose generalized inverse */ 
    rankA = n - lindep; 
    subR = R[1:rankA, 1:rankA]; 
    fullRinv = j(n, n, 0); 
    fullRinv[1:rankA, 1:rankA] = inv(subR); 
    Ainv = perm*p*fullRinv*q[,1:n]`; 
    print Ainv; 
  
    /* verify generalized inverse */ 
    eps = 1e-12; 
    if any(A*Ainv*A-A > eps) | 
       any(Ainv*A*Ainv-Ainv > eps) | 
       any((A*Ainv)`-A*Ainv > eps) | 
       any((Ainv*A)`-Ainv*A > eps) then 
           print "Pseudoinverse conditions not satisfied"; 
       else 
          print "Pseudoinverse conditions satisfied"; 
  
                              A2 
  
              1         0         1         0         0 
              1         0         0         1         0 
              1         0         0         0         1 
              0         1         1         0         0 
              0         1         0         1         0 
              0         1         0         0         1 
  
                                  AINV 
  
      0.2666667 0.2666667 0.2666667 -0.066667 -0.066667 -0.066667 
      -0.066667 -0.066667 -0.066667 0.2666667 0.2666667 0.2666667 
            0.4      -0.1      -0.1       0.4      -0.1      -0.1 
           -0.1       0.4      -0.1      -0.1       0.4      -0.1 
           -0.1      -0.1       0.4      -0.1      -0.1       0.4 
  
                       Pseudoinverse conditions satisfied
 

Previous Page | Next Page | Top of Page