LU Factorization

Factor square matrix into lower and upper triangular components

Library

Math Functions / Matrices and Linear Algebra / Matrix Factorizations

dspfactors

Description

The LU Factorization block factors a row-permuted version of the square input matrix A as Ap = L*U, where L is a unit-lower triangular matrix, U is an upper triangular matrix, and Ap contains the rows of A permuted as indicated by the permutation index vector P. The block uses the pivot matrix Ap instead of the exact input matrix A because it improves the numerical accuracy of the factorization. You can determine the singularity of the input matrix A by enabling the optional output port S. When A is singular, the block outputs a 1 at port S; when A is nonsingular, it outputs a 0.

To improve efficiency, the output of the LU Factorization block at port LU is a composite matrix containing both the lower triangle elements of L and the upper triangle elements of U. Thus, the output is in a different format than the output of the MATLAB® lu function, which returns L and U as separate matrices. To convert the output from the block's LU port to separate L and U matrices, use the following code:

L = tril(LU,-1)+eye(size(LU));
U = triu(LU); 

If you compare the results produced by these equations to the actual output of the MATLAB lu function, you may see slightly different values. These differences are due to rounding error, and are expected.

See the lu function reference page in the MATLAB documentation for more information about LU factorizations.

Fixed-Point Data Types

The following diagram shows the data types used within the LU Factorization block for fixed-point signals.

You can set the product output, accumulator, and output data types in the block dialog as discussed below.

The output of the multiplier is in the product output data type when the input is real. When the input is complex, the result of the multiplication is in the accumulator data type. For details on the complex multiplication performed, see Multiplication Data Types.

Examples

The row-pivoted matrix Ap and permutation index vector P computed by the block are shown below for 3-by-3 input matrix A.

A=[185912257]        P=(213)        AP=[912185257]

The LU output is a composite matrix whose lower subtriangle forms L and whose upper triangle forms U.

See Factor a Matrix into Upper and Lower Submatrices Using the LU Factorization Block in the DSP System Toolbox™ User's Guide for another example using the LU Factorization block.

Dialog Box

The Main pane of the LU Factorization block dialog appears as follows.

Show singularity status

Select to output the singularity of the input at port S, which outputs Boolean data type values of 1 or 0. An output of 1 indicates that the current input is singular, and an output of 0 indicates the current input is nonsingular.

The Data Types pane of the LU Factorization block dialog appears as follows.

Rounding mode

Select the rounding mode for fixed-point operations.

Overflow mode

Select the overflow mode for fixed-point operations.

Product output data type

Specify the product output data type. See Fixed-Point Data Types and Multiplication Data Types for illustrations depicting the use of the product output data type in this block. You can set it to:

  • A rule that inherits a data type, for example, Inherit: Inherit via internal rule

  • An expression that evaluates to a valid data type, for example, fixdt(1,16,0)

Click the Show data type assistant button to display the Data Type Assistant, which helps you set the Product output data type parameter.

See Specify Data Types Using Data Type Assistant for more information.

Accumulator data type

Specify the accumulator data type. See Fixed-Point Data Types for illustrations depicting the use of the accumulator data type in this block. You can set this parameter to:

  • A rule that inherits a data type, for example, Inherit: Inherit via internal rule

  • An expression that evaluates to a valid data type, for example, fixdt(1,16,0)

Click the Show data type assistant button to display the Data Type Assistant, which helps you set the Accumulator data type parameter.

See Specify Data Types Using Data Type Assistant for more information.

Output data type

Specify the output data type. See Fixed-Point Data Types for illustrations depicting the use of the output data type in this block. You can set it to:

  • A rule that inherits a data type, for example, Inherit: Same as input

  • An expression that evaluates to a valid data type, for example, fixdt(1,16,0)

Click the Show data type assistant button to display the Data Type Assistant, which helps you set the Output data type parameter.

See Specify Block Output Data Types for more information.

Lock data type settings against changes by the fixed-point tools

Select this parameter to prevent the fixed-point tools from overriding the data types you specify on the block mask.

References

Golub, G. H., and C. F. Van Loan. Matrix Computations. 3rd ed. Baltimore, MD: Johns Hopkins University Press, 1996.

Supported Data Types

PortSupported Data Types

A

  • Double-precision floating point

  • Single-precision floating point

  • Fixed point (signed only)

  • 8-, 16-, and 32-bit signed integers

LU

  • Double-precision floating point

  • Single-precision floating point

  • Fixed point (signed only)

  • 8-, 16-, and 32-bit signed integers

P

  • Double-precision floating point

  • Single-precision floating point

  • 32-bit unsigned integers

S

  • Boolean

See Also

Autocorrelation LPCDSP System Toolbox
Cholesky FactorizationDSP System Toolbox
LDL FactorizationDSP System Toolbox
LU InverseDSP System Toolbox
LU SolverDSP System Toolbox
Permute MatrixDSP System Toolbox
QR FactorizationDSP System Toolbox
luMATLAB

See Matrix Factorizations for related information.

Was this topic helpful?