translation updated for sparse.
[scilab.git] / scilab / modules / sparse / help / ja_JP / iterativesolvers / pcg.xml
1 <?xml version="1.0" encoding="UTF-8"?>
2
3 <!--
4  * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
5  * Copyright (C) XXXX-2008 - INRIA
6  * 
7  * This file must be used under the terms of the CeCILL.
8  * This source file is licensed as described in the file COPYING, which
9  * you should have received as part of this distribution.  The terms
10  * are also available at    
11  * http://www.cecill.info/licences/Licence_CeCILL_V2.1-en.txt
12  *
13  -->
14
15 <refentry xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:svg="http://www.w3.org/2000/svg" xmlns:ns4="http://www.w3.org/1999/xhtml" xmlns:mml="http://www.w3.org/1998/Math/MathML" xmlns:db="http://docbook.org/ns/docbook" xmlns:scilab="http://www.scilab.org" xml:id="pcg" xml:lang="ja">
16     
17     <refnamediv>
18         
19         <refname>pcg</refname>
20         
21         <refpurpose>プリコンディショナ付き共役勾配法</refpurpose>
22         
23     </refnamediv>
24     
25     <refsynopsisdiv>
26         
27         <title>呼び出し手順</title>
28         
29         <synopsis>[x, flag, err, iter, res] = pcg(A, b [, tol [, maxIter [, M [, M2 [, x0 [, verbose]]]]]])
30             
31             [x, flag, err, iter, res] = pcg(A, b [key=value,...])
32             
33         </synopsis>
34         
35     </refsynopsisdiv>
36     
37     <refsection>
38         
39         <title>引数</title>
40         
41         <variablelist>
42             
43             <varlistentry>
44                 
45                 <term>A</term>
46                 
47                 <term/>
48                 
49                 <listitem>
50                     
51                     <para>
52                         
53                         行列, または指定した<literal>x</literal>について
54                         
55                         <literal>A*x</literal>を計算する関数またはリスト.
56                         
57                         以下にAの型に応じたA*xの計算に関する説明を示します.
58                         
59                     </para>
60                     
61                     <itemizedlist>
62                         
63                         <listitem>
64                             
65                             <para>
66                                 
67                                 <literal>行列.</literal>Aが行列の場合, 通常の行列
68                                 
69                                 または疎行列とすることができます
70                                 
71                             </para>
72                             
73                         </listitem>
74                         
75                         <listitem>
76                             
77                             <para>
78                                 
79                                 <literal>関数.</literal>Aが関数の場合, 
80                                 
81                                 以下のヘッダーを有する必要があります :
82                                 
83                             </para>
84                             
85                             <programlisting role=""><![CDATA[ 
86 function y = A ( x )
87  ]]></programlisting>
88                             
89                         </listitem>
90                         
91                         <listitem>
92                             
93                             <para>
94                                 
95                                 <literal>list.</literal> Aがリストの場合, 
96                                 
97                                 リストの最初の要素は関数で,リストのその他の
98                                 
99                                 要素(インデックス2から末尾まで)は関数の引数となります.
100                                 
101                                 関数がコールされる時,
102                                 
103                                 xのカレントの値は関数に最初の引数として渡されます.
104                                 
105                                 他の引数はリストに指定された値です.
106                                 
107                             </para>
108                             
109                         </listitem>
110                         
111                     </itemizedlist>
112                     
113                 </listitem>
114                 
115             </varlistentry>
116             
117             <varlistentry>
118                 
119                 <term>b</term>
120                 
121                 <listitem>
122                     
123                     <para>右辺ベクトルr (大きさ: nx1)</para>
124                     
125                 </listitem>
126                 
127             </varlistentry>
128             
129             <varlistentry>
130                 
131                 <term>tol</term>
132                 
133                 <listitem>
134                     
135                     <para>相対許容誤差 (デフォルト: 1e-8). 
136                         
137                         終了条件は残差r=b-Axの2次ノルムを
138                         
139                         右辺bの2次ノルムで割った値に基づきます.
140                         
141                     </para>
142                     
143                 </listitem>
144                 
145             </varlistentry>
146             
147             <varlistentry>
148                 
149                 <term>maxIter</term>
150                 
151                 <listitem>
152                     
153                     <para>反復最大回数 (デフォルト: n)</para>
154                     
155                 </listitem>
156                 
157             </varlistentry>
158             
159             <varlistentry>
160                 
161                 <term>M</term>
162                 
163                 <listitem>
164                     
165                     <para>プリコンディショナ: 通常の行列または疎行列または
166                         
167                         <literal>M\x</literal>を返す関数 (デフォルト: none)
168                         
169                     </para>
170                     
171                 </listitem>
172                 
173             </varlistentry>
174             
175             <varlistentry>
176                 
177                 <term>M2</term>
178                 
179                 <listitem>
180                     
181                     <para>プリコンディショナ: 通常の行列または疎行列または
182                         
183                         <literal>x</literal>について<literal>M2\x</literal>を返す関数 (デフォルト:
184                         
185                         none)
186                         
187                     </para>
188                     
189                 </listitem>
190                 
191             </varlistentry>
192             
193             <varlistentry>
194                 
195                 <term>x0</term>
196                 
197                 <listitem>
198                     
199                     <para>初期推定ベクトル (デフォルト: zeros(n,1))</para>
200                     
201                 </listitem>
202                 
203             </varlistentry>
204             
205             <varlistentry>
206                 
207                 <term>verbose</term>
208                 
209                 <listitem>
210                     
211                     <para>冗長なログを有効にする場合は1に設定(デフォルト 0)</para>
212                     
213                 </listitem>
214                 
215             </varlistentry>
216             
217             <varlistentry>
218                 
219                 <term>x</term>
220                 
221                 <listitem>
222                     
223                     <para>解ベクトル</para>
224                     
225                 </listitem>
226                 
227             </varlistentry>
228             
229             <varlistentry>
230                 
231                 <term>flag</term>
232                 
233                 <listitem>
234                     
235                     <para>
236                         
237                         <literal>maxi</literal>回の反復回数内に
238                         
239                         <literal>pcg</literal>が指定した
240                         
241                         許容誤差に収束する場合に 0, そうでない場合に 1
242                         
243                     </para>
244                     
245                 </listitem>
246                 
247             </varlistentry>
248             
249             <varlistentry>
250                 
251                 <term>err</term>
252                 
253                 <listitem>
254                     
255                     <para>
256                         
257                         最終残差相対ノルム (右辺bの2次ノルムが使用されます)
258                         
259                     </para>
260                     
261                 </listitem>
262                 
263             </varlistentry>
264             
265             <varlistentry>
266                 
267                 <term>iter</term>
268                 
269                 <listitem>
270                     
271                     <para>実行された反復回数</para>
272                     
273                 </listitem>
274                 
275             </varlistentry>
276             
277             <varlistentry>
278                 
279                 <term>res</term>
280                 
281                 <listitem>
282                     
283                     <para>残差相対ノルムのベクトル</para>
284                     
285                 </listitem>
286                 
287             </varlistentry>
288             
289         </variablelist>
290         
291     </refsection>
292     
293     <refsection>
294         
295         <title>説明</title>
296         
297         <para>
298             
299             プリコンディショナ有りまたは無しの
300             
301             共役勾配法により線形システム<literal>Ax=b</literal>を解きます.
302             
303             プリコンディショナは,
304             
305             対称正定行列<literal>M</literal>
306             
307             または<literal>M=M1*M2</literal>となるような
308             
309             2つの行列<literal>M1</literal> および<literal>M2</literal>
310             
311             により定義されます.
312             
313             この場合,関数は<literal>inv(M)*A*x = inv(M)*b</literal>を
314             
315             <literal>x</literal>について解きます.
316             
317             <literal>M</literal>, <literal>M1</literal>および
318             
319             <literal>M2</literal> は,対応する左除算
320             
321             <literal>y=Mi\x</literal>を計算する
322             
323             呼び出し手順<literal>y=Milx(x)</literal>を有する
324             
325             Scilab関数とすることができます.
326             
327         </para>
328         
329         <para>
330             
331             <literal>A</literal>行列は対称正定行列
332             
333             (通常の行列または疎行列)または
334             
335             <literal>y=A*x</literal>を計算する
336             
337             呼び出し手順<literal>y=Ax(x)</literal>を有する関数と
338             
339             する必要があります.
340             
341         </para>
342         
343     </refsection>
344     
345     <refsection>
346         
347         <title>良好な条件または悪い条件の問題の例</title>
348         
349         <para>
350             
351             以下の例では,2つの線形システムを解きます.
352             
353             最初の行列の条件数は ~0.02 に等しくなり,
354             
355             アルゴリズムはちょうど10回の反復で収束します.
356             
357             これが行列の大きさの場合,共役勾配法で指定される動作となります.
358             
359             後者は,条件数1.d-6に等しくなり,22回の反復で収束します.
360             
361             これは,パラメータ maxIterを30に設定する理由です.
362             
363             "key=value" 構文のその他の例については以下を参照ください. 
364             
365         </para>
366         
367         <programlisting role="example"><![CDATA[ 
368 //良い条件の例
369 A=[ 94  0   0   0    0   28  0   0   32  0  
370      0   59  13  5    0   0   0   10  0   0  
371      0   13  72  34   2   0   0   0   0   65 
372      0   5   34  114  0   0   0   0   0   55 
373      0   0   2   0    70  0   28  32  12  0  
374      28  0   0   0    0   87  20  0   33  0  
375      0   0   0   0    28  20  71  39  0   0  
376      0   10  0   0    32  0   39  46  8   0  
377      32  0   0   0    12  33  0   8   82  11 
378      0   0   65  55   0   0   0   0   11  100];
379 b=ones(10,1);
380 [x, fail, err, iter, res]=pcg(A,b,1d-12,15);
381 mprintf("      fail=%d, iter=%d, errrel=%e\n",fail,iter,err)
382 //悪い条件の例
383 A=[ 894     0   0     0   0   28  0   0   1000  70000
384       0      5   13    5   0   0   0   0   0     0    
385       0      13  72    34  0   0   0   0   0     6500 
386       0      5   34    1   0   0   0   0   0     55   
387       0      0   0     0   70  0   28  32  12    0    
388       28     0   0     0   0   87  20  0   33    0    
389       0      0   0     0   28  20  71  39  0     0    
390       0      0   0     0   32  0   39  46  8     0    
391       1000   0   0     0   12  33  0   8   82    11   
392       70000  0   6500  55  0   0   0   0   11    100];
393 [x, fail, err, iter, res]=pcg(A,b,maxIter=30,tol=1d-12);
394 mprintf("      fail=%d, iter=%d, errrel=%e\n",fail,iter,err)
395  ]]></programlisting>
396         
397     </refsection>
398     
399     <refsection>
400         
401         <title>Aを疎行列または関数またはリストとして指定する例</title>
402         
403         <para>以下の例では,疎行列を同時に処理する方法を示します.
404             
405             右辺を計算する関数が "pcg" プリミティブに指定される
406             
407             場合も示します.
408             
409             この例における最後のケースでは,
410             
411             リストがプリミティブに指定される場合です.
412             
413         </para>
414         
415         <programlisting role="example"><![CDATA[ 
416 //良い条件の例
417 A=[ 94  0   0   0    0   28  0   0   32  0  
418      0   59  13  5    0   0   0   10  0   0  
419      0   13  72  34   2   0   0   0   0   65 
420      0   5   34  114  0   0   0   0   0   55 
421      0   0   2   0    70  0   28  32  12  0  
422      28  0   0   0    0   87  20  0   33  0  
423      0   0   0   0    28  20  71  39  0   0  
424      0   10  0   0    32  0   39  46  8   0  
425      32  0   0   0    12  33  0   8   82  11 
426      0   0   65  55   0   0   0   0   11  100];
427 b=ones(10,1);
428 // Aを疎行列に変換
429 Asparse=sparse(A);
430 [x, fail, err, iter, res]=pcg(Asparse,b,maxIter=30,tol=1d-12);
431 mprintf("      fail=%d, iter=%d, errrel=%e\n",fail,iter,err)
432 // 右辺を計算する関数を定義.
433 function y=Atimesx(x)
434   A=[ 94  0   0   0    0   28  0   0   32  0  
435        0   59  13  5    0   0   0   10  0   0  
436        0   13  72  34   2   0   0   0   0   65
437        0   5   34  114  0   0   0   0   0   55
438        0   0   2   0    70  0   28  32  12  0
439        28  0   0   0    0   87  20  0   33  0
440        0   0   0   0    28  20  71  39  0   0
441        0   10  0   0    32  0   39  46  8   0
442        32  0   0   0    12  33  0   8   82  11
443        0   0   65  55   0   0   0   0   11  100];
444   y=A*x
445 endfunction
446 // スクリプトAtimesx をプリミティブに指定
447 [x, fail, err, iter, res]=pcg(Atimesx,b,maxIter=30,tol=1d-12);
448 mprintf("      fail=%d, iter=%d, errrel=%e\n",fail,iter,err)
449 // 右辺を計算する関数を定義.
450 function y=Atimesxbis(x,A)
451   y=A*x
452 endfunction
453 // リストをプリミティブに指定
454 Alist = list(Atimesxbis,Asparse);
455 [x, fail, err, iter, res]=pcg(Alist,b,maxIter=30,tol=1d-12);
456 mprintf("      fail=%d, iter=%d, errrel=%e\n",fail,iter,err)
457  ]]></programlisting>
458         
459     </refsection>
460     
461     <refsection>
462         
463         <title>key=value構文の例</title>
464         
465         <para>
466             
467             以下の例では"key=value"構文により引数を指定する方法を示します.
468             
469             これにより,位置を固定せずに引数を設定できるようになり,
470             
471             引数のリストにおいてその順番に依存せずに引数を設定できます.
472             
473             利用可能なキーはオプションの引数の名前で,以下に示します:
474             
475             tol, maxIter, %M, %M2, x0, verbose. 
476             
477             以下の例では,
478             
479             maxIterオプションの前にverboseオプションを指定します.
480             
481             "key=value" 構文ではなく,
482             
483             位置を指定する引数の場合は,
484             
485             maxIterを最初にverboseを後に指定する必要があります.
486             
487         </para>
488         
489         <programlisting role="example"><![CDATA[ 
490 // 引数をkey=value構文で指定する例
491 A=[100,1;1,10];
492 b=[101;11];
493 [xcomputed, flag, err, iter, res]=pcg(A,b,verbose=1);
494 // key=value構文では, 順番は関係ありません
495 [xcomputed, flag, err, iter, res]=pcg(A,b,verbose=1,maxIter=0);
496  ]]></programlisting>
497         
498     </refsection>
499     
500     <refsection role="see also">
501         
502         <title>参照</title>
503         
504         <simplelist type="inline">
505             
506             <member>
507                 
508                 <link linkend="conjgrad">conjgrad</link>
509                 
510             </member>
511             
512             <member>
513                 
514                 <link linkend="backslash">backslash</link>
515                 
516             </member>
517             
518             <member>
519                 
520                 <link linkend="qmr">qmr</link>
521                 
522             </member>
523             
524             <member>
525                 
526                 <link linkend="gmres">gmres</link>
527                 
528             </member>
529             
530         </simplelist>
531         
532     </refsection>
533     
534     <refsection>
535         
536         <title>参考文献</title>
537         
538         <para>"Templates for the Solution of Linear Systems: Building Blocks for
539             
540             Iterative Methods", Barrett, Berry, Chan, Demmel, Donato, Dongarra,
541             
542             Eijkhout, Pozo, Romine, and Van der Vorst, SIAM Publications, 1993, ftp
543             
544             netlib2.cs.utk.edu/linalg/templates.ps
545             
546         </para>
547         
548         <para>"Iterative Methods for Sparse Linear Systems, Second Edition", Saad,
549             
550             SIAM Publications, 2003, ftp
551             
552             ftp.cs.umn.edu/dept/users/saad/PS/all_ps.zip
553             
554         </para>
555         
556     </refsection>
557     
558     <refsection>
559         
560         <title>履歴</title>
561         
562         <revhistory>
563             
564             <revision>
565                 
566                 <revnumber>5.5.0</revnumber>
567                 
568                 <revdescription>
569                     
570                     pcg(A, b, ...) のコールは廃止されました. 
571                     
572                     代わりに conjgrad(A, b, "pcg", ...) を使用してください.
573                     
574                 </revdescription>
575                 
576             </revision>
577             
578         </revhistory>
579         
580     </refsection>
581     
582 </refentry>
583