~ubuntu-branches/ubuntu/raring/scilab/raring-proposed

« back to all changes in this revision

Viewing changes to modules/linear_algebra/help/en_US/linear/qr.xml

  • Committer: Package Import Robot
  • Author(s): Sylvestre Ledru
  • Date: 2012-08-30 14:42:38 UTC
  • mfrom: (1.4.7)
  • Revision ID: package-import@ubuntu.com-20120830144238-c1y2og7dbm7m9nig
Tags: 5.4.0-beta-3-1~exp1
* New upstream release
* Update the scirenderer dep
* Get ride of libjhdf5-java dependency

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
<?xml version="1.0" encoding="UTF-8"?>
 
2
<!--
 
3
 * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
 
4
 * Copyright (C) 2008 - INRIA
 
5
 * 
 
6
 * This file must be used under the terms of the CeCILL.
 
7
 * This source file is licensed as described in the file COPYING, which
 
8
 * you should have received as part of this distribution.  The terms
 
9
 * are also available at    
 
10
 * http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt
 
11
 *
 
12
 -->
 
13
<refentry xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:svg="http://www.w3.org/2000/svg" xmlns:mml="http://www.w3.org/1998/Math/MathML" xmlns:db="http://docbook.org/ns/docbook" version="5.0-subset Scilab" xml:lang="en" xml:id="qr">
 
14
    <refnamediv>
 
15
        <refname>qr</refname>
 
16
        <refpurpose> QR decomposition</refpurpose>
 
17
    </refnamediv>
 
18
    <refsynopsisdiv>
 
19
        <title>Calling Sequence</title>
 
20
        <synopsis>[Q,R]=qr(X [,"e"])
 
21
            [Q,R,E]=qr(X [,"e"])
 
22
            [Q,R,rk,E]=qr(X [,tol])
 
23
        </synopsis>
 
24
    </refsynopsisdiv>
 
25
    <refsection>
 
26
        <title>Arguments</title>
 
27
        <variablelist>
 
28
            <varlistentry>
 
29
                <term>X</term>
 
30
                <listitem>
 
31
                    <para>real or complex matrix</para>
 
32
                </listitem>
 
33
            </varlistentry>
 
34
            <varlistentry>
 
35
                <term>tol</term>
 
36
                <listitem>
 
37
                    <para>nonnegative real number</para>
 
38
                </listitem>
 
39
            </varlistentry>
 
40
            <varlistentry>
 
41
                <term>Q</term>
 
42
                <listitem>
 
43
                    <para>square orthogonal or unitary matrix</para>
 
44
                </listitem>
 
45
            </varlistentry>
 
46
            <varlistentry>
 
47
                <term>R</term>
 
48
                <listitem>
 
49
                    <para>
 
50
                        matrix with same dimensions as <literal>X</literal>
 
51
                    </para>
 
52
                </listitem>
 
53
            </varlistentry>
 
54
            <varlistentry>
 
55
                <term>E</term>
 
56
                <listitem>
 
57
                    <para>permutation matrix</para>
 
58
                </listitem>
 
59
            </varlistentry>
 
60
            <varlistentry>
 
61
                <term>rk</term>
 
62
                <listitem>
 
63
                    <para>
 
64
                        integer (QR-rank of <literal>X</literal>)
 
65
                    </para>
 
66
                </listitem>
 
67
            </varlistentry>
 
68
        </variablelist>
 
69
    </refsection>
 
70
    <refsection>
 
71
        <title>Description</title>
 
72
        <variablelist>
 
73
            <varlistentry>
 
74
                <term>[Q,R] = qr(X)</term>
 
75
                <listitem>
 
76
                    <para>
 
77
                        produces an upper triangular matrix <literal>R</literal> of the same dimension as <literal>X</literal> and an orthogonal (unitary in the complex case) matrix <literal>Q</literal> so that <literal>X = Q*R</literal>. <literal>[Q,R] = qr(X,"e")</literal> produces an "economy size": If <literal>X</literal> is m-by-n with m &gt; n, then only the first n columns of <literal>Q</literal>  are computed as well as the first n rows of <literal>R</literal>.
 
78
                    </para>
 
79
                    <para>
 
80
                        From <literal>Q*R = X</literal> , it follows that
 
81
                        the kth column of the matrix <literal>X</literal>, is expressed as a linear combination
 
82
                        of the k first columns of <literal>Q</literal> (with coefficients <literal> R(1,k), ..., R(k,k) </literal>). The  k first columns of <literal>Q</literal> make an orthogonal basis
 
83
                        of the subspace spanned by the k first comumns of <literal>X</literal>. If column <literal>k</literal>
 
84
                        of <literal>X</literal> (i.e. <literal>X(:,k)</literal> ) is a linear combination of the first 
 
85
                        <literal>p</literal> columns of <literal>X</literal>, then the entries <literal>R(p+1,k), ..., R(k,k)</literal>
 
86
                        are zero. It this situation, <literal>R</literal> is upper trapezoidal. If <literal>X</literal> has
 
