Main Content

dsp.LUFactor

(Removed) Factor square matrix into lower and upper triangular matrices

dsp.LUFactor has been removed. Use lu instead. For more information, see Compatibility Considerations.

Description

The LUFactor object factors a square matrix into lower and upper triangular matrices.

To factor a square matrix into lower and upper triangular matrices:

  1. Define and set up your System object™. See Construction.

  2. Call step to factor the square matrix according to the properties of dsp.LUFactor. The behavior of step is specific to each object in the toolbox.

Note

Starting in R2016b, instead of using the step method to perform the operation defined by the System object, you can call the object with arguments, as if it were a function. For example, y = step(obj,x) and y = obj(x) perform equivalent operations.

Construction

lu = dsp.LUFactor returns an LUFactor System object, lu, which factors a row permutation of a square input matrix A as Ap = LU, where L is the unit-lower triangular matrix, and U is the upper triangular matrix. The row-pivoted matrix Ap contains the rows of A permuted as indicated by the permutation index vector P. The equivalent MATLAB® code is Ap = A(P,:).

lu = dsp.LUFactor('PropertyName',PropertyValue,...) returns an LUFactor object, lu, with each specified property set to the specified value.

Properties

ExceptionOutputPort

Set to true to output singularity of input

Set this property to true to output the singularity of the input as logical data type values of true or false. An output of true indicates that the current input is singular, and an output of false indicates the current input is nonsingular.

 Fixed-Point Properties

Methods

stepDecompose matrix into lower and upper triangular matrices
Common to All System Objects
release

Allow System object property value changes

Examples

collapse all

Note

If you are using R2016a or an earlier release, replace each call to the object with the equivalent step syntax. For example, obj(x) becomes step(obj,x).

Decompose a square matrix into the lower and upper components.

lu = dsp.LUFactor;
x = rand(4)
x = 4×4

    0.8147    0.6324    0.9575    0.9572
    0.9058    0.0975    0.9649    0.4854
    0.1270    0.2785    0.1576    0.8003
    0.9134    0.5469    0.9706    0.1419

[LU, P] = lu(x);
L = tril(LU,-1)+diag(ones(size(LU,1),1));
U = triu(LU);
y = L*U
y = 4×4

    0.9134    0.5469    0.9706    0.1419
    0.9058    0.0975    0.9649    0.4854
    0.8147    0.6324    0.9575    0.9572
    0.1270    0.2785    0.1576    0.8003

Check back whether y equals the permuted x

xp = x(P,:)
xp = 4×4

    0.9134    0.5469    0.9706    0.1419
    0.9058    0.0975    0.9649    0.4854
    0.8147    0.6324    0.9575    0.9572
    0.1270    0.2785    0.1576    0.8003

Algorithms

This object implements the algorithm, inputs, and outputs described on the LU Factorization block reference page. The object properties correspond to the block parameters.

Extended Capabilities

Version History

Introduced in R2012a

expand all

R2023a: dsp.LUFactor System object has been removed

The dsp.LUFactor System object has been removed. Use the lu function instead.

Update Code

This table shows how to update existing code to use the lu function.

Discouraged UsageRecommended Replacement
rng(1)
lu = dsp.LUFactor;
x = rand(4)
x = 4×4

    0.4170    0.1468    0.3968    0.2045
    0.7203    0.0923    0.5388    0.8781
    0.0001    0.1863    0.4192    0.0274
    0.3023    0.3456    0.6852    0.6705

[LU,P] = lu(x)
LU = 4×4
    0.7203    0.0923    0.5388    0.8781
    0.4197    0.3068    0.4591    0.3019
    0.0002    0.6070    0.1404   -0.1560
    0.5789    0.3041   -0.3900   -0.4566

P = 4×1
     2
     4
     3
     1
[LUfn,Pfn] = lu(x)
LUfn = 4×4
    0.7203    0.0923    0.5388    0.8781
    0.4197    0.3068    0.4591    0.3019
    0.0002    0.6070    0.1404   -0.1560
    0.5789    0.3041   -0.3900   -0.4566

Pfn = 4×1
     2
     4
     3
     1

See Also