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
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
|
<?xml version="1.0" encoding="UTF-8"?>
<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" xmlns:scilab="http://www.scilab.org" xml:lang="en" xml:id="cond2sp">
<refnamediv>
<refname>cond2sp</refname>
<refpurpose>computes an approximation of the 2-norm condition number of a s.p.d. sparse matrix </refpurpose>
</refnamediv>
<refsynopsisdiv>
<title>Calling Sequence</title>
<synopsis>[K2, lm, vm, lM, vM] = cond2sp(A, C_ptr [, rtol, itermax, verb])</synopsis>
</refsynopsisdiv>
<refsection>
<title>Arguments</title>
<variablelist>
<varlistentry>
<term>A </term>
<listitem>
<para>a real symmetric positive definite sparse matrix</para>
</listitem>
</varlistentry>
<varlistentry>
<term>C_ptr </term>
<listitem>
<para>a pointer to a Cholesky factorization (got with taucs_chfact)</para>
</listitem>
</varlistentry>
<varlistentry>
<term>rtol </term>
<listitem>
<para>(optional) relative tolerance (default 1.e-3) (see details in DESCRIPTION)</para>
</listitem>
</varlistentry>
<varlistentry>
<term>itermax </term>
<listitem>
<para>(optional) maximum number of iterations in the underlying algorithms (default 30)</para>
</listitem>
</varlistentry>
<varlistentry>
<term>verb </term>
<listitem>
<para>(optional) boolean, must be %t for displaying the intermediary results, and %f (default) if you do not want.</para>
</listitem>
</varlistentry>
<varlistentry>
<term>K2 </term>
<listitem>
<para>
estimated 2-norm condition number <literal>K2 = ||A||_2 ||A^(-1)||_2 = lM/lm</literal>
</para>
</listitem>
</varlistentry>
<varlistentry>
<term>lm </term>
<listitem>
<para>(real positive scalar) minimum eigenvalue</para>
</listitem>
</varlistentry>
<varlistentry>
<term>vm </term>
<listitem>
<para>associated eigenvector</para>
</listitem>
</varlistentry>
<varlistentry>
<term>lM </term>
<listitem>
<para>(real positive scalar) maximum eigenvalue</para>
</listitem>
</varlistentry>
<varlistentry>
<term>vM </term>
<listitem>
<para>associated eigenvector</para>
</listitem>
</varlistentry>
</variablelist>
</refsection>
<refsection>
<title>Description</title>
<para>
This quick and dirty function computes <literal>(lM,vM)</literal> using the iterative
power method and <literal>(lm,vm)</literal> with the inverse iterative power method, then
<literal>K2 = lM/lm</literal>. For each method the iterations are stopped until the following
condition is met :
</para>
<programlisting role=""><![CDATA[
| (l_new - l_old)/l_new | < rtol
]]></programlisting>
<para>
but 4 iterations are nevertheless required and also the iterations are stopped
if itermax is reached (and a warning message is issued). As the matrix is symmetric
this is the rayleigh quotient which gives the estimated eigenvalue at each step
(<literal>lambda = v'*A*v</literal>). You may called this function with named parameter, for
instance if you want to see the intermediary result without setting yourself the
rtol and itermax parameters you may called this function with the syntax :
</para>
<programlisting role=""><![CDATA[
[K2, lm, vm, lM, vM] = cond2sp(A , C_ptr, verb=%t )
]]></programlisting>
</refsection>
<refsection>
<title>Caution</title>
<para>
Currently there is no verification for the input parameters !
</para>
</refsection>
<refsection>
<title>Remark</title>
<para>
This function is intended to get an approximation of the 2-norm condition number (K2) and
with the methods used, the precision on the obtained eigenvectors (vM and vm) are generally
not very good. If you look for a smaller residual <literal>||Av - l*v||</literal>, you may apply some inverse
power iterations from v0 with the matrix :
</para>
<programlisting role=""><![CDATA[
B = A - l0*speye(A)
]]></programlisting>
<para>
For instance, applied 5 such iterations for <literal>(lm,vm)</literal> is done with :
</para>
<programlisting role="example"><![CDATA[
[A] = ReadHBSparse(SCI+"/modules/umfpack/examples/bcsstk24.rsa");
C_ptr = taucs_chfact(A);
[K2, lm, vm, lM, vM] = cond2sp(A , C_ptr, 1.e-5, 50, %t );
taucs_chdel(C_ptr)
l0 = lm ; v0 = vm; // or l0 = lM ; v0 = vM; // to polish (lM,vM)
B = A - l0*speye(A);
LUp = umf_lufact(B);
vr = v0; nstep = 5;
for i=1:nstep, vr = umf_lusolve(LUp, vr, "Ax=b", B); vr = vr/norm(vr) ; end
umf_ludel(LUp); // if you do not use anymore this factorization
lr = vr'*A*vr;
norm_r0 = norm(A*v0 - l0*v0);
norm_rr = norm(A*vr - lr*vr);
// Bauer-Fike error bound...
mprintf(" first estimated eigenvalue : l0 = %e \n\t", l0)
mprintf(" |l-l0| <= ||Av0-l0v0|| = %e , |l-l0|/l0 <= %e \n\r", norm_r0, norm_r0/l0)
mprintf(" raffined estimated eigenvalue : lr = %e \n\t", lr)
mprintf(" |l-lr| <= ||Avr-lrvr|| = %e , |l-lr|/lr <= %e \n\r", norm_rr, norm_rr/lr)
]]></programlisting>
</refsection>
<refsection>
<title>Examples</title>
<programlisting role="example"><![CDATA[
[A] = ReadHBSparse(SCI+"/modules/umfpack/examples/bcsstk24.rsa");
C_ptr = taucs_chfact(A);
[K2, lm, vm, lM, vM] = cond2sp(A , C_ptr, 1.e-5, 50, %t );
taucs_chdel(C_ptr)
]]></programlisting>
</refsection>
<refsection role="see also">
<title>See Also</title>
<simplelist type="inline">
<member>
<link linkend="condestsp">condestsp</link>
</member>
<member>
<link linkend="taucs_chfact">taucs_chfact</link>
</member>
<member>
<link linkend="rcond">rcond</link>
</member>
</simplelist>
</refsection>
</refentry>
|