fixed.qlessQR

Q-less QR decomposition

Description

R = fixed.qlessQR(A) returns the upper-triangular R factor of the QR decomposition A = Q*R.

This is equivalent to computing

[~,R] = qr(A)

R = fixed.qlessQR(A, forgettingFactor) returns the upper-triangular R factor of the QR decomposition and multiplies R by the forgettingFactor after each row of A is processed.

Examples

collapse all

This example shows how to solve the system of equations (AA)x=B using forward and backward substitution.

Specify the input variables, A and B.

rng default;
A = gallery('randsvd', [5,3], 1000);
b = [1; 1; 1; 1; 1];

Compute the upper-triangular factor, R, of A, where A=QR.

R = fixed.qlessQR(A);

Use forward and backward substitution to compute the value of X.

X = fixed.forwardSubstitute(R,b);
X(:) = fixed.backwardSubstitute(R,X)
X = 5×1
105 ×

   -0.9088
    2.7123
   -0.8958
         0
         0

This solution is equivalent to using the fixed.qlessQRMatrixSolve function.

x = fixed.qlessQRMatrixSolve(A,b) 
x = 5×1
105 ×

   -0.9088
    2.7123
   -0.8958
         0
         0

Using a forgetting factor with the fixed.qlessQR function is roughly equivalent to the Complex- and Real Partial-Systolic Q-less QR with Forgetting Factor blocks. These blocks process one row of the input matrix at a time and apply the forgetting factor after each row is processed. The fixed.qlessQR function takes in all rows of A at once, but carries out the computation in the same way as the blocks. The forgetting factor is applied after each row is processed.

Specifying a forgetting factor is useful when you want to stream an indefinite number of rows continuously, such as reading values from a sensor array continuously, without accumulating the data without bound.

Without using a forgetting factor, the accumulation is the square root of the number of rows, so 10000 rows would accumulate to 10000=100.

A = ones(10000,3);
R = fixed.qlessQR(A)
R = 3×3

  100.0000  100.0000  100.0000
         0    0.0000    0.0000
         0         0    0.0000

To accrue with the effective height of m=16 rows, set the forgetting factor to the following.

m=16;
forgettingFactor = exp(-1/(2*m))
forgettingFactor = 0.9692

Using the forgetting factor, fixed.qlessQR would accumulate to about square root of 16.

R = fixed.qlessQR(A,forgettingFactor)
R = 3×3

    3.9377    3.9377    3.9377
         0    0.0000    0.0000
         0         0    0.0000

Input Arguments

collapse all

Input matrix, specified as a matrix.

Data Types: single | double | fi
Complex Number Support: Yes

Forgetting factor, specified as a nonnegative scalar between 0 and 1. The forgetting factor determines how much weight past data is given. The forgettingFactor value is multiplied by R after each row of A is processed.

Data Types: single | double | int8 | int16 | int32 | int64 | uint8 | uint16 | uint32 | uint64 | fi

Output Arguments

collapse all

Upper-triangular factor, returned as a matrix that satisfies A = Q*R.

Introduced in R2020b