Matrix decomposition for solving linear systems
decomposition
creates reusable matrix decompositions (LU,
LDL, Cholesky, QR, and more) that enable you to solve linear systems (Ax =
b or xA = b) more efficiently. For example, after
computing dA = decomposition(A)
the call dA\b
returns the same vector as A\b
, but is typically much faster.
decomposition
objects are well-suited to solving problems that
require repeated solutions, since the decomposition of the coefficient matrix does not
need to be performed multiple times.
You can use a decomposition
object dA
with many
of the same operators you might use on the original coefficient matrix
A
:
Complex conjugate transpose dA'
Negation -dA
Multiply or divide by a scalar using c*dA
or
dA/c
.
Solve a linear system Ax = b using x =
dA\b
.
Solve a linear system xA = b using x =
b/dA
.
returns a decomposition of matrix dA
= decomposition(A
)A
that you can use to solve
linear systems more efficiently. The decomposition type is automatically chosen
based on the properties of the input matrix.
specifies that only the upper or lower triangular portion of
dA
= decomposition(A
,type
,triangularFlag
)A
is to be used in the decomposition.
triangularFlag
can be 'upper'
or
'lower'
. With this syntax, the decomposition type must be
'ldl'
, 'chol'
, or
'triangular'
.
specifies additional options using one or more dA
= decomposition(___,Name,Value
)Name,Value
pair arguments using any of the previous syntaxes. For example, dA =
decomposition(A,'CheckCondition',false)
specifies not to throw a
warning based on the condition of A
while solving
dA\b
.
The primary functions and operators that you can use with
decomposition
objects are related to solving linear systems of
equations. If the decomposition type is 'qr'
, then you cannot solve
A'\B
or B/A
. Instead, use
'cod'
for problems with those forms.
ctranspose | Complex conjugate transpose |
mldivide | Solve systems of linear equations Ax = B for x |
mrdivide | Solve systems of linear equations xA = B for x |
isIllConditioned | Determine whether matrix is ill conditioned |
You also can check the condition number or rank of the underlying matrix of
decomposition
objects. Since different algorithms are employed,
the results of using these functions on the decomposition
object can
differ compared to using the same functions directly on the coefficient matrix.
rank |
|
rcond |
|