File: transforms_qr.html

package info (click to toggle)
freemat 4.0-3
  • links: PTS, VCS
  • area: main
  • in suites: squeeze
  • size: 174,756 kB
  • ctags: 67,023
  • sloc: cpp: 351,059; ansic: 255,892; sh: 40,590; makefile: 4,387; perl: 4,058; asm: 3,313; pascal: 2,718; fortran: 1,722; ada: 1,681; ml: 1,360; cs: 879; csh: 795; python: 430; sed: 162; lisp: 160; awk: 5
file content (66 lines) | stat: -rw-r--r-- 2,683 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">

<HTML>
<HEAD>
<TITLE>QR QR Decomposition of a Matrix
</TITLE>
</HEAD>
<BODY>
<H2>QR QR Decomposition of a Matrix
</H2>
<P>
Section: <A HREF=sec_transforms.html> Transforms/Decompositions </A>
<H3>Usage</H3>
Computes the QR factorization of a matrix.  The <code>qr</code> function has
multiple forms, with and without pivoting.  The non-pivot version
has two forms, a compact version and a full-blown decomposition
version.  The compact version of the decomposition of a matrix 
of size <code>M x N</code> is
<PRE>
  [q,r] = qr(a,0)
</PRE>
<P>
where <code>q</code> is a matrix of size <code>M x L</code> and <code>r</code> is a matrix of
size <code>L x N</code> and <code>L = min(N,M)</code>, and <code>q*r = a</code>.  The QR decomposition is
such that the columns of <code>Q</code> are orthonormal, and <code>R</code> is upper
triangular.  The decomposition is computed using the LAPACK 
routine <code>xgeqrf</code>, where <code>x</code> is the precision of the matrix.  
FreeMat supports decompositions of <code>single</code> and <code>double</code> types.

The second form of the non-pivot decomposition omits the second <code>0</code>
argument:
<PRE>
  [q,r] = qr(a)
</PRE>
<P>
This second form differs from the previous form only for matrices
with more rows than columns (<code>M &gt; N</code>).  For these matrices, the
full decomposition is of a matrix <code>Q</code> of size <code>M x M</code> and 
a matrix <code>R</code> of size <code>M x N</code>.  The full decomposition is computed
using the same LAPACK routines as the compact decomposition, but
on an augmented matrix <code>[a 0]</code>, where enough columns are added to
form a square matrix.

Generally, the QR decomposition will not return a matrix <code>R</code> with
diagonal elements in any specific order.  The remaining two forms 
of the <code>qr</code> command utilize permutations of the columns of <code>a</code>
so that the diagonal elements of <code>r</code> are in decreasing magnitude.
To trigger this form of the decomposition, a third argument is
required, which records the permutation applied to the argument <code>a</code>.
The compact version is
<PRE>
  [q,r,e] = qr(a,0)
</PRE>
<P>
where <code>e</code> is an integer vector that describes the permutation of
the columns of <code>a</code> necessary to reorder the diagonal elements of
<code>r</code>.  This result is computed using the LAPACK routines <code>(s,d)geqp3</code>.
In the non-compact version of the QR decomposition with pivoting,
<PRE>
  [q,r,e] = qr(a)
</PRE>
<P>
the returned matrix <code>e</code> is a permutation matrix, such that 
<code>q*r*e' = a</code>.
</BODY>
</HTML>