Language Reference

RDODT and RUPDT Calls

downdate and update QR and Cholesky decompositions

CALL RDODT( def, rup, bup, sup, r, z\lt, b, y\lt, ssq>);
CALL RUPDT( rup, bup, sup, r, z\lt, b, y\lt, ssq>);

The RDODT and RUPDT subroutines return the values:



def
is only used for downdating, and it specifies whether the downdating of matrix {{r}} by using the q rows in argument z has been successful. The result def=2 means that the downdating of {{r}} by at least one row of {z} leads to a singular matrix and cannot be completed successfully (since the result of downdating is not unique). In that case, the results rup, bup, and sup contain missing values only. The result def=1 means that the residual sum of squares, ssq, could not be downdated successfully and the result sup contains missing values only. The result def=0 means that the downdating of {{r}} by {z} was completed successfully.

rup
is the n x n upper triangular matrix {{r}} that has been updated or downdated by using the q rows in {z}.

bup
is the n x p matrix {b} of right-hand sides that has been updated or downdated by using the q rows in argument y. If the argument b is not specified, bup is not computed.

sup
is a p vector of square roots of residual sum of squares that is updated or downdated by using the q rows of argument y. If ssq is not specified, sup is not computed.

The inputs to the RDODT and RUPDT subroutines are as follows:



r
specifies an n x n upper triangular matrix {{r}} to be updated or downdated by the q rows in {z}. Only the upper triangle of {{r}} is used; the lower triangle can contain any information.

z
specifies a q x n matrix {z} used rowwise to update or downdate the matrix {{r}}.

b
specifies an optional n x p matrix {b} of right-hand sides that have to be updated or downdated simultaneously with {{r}}. If b is specified, the argument y must also be specified.

y
specifies an optional q x p matrix {y} used rowwise to update or downdate the right-hand side matrix {b}. If b is specified, the argument y must also be specified.

ssq
is an optional p vector that, if b is specified, specifies the square root of the error sum of squares that should be updated or downdated simultaneously with {{r}} and {b}.



The upper triangular matrix {{r}} of the QR decomposition of an m x n matrix {a},
{a}= {q}{{r}}, { where } {q}^' {q}= {q}{q}^' = {i}_m
is recomputed efficiently in two cases:

Computing the whole QR decomposition of matrix {a} by Householder transformations requires 4mn^2 - 4n^3/3 floating-point operations, whereas updating or downdating the QR decomposition (by Givens rotations) of one row vector {z} requires only 2n^2 floating-point operations.

If the QR decomposition is used to solve the full-rank linear least squares problem
\min_{{x}} \vert {a}{x}- {b}\vert^2 = {ssq}
by solving the nonsingular upper triangular system
{x}= {{r}}^{-1} {q}^' {b}
then the RUPDT and RDODT subroutines can be used to update or downdate the p-transformed right-hand sides {q}^' {b} and the residual sum-of-squares p vector ssq provided that for each n vector {z} added to or deleted from {a} there is also a p vector {y} added to or deleted from the m x p right-hand-side matrix {b}.

If the arguments z and y of the subroutines RUPDT and RDODT contain q \gt 1 row vectors for which {{r}} (and {q}^' {b}, and eventually ssq) is to be updated or downdated, the process is performed stepwise by processing the rows {z}_k (and {y}_k), k = 1, ... ,q, in the order in which they are stored.

The QR decomposition of an m x n matrix {a}, m \geq n, rank({a}) = n,
{a}= {q}{{r}}, { where } {q}^' {q}= {q}{q}^' = {i}_m
corresponds to the Cholesky factorization
{c}= {{r}}^' {{r}}, { where } {c}= {a}^' {a}
of the positive definite n x n crossproduct matrix {c}= {a}^' {a}. In the case where m \geq n and rank({a}) = n, the upper triangular matrix {{r}} computed by the QR decomposition (with positive diagonal elements) is the same as the one computed by Cholesky factorization except for numerical error,
{a}^' {a}= ({q}{{r}})^' ({q}{{r}}) = {{r}}^' {{r}}
Adding a row vector {z} to matrix {a} corresponds to the rank-1 modification of the crossproduct matrix {c}
{\widetilde{c}} = {c}+ {z}^' {z}, { where }   {\widetilde{c}} = {\widetilde{a}^' \widetilde{a}}
and the (m+1) x n matrix {\widetilde{a}} contains all rows of {a} with the row {z} added.

Deleting a row vector {z} from matrix {a} corresponds to the rank-1 modification
{c}^* = {c}- {z}^' {z}, { where }   {c}^* = {a}^{*' {a}^*
and the (m-1) x n matrix {a}^* contains all rows of {a} with the row {z} deleted. Thus, you can also use the subroutines RUPDT and RDODT to update or downdate the Cholesky factor {{r}} of a positive definite crossproduct matrix {c} of {a}.



The process of downdating an upper triangular matrix {{r}} (and eventually a residual sum-of-squares vector ssq) is not always successful. First of all, the downdated matrix {{r}} could be rank deficient. Even if the downdated matrix {{r}} is of full rank, the process of downdating can be ill-conditioned and does not work well if the downdated matrix is close (by rounding errors) to a rank-deficient one. In these cases, the downdated matrix {{r}} is not unique and cannot be computed by subroutine RDODT. If {{r}} cannot be computed, def returns 2, and the results rup, bup, and sup return missing values.

The downdating of the residual sum-of-squares vector ssq can be a problem, too. In practice, the downdate formula
{ssq}_{new} =   \sqrt{{{ssq}}_{old} -   {{ssq}}_{dod}}

cannot always be computed because, due to rounding errors, the radicand can be negative. In this case, the result vector sup returns missing values, and def returns 1.

You can use various methods to compute the p columns {x}_k of the n x p matrix {x} that minimize the p linear least squares problems with an m x n coefficient matrix {a}, m \geq n, rank({a}) = n, and p right-hand-side vectors {b}_k (stored columnwise in the m x p matrix {b}). The first of the following methods solves the normal equations and cannot be applied to the example with the 6x 5 Hilbert matrix since too much rounding error is introduced. Therefore, use the following simple example:

  
     a = { 1 3 , 
           2 2 , 
           3 1 }; 
     b = { 1, 1, 1}; 
     m = nrow(a); 
     n = ncol(a); 
     p = 1;
 
For the preceding 3 x 2 example matrix {a}, each method obtains the unique LS estimator:
  
    ss = ssq(a * x - b); 
    print ss x;
 

To compute the (transposed) matrix {q}, you can use the following specification:

  
    r = shape(0,n,n); 
    y = i(m); 
    qt = shape(0,n,m); 
    call rupdt(rup,qtup,sup,r,a,qt,y);
 

Previous Page | Next Page | Top of Page