 linalg(deprecated)/QRdecomp - Maple Help

linalg(deprecated)

 QRdecomp
 QR decomposition of a matrix Calling Sequence QRdecomp(A) QRdecomp(A, arg2, arg3, ...) QRdecomp(A, Q='q', rank='r', fullspan=value) Parameters

 A - rectangular matrix arg.i - (optional) is of the form name=val rank='r' - (optional) for returning the rank of A Q='q' - (optional) for returning the Q factor of A fullspan=value - (optional) include null span in Q Description

 • Important: The linalg package has been deprecated. Use the superseding command LinearAlgebra[QRDecomposition], instead.
 - For information on migrating linalg code to the new packages, see examples/LinearAlgebraMigration.
 • The routine QRdecomp computes the QR decomposition of the matrix A.
 • For matrices of floating-point entries, the numerically stable Householder-transformations are used.  For symbolic computation, the Gram-Schmidt process is applied.
 • The result is an upper triangular matrix R.  The orthonormal (unitary) factor Q is passed back to the Q parameter.
 • The default factorization is the full QR where R will have the same dimension as A.  Q will be a full rank square matrix whose first n columns span the column space of A and whose last m-n columns span the null space of A.
 • If the (optional) fullspan arg is set to false, a Q1R1 factorization will be given where the Q1 factor will have the same dimension as A and, assuming A has full column rank, the columns of Q will span the column space of A. The R factor will be square and agree in dimension with Q.  The default for fullspan is true.
 • If A is an n by n matrix then $\prod _{i],i=1\mathrm{..}n}R[i$.
 • If A contains complex entries, the Q factor will be unitary.
 • The QR factorization can be used to generate a least squares solution to an overdetermined system of linear equations.  If $\mathrm{Ax}=b$, and $\mathrm{QR}=A$ then $\mathrm{Rx}=\mathrm{transpose}\left(Q\right)b$ can be solved through backsubstitution.
 • The command with(linalg,QRdecomp) allows the use of the abbreviated form of this command. Examples

Important: The linalg package has been deprecated. Use the superseding command LinearAlgebra[QRDecomposition], instead.

 > $\mathrm{with}\left(\mathrm{linalg}\right):$
 > $A≔\mathrm{matrix}\left(3,3,\left[1,2,3,0,0,1,2,3,4\right]\right)$
 ${A}{≔}\left[\begin{array}{ccc}{1}& {2}& {3}\\ {0}& {0}& {1}\\ {2}& {3}& {4}\end{array}\right]$ (1)
 > $R≔\mathrm{QRdecomp}\left(A,Q='q',\mathrm{rank}='r'\right)$
 ${R}{≔}\left[\begin{array}{ccc}\sqrt{{5}}& \frac{{8}{}\sqrt{{5}}}{{5}}& \frac{{11}{}\sqrt{{5}}}{{5}}\\ {0}& \frac{\sqrt{{5}}}{{5}}& \frac{{2}{}\sqrt{{5}}}{{5}}\\ {0}& {0}& {1}\end{array}\right]$ (2)
 > $\mathrm{rank}\left(R\right)$
 ${3}$ (3)
 > $\mathrm{evalm}\left(q\right)$
 $\left[\begin{array}{ccc}\frac{\sqrt{{5}}}{{5}}& \frac{{2}{}\sqrt{{5}}}{{5}}& {0}\\ {0}& {0}& {1}\\ \frac{{2}{}\sqrt{{5}}}{{5}}& {-}\frac{\sqrt{{5}}}{{5}}& {0}\end{array}\right]$ (4)
 > $A≔\mathrm{matrix}\left(4,2,\left[1,2,3,0,0,1,2,3\right]\right)$
 ${A}{≔}\left[\begin{array}{cc}{1}& {2}\\ {3}& {0}\\ {0}& {1}\\ {2}& {3}\end{array}\right]$ (5)
 > $R≔\mathrm{QRdecomp}\left(A,Q='q',\mathrm{fullspan}=\mathrm{false}\right)$
 ${R}{≔}\left[\begin{array}{cc}\sqrt{{14}}& \frac{{4}{}\sqrt{{14}}}{{7}}\\ {0}& \frac{\sqrt{{462}}}{{7}}\end{array}\right]$ (6)
 > $\mathrm{rank}\left(R\right)$
 ${2}$ (7)
 > $\mathrm{evalm}\left(q\right)$
 $\left[\begin{array}{cc}\frac{\sqrt{{14}}}{{14}}& \frac{{5}{}\sqrt{{462}}}{{231}}\\ \frac{{3}{}\sqrt{{14}}}{{14}}& {-}\frac{{2}{}\sqrt{{462}}}{{77}}\\ {0}& \frac{\sqrt{{462}}}{{66}}\\ \frac{\sqrt{{14}}}{{7}}& \frac{{13}{}\sqrt{{462}}}{{462}}\end{array}\right]$ (8)