qr
QR decomposition of symbolic matrix
Syntax
Description
returns the
R
= qr(A
)R
factor of the QR
decomposition
A = Q*R
. Here, A
is an
m-by-n symbolic matrix, R
is an
m-by-n upper triangular symbolic matrix, and
Q
is an m-by-m unitary symbolic
matrix.
[
specifies whether to return
the permutation information Q
,R
,P
]
= qr(___,outputForm
)P
as a matrix or a vector. For example,
if outputForm
is "vector"
, then A(:,P) =
Q*R
. The default value of outputForm
is
"matrix"
such that A*P = Q*R
.
[___] = qr(
is equivalent to
A
,0)qr(A,"econ","vector")
. This syntax is not recommended. Use the
"econ"
option instead.
[
also returns a permutation
matrix C
,R
,P
]
= qr(A
,B
)P
such that A*P = Q*R
. If all elements of
A
can be approximated by floating-point numbers, then this syntax
chooses the permutation matrix P
so that
abs(diag(R))
is decreasing. Otherwise, it returns P =
eye(n)
.
C
, R
, and P
represent
the solution of the matrix equation A*X = B
as X =
P*(R\C)
.
[
specifies whether to return
the permutation information C
,R
,P
]
= qr(___,outputForm
)P
as a matrix or a vector. For example,
if outputForm
is "vector"
, then the solution of
the matrix equation A*X = B
is X(P,:) = R\C
. The
default value of outputForm
is "matrix"
such that
the solution to A*X = B
is X = P*(R\C)
.
___ = qr(___,"real")
assumes that the
input arguments and intermediate results are real, and therefore, suppresses calls to
abs
and conj
. When you use this option,
qr
assumes that all symbolic variables represent real numbers. All
numeric arguments should be real numbers for this syntax.
Use "real"
to avoid complex conjugates in the result.
Examples
Input Arguments
Output Arguments
More About
Tips
The upper triangular matrix
R
satisfies the conditionR = chol(A'*A)
.The arguments
"econ"
and0
affect only the shape of the returned matrices.Calling
qr
for numeric matrices that are not symbolic objects (not created bysym
,syms
, orvpa
) invokes the MATLAB®qr
function.Matrix computations involving many symbolic variables can be slow. To increase the computational speed, reduce the number of symbolic variables by substituting the given values for some variables.