87
                        rank <literal>rk</literal>, rows <literal>R(rk+1,:), R(rk+2,:), ...</literal> are zeros.
 
88
                    </para>
 
89
                </listitem>
 
90
            </varlistentry>
 
91
            <varlistentry>
 
92
                <term>[Q,R,E] = qr(X)</term>
 
93
                <listitem>
 
94
                    <para>
 
95
                        produces a (column) permutation matrix <literal>E</literal>, an upper
 
96
                        triangular <literal>R</literal> with decreasing diagonal elements and an
 
97
                        orthogonal (or unitary) <literal>Q</literal> so that <literal>X*E =    Q*R</literal>. 
 
98
                        If <literal>rk</literal> is the rank of <literal>X</literal>, the
 
99
                        <literal>rk</literal> first  entries along the main diagonal of
 
100
                        <literal>R</literal>, i.e. <literal>R(1,1), R(2,2), ..., R(rk,rk)</literal>
 
101
                        are all different from zero.  <literal>[Q,R,E] =  qr(X,"e")</literal> 
 
102
                        produces an "economy size":
 
103
                        If <literal>X</literal> is m-by-n with m &gt; n, then only the first n
 
104
                        columns of <literal>Q</literal>  are computed as well as the first n
 
105
                        rows of <literal>R</literal>. 
 
106
                    </para>
 
107
                </listitem>
 
108
            </varlistentry>
 
109
            <varlistentry>
 
110
                <term>[Q,R,rk,E] = qr(X ,tol)</term>
 
111
                <listitem>
 
112
                    <para>
 
113
                        returns <literal>rk</literal> = rank estimate of <literal>X</literal> i.e. <literal>rk</literal> is the number of diagonal elements in <literal>R</literal> which are larger than a given threshold <literal>tol</literal>.
 
114
                    </para>
 
115
                </listitem>
 
116
            </varlistentry>
 
117
            <varlistentry>
 
118
                <term>[Q,R,rk,E] = qr(X) </term>
 
119
                <listitem>
 
120
                    <para>
 
121
                        returns <literal>rk</literal> = rank estimate of <literal>X</literal>
 
122
                        i.e. <literal>rk</literal> is the number of diagonal elements in
 
123
                        <literal>R</literal> which are larger than
 
124
                        <literal>tol=R(1,1)*%eps*max(size(R))</literal>. See <literal>rankqr</literal>
 
125
                        for a rank revealing QR factorization, using the condition number
 
126
                        of <literal>R</literal>.
 
127
                    </para>
 
128
                </listitem>
 
129
            </varlistentry>
 
130
        </variablelist>
 
131
    </refsection>
 
132
    <refsection>
 
133
        <title>Examples</title>
 
134
        <programlisting role="example"><![CDATA[ 
 
135
// QR factorization, generic case
 
136
// X is tall (full rank)
 
137
X=rand(5,2);[Q,R]=qr(X); [Q'*X R]
 
138
 
 
139
//X is fat (full rank)
 
140
X=rand(2,3);[Q,R]=qr(X); [Q'*X R]
 
141
 
 
142
//Column 4 of X is a linear combination of columns 1 and 2:
 
143
X=rand(8,5);X(:,4)=X(:,1)+X(:,2); [Q,R]=qr(X); R, R(:,4)
 
144
 
 
145
//X has rank 2, rows 3 to $ of R are zero:
 
146
X=rand(8,2)*rand(2,5);[Q,R]=qr(X); R
 
147
 
 
148
//Evaluating the rank rk: column pivoting ==> rk first
 
149
//diagonal entries of R are non zero :
 
150
A=rand(5,2)*rand(2,5);
 
151
[Q,R,rk,E] = qr(A,1.d-10);
 
152
norm(Q'*A-R)
 
153
svd([A,Q(:,1:rk)])    //span(A) =span(Q(:,1:rk))
 
154
 ]]></programlisting>
 
155
    </refsection>
 
156
    <refsection role="see also">
 
157
        <title>See Also</title>
 
158
        <simplelist type="inline">
 
159
            <member>
 
160
                <link linkend="rankqr">rankqr</link>
 
161
            </member>
 
162
            <member>
 
163
                <link linkend="rank">rank</link>
 
164
            </member>
 
165
            <member>
 
166
                <link linkend="svd">svd</link>
 
167
            </member>
 
168
            <member>
 
169
                <link linkend="rowcomp">rowcomp</link>
 
170
            </member>
 
171
            <member>
 
172
                <link linkend="colcomp">colcomp</link>
 
173
            </member>
 
174
        </simplelist>
 
175
    </refsection>
 
176
    <refsection>
 
177
        <title>Used Functions</title>
 
178
        <para>
 
179
            qr decomposition is based  the Lapack routines DGEQRF, DGEQPF,
 
180
            DORGQR for the real matrices and  ZGEQRF, ZGEQPF, ZORGQR for the
 
181
            complex case.
 
182
        </para>
 
183
    </refsection>
 
184
</refentry>