[doc] unwrap_2D.png moved in [elementary_functions]
[scilab.git] / scilab / modules / elementary_functions / help / ja_JP / extraction.xml
1 <?xml version="1.0" encoding="UTF-8"?>
2
3 <refentry xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:svg="http://www.w3.org/2000/svg" xmlns:ns5="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="extraction" xml:lang="ja">
4
5     <refnamediv>
6
7         <refname>extraction</refname>
8
9         <refpurpose>行列およびリストのエントリの展開</refpurpose>
10
11     </refnamediv>
12
13     <refsynopsisdiv>
14
15         <title>呼出し手順</title>
16
17         <synopsis>
18
19             x(i)
20
21             x(i,j)
22
23             x(i,j,k,..)
24
25             [...]=l(i)
26
27             [...]=l(k1)...(kn)(i) または [...]=l(list(k1,...,kn,i))
28
29             l(k1)...(kn)(i,j) または l(list(k1,...,kn,list(i,j))
30
31         </synopsis>
32
33     </refsynopsisdiv>
34
35     <refsection>
36
37         <title>引数</title>
38
39         <variablelist>
40
41             <varlistentry>
42
43                 <term>x</term>
44
45                 <listitem>
46
47                     <para>任意の型の行列</para>
48
49                 </listitem>
50
51             </varlistentry>
52
53             <varlistentry>
54
55                 <term>l</term>
56
57                 <listitem>
58
59                     <para>リスト変数</para>
60
61                 </listitem>
62
63             </varlistentry>
64
65             <varlistentry>
66
67                 <term>i,j, k</term>
68
69                 <listitem>
70
71                     <para>添え字</para>
72
73                 </listitem>
74
75             </varlistentry>
76
77             <varlistentry>
78
79                 <term>k1,...kn</term>
80
81                 <listitem>
82
83                     <para>添え字</para>
84
85                 </listitem>
86
87             </varlistentry>
88
89         </variablelist>
90
91     </refsection>
92
93     <refsection>
94
95         <title>説明</title>
96
97         <variablelist>
98
99             <varlistentry>
100
101                 <term>行列の場合</term>
102
103                 <listitem>
104
105                     <para>
106
107                         <literal>i</literal>, <literal>j</literal>,
108
109                         <literal>k</literal>,.. は以下のようになります:
110
111                     </para>
112
113                     <variablelist>
114
115                         <varlistentry>
116
117                             <term>
118
119                                 正の要素を有する実数のスカラーまたはベクトルまたは行列.
120
121                             </term>
122
123                             <listitem>
124
125                                 <itemizedlist>
126
127                                     <listitem>
128
129                                         <para>
130
131                                             <literal>r=x(i,j)</literal> は,
132
133                                             1 から<literal>size(i,'*')</literal>の
134
135                                             <literal>l</literal>および
136
137                                             1 から <literal>size(j,'*')</literal>の
138
139                                             <literal>k</literal>について
140
141                                             <literal>r(l,k)=x(int(i(l)),int(j(k)))</literal>となるような
142
143                                             行列<literal>r</literal>を作成します.
144
145                                         </para>
146
147                                         <para>
148
149                                             <literal>i</literal> (<literal>j</literal>) の
150
151                                             最大値は<literal>size(x,1)</literal>
152
153                                             (<literal>size(x,2)</literal>)以下とする必要があります.
154
155                                         </para>
156
157                                     </listitem>
158
159                                     <listitem>
160
161                                         <para>
162
163                                             1x1行列 <literal>x</literal>を指定した
164
165                                             <literal>r=x(i)</literal>は,
166
167                                             1 から<literal>size(i,1)</literal>の<literal>l</literal>および
168
169                                             1 から <literal>size(i,2)</literal>の<literal>k</literal>
170
171                                             について, <literal>r(l,k)=x(int(i(l)),int(i(k)))</literal>
172
173                                             となるような
174
175                                             行列 <literal>r</literal> を構築します.
176
177                                         </para>
178
179                                         <para>
180
181                                             この場合,全てのエントリが1に等しい場合にのみ,
182
183                                             添え字 <literal>i</literal>が有効です.
184
185                                         </para>
186
187                                     </listitem>
188
189                                     <listitem>
190
191                                         <para>
192
193                                             <literal>x</literal>を指定した行ベクトル<literal>r=x(i)</literal>は,
194
195                                             1から<literal>size(i,'*')</literal>の<literal>l</literal>
196
197                                             について<literal>r(l)=x(int(i(l)))</literal>となるような
198
199                                             行ベクトル <literal>r</literal>を作成します.
200
201                                             <literal>i</literal>の最大値が
202
203                                             <literal>size(x,'*')</literal>以下とする必要があります.
204
205                                         </para>
206
207                                     </listitem>
208
209                                     <listitem>
210
211                                         <para>
212
213                                             1つ以上の列を有する行列<literal>x</literal>を指定した
214
215                                             <literal>r=x(i)</literal> は,
216
217                                             <literal>r(l)</literal>
218
219                                             (<literal>l</literal>は 1 から <literal>size(i,'*')</literal>)
220
221                                             が <literal>x</literal>の列の結合により作成された
222
223                                             列ベクトルの
224
225                                             エントリ<literal>int(i(l))</literal>を含むような
226
227                                             列ベクトル<literal>r</literal>を作成します.
228
229                                         </para>
230
231                                         <para>
232
233                                             <literal>i</literal> の最大値は
234
235                                             <literal>size(x,'*')</literal>以下である必要があります.
236
237                                         </para>
238
239                                     </listitem>
240
241                                 </itemizedlist>
242
243                             </listitem>
244
245                         </varlistentry>
246
247                         <varlistentry>
248
249                             <term>
250
251                                 記号 <literal> : </literal>
252
253                             </term>
254
255                             <listitem>
256
257                                 <para><literal/>
258
259                                     は "全ての要素"を意味します.
260
261                                 </para>
262
263                                 <itemizedlist>
264
265                                     <listitem>
266
267                                         <para>
268
269                                             <literal>r=x(i,:)</literal> は,
270
271                                             1から<literal>size(i,'*')</literal>の<literal>l</literal>,
272
273                                             1から<literal>size(x,2)</literal>の<literal>k</literal>について,
274
275                                             <literal>r(l,k)=x(int(i(l)),k))</literal>となるような
276
277                                             行列 <literal>r</literal> を作成します.
278
279                                         </para>
280
281                                     </listitem>
282
283                                     <listitem>
284
285                                         <para>
286
287                                             <literal>r=x(:,j)</literal> は,
288
289                                             1から<literal>size(r,1)</literal>の<literal>l</literal>,
290
291                                             1から<literal>size(j,'*')</literal>の<literal>k</literal>について,
292
293                                             <literal>r(l,k)=x(l,int(j(k)))</literal>となるような
294
295                                             行列 <literal>r</literal> を作成します.
296
297                                         </para>
298
299                                     </listitem>
300
301                                     <listitem>
302
303                                         <para>
304
305                                             <literal>r=x(:)</literal> は,
306
307                                             <literal>x</literal>列の列結合により
308
309                                             列ベクトル<literal>r</literal>を作成します.
310
311                                             これは,<literal>matrix(x,size(x,'*'),1)</literal>と等価です.
312
313                                         </para>
314
315                                     </listitem>
316
317                                 </itemizedlist>
318
319                             </listitem>
320
321                         </varlistentry>
322
323                         <varlistentry>
324
325                             <term>論理値のベクトル</term>
326
327                             <listitem>
328
329                                 <para>
330
331                                     添え字 (<literal>i</literal> または
332
333                                     <literal>j</literal> ) が論理値のベクトルの場合,それぞれ
334
335                                     <literal>find(i)</literal>または<literal>find(j)</literal>
336
337                                     として解釈されます.
338
339                                 </para>
340
341                             </listitem>
342
343                         </varlistentry>
344
345                         <varlistentry>
346
347                             <term>多項式</term>
348
349                             <listitem>
350
351                                 <para>
352
353                                     添え字 (<literal>i</literal> または
354
355                                     <literal>j</literal> )が多項式のベクトルまたは
356
357                                     暗黙の多項式ベクトルの場合,それぞれ
358
359                                     <literal>horner(i,m)</literal>または
360
361                                     <literal>horner(j,n)</literal>と解釈されます.
362
363                                     ただし,<literal>m</literal> および<literal>n</literal>
364
365                                     は<literal>x</literal>の次元に関連します.
366
367                                     この機能は全ての多項式に対して動作しますが,
368
369                                     可読性を確保するために, <literal>$</literal>に
370
371                                     多項式を使用することが推奨されます.
372
373                                 </para>
374
375                             </listitem>
376
377                         </varlistentry>
378
379                     </variablelist>
380
381                     <para>
382
383                         2より大きな次元の行列(参照:<link linkend="hypermatrices">ハイパー行列</link>)の場合,
384
385                         最も右の次元が1に等しくなると
386
387                         次元が自動的に縮小されます.
388
389                     </para>
390
391                 </listitem>
392
393             </varlistentry>
394
395             <varlistentry>
396
397                 <term>list または tlist の場合</term>
398
399                 <listitem>
400
401                     <para>
402
403                         指定された場合,
404
405                         <literal>ki</literal>は<literal>l</literal>データ構造
406
407                         のサブリストのエントリへのパスを指定します.
408
409                         これにより,中間的なコピーをすることなく再帰的な展開が
410
411                         可能になります.
412
413                         命令は以下のようになります:
414
415                     </para>
416
417                     <para>
418
419                         <literal>[...]=l(k1)...(kn)(i)</literal>
420
421                     </para>
422
423                     <para>および</para>
424
425                     <para>
426
427                         <literal>[...]=l(list(k1,...,kn,i))</literal>
428
429                     </para>
430
431                     <para>は以下のように解釈されます:</para>
432
433                     <para>
434
435                         <literal>lk1 = l(k1)</literal><literal> .. = .. </literal><literal>lkn = lkn-1(kn)</literal><literal>[...] = lkn(i)</literal>
436
437                         そして,<literal>l(k1)...(kn)(i,j)</literal> および
438
439                     </para>
440
441                     <para>
442
443                         <literal>l(list(k1,...,kn,list(i,j))</literal> 命令は
444
445                         以下のように解釈されます: <literal>lk1 = l(k1)</literal> <literal> .. = ..
446
447                         </literal>
448
449                         <literal>lkn = lkn-1(kn)</literal> <literal>
450
451                             lkn(i,j)
452
453                         </literal>
454
455                         <literal>i</literal> および <literal>j</literal>については後述します.
456
457                         パスが複数のリストの要素を指す場合,
458
459                         この命令は,選択した要素と同じ数の左辺の引数を有する必要があります.
460
461                         しかし,展開構文を関数の中で使用した場合,
462
463                         リストの要素を返す入力の呼出し手順が
464
465                         関数の呼び出し手順に追加されます.
466
467                     </para>
468
469                     <para>
470
471                         <literal> l(list())</literal> は
472
473                         <literal> l</literal>と同じであることに注意してください.
474
475                     </para>
476
477                     <variablelist>
478
479                         <varlistentry>
480
481                             <term>i および j は以下のようになります :</term>
482
483                             <listitem>
484
485                                 <variablelist>
486
487                                     <varlistentry>
488
489                                         <term>正の要素を有する実数のスカラーまたはベクトルまたは行列.</term>
490
491                                         <listitem>
492
493                                             <para>
494
495                                                 <literal>[r1,...rn]=l(i)</literal> は
496
497                                                 リスト l から要素<literal>i(k)</literal>を展開し,これを
498
499                                                 1から<literal>size(i,'*')</literal>までの <literal>k</literal>
500
501                                                 について <literal>rk</literal> に保存します.
502
503                                             </para>
504
505                                         </listitem>
506
507                                     </varlistentry>
508
509                                     <varlistentry>
510
511                                         <term>
512
513                                             記号 <literal> : </literal>
514
515                                         </term>
516
517                                         <listitem>
518
519                                             <para>"全ての要素"を意味します.</para>
520
521                                         </listitem>
522
523                                     </varlistentry>
524
525                                     <varlistentry>
526
527                                         <term>論理値のベクトル.</term>
528
529                                         <listitem>
530
531                                             <para>
532
533                                                 <literal>i</literal> が論理値のベクトルの場合,
534
535                                                 <literal>find(i)</literal>と解釈されます.
536
537                                             </para>
538
539                                         </listitem>
540
541                                     </varlistentry>
542
543                                     <varlistentry>
544
545                                         <term>多項式.</term>
546
547                                         <listitem>
548
549                                             <para>
550
551                                                 <literal>i</literal> が多項式のベクトルまたは
552
553                                                 暗黙の多項式ベクトルの場合,
554
555                                                 <literal>horner(i,m)</literal>として解釈されます.
556
557                                                 ただし,<literal>m=size(l)</literal>です.
558
559                                                 この機能は全ての多項式に関して動作しますが,
560
561                                                 可読性を良くするために,多項式を<literal>$</literal>の
562
563                                                 中で使用することを推奨します.
564
565                                             </para>
566
567                                         </listitem>
568
569                                     </varlistentry>
570
571                                 </variablelist>
572
573                             </listitem>
574
575                         </varlistentry>
576
577                         <varlistentry>
578
579                             <term>k1,..kn は以下のようになります. :</term>
580
581                             <listitem>
582
583                                 <variablelist>
584
585                                     <varlistentry>
586
587                                         <term>実数の正のスカラー,</term>
588
589                                         <listitem>
590
591                                             <para/>
592
593                                         </listitem>
594
595                                     </varlistentry>
596
597                                     <varlistentry>
598
599                                         <term>多項式,</term>
600
601                                         <listitem>
602
603                                             <para>
604
605                                                 は<literal>horner(ki,m)</literal>と解釈されます.
606
607                                                 ただし,<literal>m</literal>は対応するサブリストの大きさです.
608
609                                             </para>
610
611                                         </listitem>
612
613                                     </varlistentry>
614
615                                     <varlistentry>
616
617                                         <term>文字列</term>
618
619                                         <listitem>
620
621                                             <para>サブリストのエントリ名に関連します.</para>
622
623                                         </listitem>
624
625                                     </varlistentry>
626
627                                 </variablelist>
628
629                             </listitem>
630
631                         </varlistentry>
632
633                     </variablelist>
634
635                 </listitem>
636
637             </varlistentry>
638
639         </variablelist>
640
641     </refsection>
642
643     <refsection>
644
645         <title>注意</title>
646
647         <para>
648
649             有理関数や状態空間線形システムのようにソフトウエアで作成される行列の型の場合,
650
651             リストの要素の展開と区別できないため,
652
653             <literal>x(i)</literal> 構文をベクトル要素の展開には使用できない可能性が
654
655             あります.
656
657             この場合,
658
659             <literal>x(1,j)</literal> または <literal>x(i,1)</literal>構文を使用する必要があります.
660
661         </para>
662
663     </refsection>
664
665     <refsection>
666
667         <title>例</title>
668
669         <programlisting role="example"><![CDATA[
670 // 行列の場合
671 a=[1 2 3;4 5 6]
672 a(1,2)
673 a([1 1],2)
674 a(:,1)
675 a(:,3:-1:1)
676 a(1)
677 a(6)
678 a(:)
679 a([%t %f %f %t])
680 a([%t %f],[2 3])
681 a(1:2,$-1)
682 a($:-1:1,2)
683 a($)
684 //
685 x='test'
686 x([1 1;1 1;1 1])
687 //
688 b=[1/%s,(%s+1)/(%s-1)]
689 b(1,1)
690 b(1,$)
691 b(2) // 分子
692 // LIST または TLIST の場合
693 l=list(1,'qwerw',%s)
694 l(1)
695 [a,b]=l([3 2])
696 l($)
697 x=tlist(l(2:3)) // lの末尾2要素を有する tlist を作成
698 //
699 dts=list(1,tlist(['x';'a';'b'],10,[2 3]));
700 dts(2)('a')
701 dts(2)('b')(1,2)
702 [a,b]=dts(2)(['a','b'])
703  ]]></programlisting>
704
705     </refsection>
706
707     <refsection role="see also">
708
709         <title>参照</title>
710
711         <simplelist type="inline">
712
713             <member>
714
715                 <link linkend="find">find</link>
716
717             </member>
718
719             <member>
720
721                 <link linkend="horner">horner</link>
722
723             </member>
724
725             <member>
726
727                 <link linkend="parentheses">parentheses</link>
728
729             </member>
730
731         </simplelist>
732
733     </refsection>
734
735 </refentry>
736