added newly introduced *.xml in 5.5.
[scilab.git] / scilab / modules / elementary_functions / help / ja_JP / setoperations / members.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) 2013 - Samuel GOUGEON
6  * Copyright (C) 2009 - Université du Maine - Samuel GOUGEON
7  *
8  * This file must be used under the terms of the CeCILL.
9  * This source file is licensed as described in the file COPYING, which
10  * you should have received as part of this distribution.  The terms
11  * are also available at
12  * http://www.cecill.info/licences/Licence_CeCILL_V2.1-en.txt
13  *
14  -->
15
16 <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="members" xml:lang="ja">
17     
18     <refnamediv>
19         
20         <refname>members</refname>
21         
22         <refpurpose>
23             
24             配列の各要素または他の配列の行または列を数える(及び位置を調べる)
25             
26         </refpurpose>
27         
28     </refnamediv>
29     
30     <refsynopsisdiv>
31         
32         <title>呼び出し手順</title>
33         
34         <synopsis>
35             
36             [nb [,loc]] = members(N, H)
37             
38             [nb [,loc]] = members(N, H, "last")
39             
40             [nb [,loc]] = members(N, H, "rows"|"cols")
41             
42             [nb [,loc]] = members(N, H, "rows"|"cols", "last")
43             
44             [nb [,loc]] = members(N, H, "rows"|"cols", "shuffle")
45             
46             [nb [,loc]] = members(N, H, "rows"|"cols", "shuffle", "last")
47             
48         </synopsis>
49         
50     </refsynopsisdiv>
51     
52     <refsection>
53         
54         <title>引数</title>
55         
56         <variablelist>
57             
58             <varlistentry>
59                 
60                 <term>N</term>
61                 
62                 <listitem>
63                     
64                     <para>
65                         
66                         Needles: 論理値, 整数エンコードされた数値, 実数または複素数の10進数, 多項式またはテキストの行列またはハイパー行列.
67                         
68                         "rows"または"cols"モードでは,
69                         
70                         ハイパー行列は指定できません.
71                         
72                         指定した値(または行または列)は<literal>N</literal>の中に
73                         
74                         複数回配置することができます.
75                         
76                     </para>
77                     
78                 </listitem>
79                 
80             </varlistentry>
81             
82             <varlistentry>
83                 
84                 <term>H</term>
85                 
86                 <listitem>
87                     
88                     <para>
89                         
90                         Haystack: 
91                         
92                         <literal>N</literal>と同じデータ型の行列またはハイパー行列. 
93                         
94                         "rows" または "cols" モードの場合, ハイパー行列は指定できません.
95                         
96                         <literal>N</literal> および <literal>H</literal>
97                         
98                         はそれぞれ同じ列または行の数を有する必要があります.
99                         
100                     </para>
101                     
102                 </listitem>
103                 
104             </varlistentry>
105             
106             <varlistentry>
107                 
108                 <term>オプション:</term>
109                 
110                 <listitem>
111                     
112                     <para>以下の1から3個のオプションを順を問わず指定可能です:
113                         
114                         <variablelist>
115                             
116                             <varlistentry>
117                                 
118                                 <term>"last"</term>
119                                 
120                                 <listitem>
121                                     
122                                     <para>
123                                         
124                                         <literal>N</literal>から
125                                         
126                                         needlesの<literal>H</literal>の位置を<literal>loc</literal>で
127                                         
128                                         検索した場合,
129                                         
130                                         デフォルトで<literal>H</literal>の中でそれぞれが最初に現れる位置が返されます.
131                                         
132                                     </para>
133                                     
134                                 </listitem>
135                                 
136                             </varlistentry>
137                             
138                             <varlistentry>
139                                 
140                                 <term>"rows", "cols"</term>
141                                 
142                                 <listitem>
143                                     
144                                     <para>
145                                         
146                                         デフォルトで, <literal>N</literal>の各要素<literal>N(i, j, ...)</literal>
147                                         
148                                         は <literal>H</literal>の中で検索する際のneedleとみなされます.
149                                         
150                                         <literal>"rows"</literal> が検索された場合, 
151                                         
152                                         <literal>N</literal>の各行はneedleとみなされ, 全体として,
153                                         
154                                         <literal>H</literal>の行で検索が行われます.
155                                         
156                                         
157                                         
158                                         <literal>"cols"</literal> が使用された場合,
159                                         
160                                         <literal>"cols"</literal>が
161                                         
162                                         <literal>N</literal> 及び <literal>H</literal>の列に適用されます.
163                                         
164                                         
165                                         
166                                         <literal>"cols"</literal> を使用した場合,
167                                         
168                                         <literal>N</literal> 及び <literal>H</literal> の列数と同じ部分に
169                                         
170                                         適用されます.
171                                         
172                                     </para>
173                                     
174                                 </listitem>
175                                 
176                             </varlistentry>
177                             
178                             <varlistentry>
179                                 
180                                 <term>"shuffle"</term>
181                                 
182                                 <listitem>
183                                     
184                                     <para>
185                                         
186                                         <literal>"rows"</literal>または<literal>"cols"</literal> モードの場合, 
187                                         
188                                         行/列の要素のデフォルトの順序が考慮されます: 例えば,<literal>N</literal>
189                                         
190                                         の <literal>[ 7 3 5 ]</literal> は, 
191                                         
192                                         <literal>H</literal>の<literal>[3 5 7]</literal>にマッチしません.
193                                         
194                                         <literal>"shuffle"</literal> が指定された場合, 
195                                         
196                                         
197                                         
198                                         例えば<literal>[3 5 7]</literal>の交換は
199                                         
200                                         <literal>N</literal>の<literal>[3 5 7]</literal>行に一致すると
201                                         
202                                         みなされます.
203                                         
204                                         このオプションは多項式の場合,無視されます.
205                                         
206                                     </para>
207                                     
208                                 </listitem>
209                                 
210                             </varlistentry>
211                             
212                         </variablelist>
213                         
214                     </para>
215                     
216                 </listitem>
217                 
218             </varlistentry>
219             
220             <varlistentry>
221                 
222                 <term>nb</term>
223                 
224                 <listitem>
225                     
226                     <para>
227                         
228                         通常モードの場合: <literal>nb(i, j, ...)</literal> は(実数として)
229                         
230                         <literal>H</literal>における<literal>N(i, j, ...)</literal>の出現回数
231                         
232                         を表します.
233                         
234                         <literal>nb</literal> および <literal>N</literal> は同じ形式です. 
235                         
236                         <literal>H</literal> が空の場合, ゼロ行列が返されます. 
237                         
238                         <literal>N</literal> が空の場合, 空の行列 <literal>[]</literal> が返されます.
239                         
240                     </para>
241                     
242                     <para>
243                         
244                         <literal>"rows"</literal> または <literal>"cols"</literal> モードの場合: 
245                         
246                         <literal>nb</literal> は <literal>N</literal> が有する行/列と同じ数の要素を
247                         
248                         有する実数の行です. 
249                         
250                         <literal>nb(i)</literal> は,<literal>H(., :)</literal> の中で
251                         
252                         <literal>N(i, :)</literal> が生じた数
253                         
254                         (または<literal>H(:, .)</literal>の中で<literal>N(:, i)</literal>)を返します.
255                         
256                     </para>
257                     
258                 </listitem>
259                 
260             </varlistentry>
261             
262             <varlistentry>
263                 
264                 <term>loc</term>
265                 
266                 <listitem>
267                     
268                     <para>
269                         
270                         通常のモードの場合: 
271                         
272                         <literal>loc</literal> および<literal>N</literal> は同じ形式を有します. 
273                         
274                         <literal>loc(i, j, ...)</literal> は,
275                         
276                         <literal>N(i, j, ...)</literal> がある場所として
277                         
278                         <literal>H</literal>に最小の線形化された添字を返します.
279                         
280                         <literal>"last"</literal>フラグが使用された場合,
281                         
282                         替りに最大の線形化された添字の最大値が返されます.
283                         
284                         <literal>H</literal>の中に <literal>N(i, j, ...)</literal>が見つかれない場合,
285                         
286                         <literal>loc(i, j, ...)</literal> は <literal>0</literal>に設定されます.
287                         
288                     </para>
289                     
290                     <para>
291                         
292                         <literal>"rows"</literal> または <literal>"cols"</literal> モードの場合: 
293                         
294                         <literal>loc</literal> は<literal>N</literal>が有する行及び列と同じ
295                         
296                         数の要素を有する実数の行です.
297                         
298                         <literal>loc(i)</literal> は,
299                         
300                         <literal>N(i, :)</literal>に一致する最初の
301                         
302                         行<literal>H(loc(i), :)</literal>の添字
303                         
304                         (または <literal>N(:, i)</literal>に一致する最初の列
305                         
306                         <literal>H(:, loc(i))</literal> の添字)を返します.
307                         
308                         <literal>"shuffle"</literal>フラグが追加で指定された場合,
309                         
310                         行/列に基づく要素の順番は考慮されません.
311                         
312                     </para>
313                     
314                 </listitem>
315                 
316             </varlistentry>
317             
318         </variablelist>
319         
320     </refsection>
321     
322     <refsection>
323         
324         <title>説明</title>
325         
326         <para>
327             
328             <literal>nb = members(N, H [,"rows"|"cols"])</literal> 
329             
330             は各要素または<literal>H</literal>の中にある
331             
332             <literal>N</literal>の行または列の発生回数を返します.
333             
334             要素が見つからない場合, 0 が返されます.
335             
336             
337             
338             <literal>N(i,j,...)</literal>が現れる最初(デフォルト)または
339             
340             <literal>"last"</literal>(最後)の<literal>H</literal>の
341             
342             添字を,
343             
344             2番目のオプションの出力<literal>loc</literal>により
345             
346             取得できます.
347             
348             <literal>"rows"</literal> または <literal>"cols"</literal> 
349             
350             の一致するものを探す場合,
351             
352             オプション<literal>"shuffle"</literal>を使用することにより,
353             
354             一致の際の要素の順番を無視することができます.
355             
356         </para>
357         
358         <para>
359             
360             値 <literal>%inf</literal> および <literal>-%inf</literal> 
361             
362             を<literal>N</literal>の中および<literal>H</literal>の中で
363             
364             使用することができます.
365             
366             ノーマルモードでは,
367             
368             <literal>%nan</literal>が<literal>N</literal>の中では
369             
370             サポートされますが,<literal>H</literal>の中ではサポートされません. 
371             
372             <literal>"rows"</literal> または <literal>"cols"</literal> モードの場合, 
373             
374             <literal>%nan</literal> はどこでもサポートされます.
375             
376         </para>
377         
378         <para>
379             
380             通常の要素毎のモードの場合, members(..) は,
381             
382             論理値,
383             
384             整数エンコードされた数値(8-16-32ビット長の符号ありまたは無し)
385             
386             および実数を高速に処理するために
387             
388             <link linkend="dsearch">dsearch(..)</link> を使用します.
389             
390             複素数, テキスト, 多項式の場合,
391             
392             より低速でよりメモリ消費が多いアルゴリズムが使用されます.
393             
394             これらのデータ型についてより高い性能を得たい場合,
395             
396             より大きな<literal>N</literal>または<literal>H</literal>の場合, 
397             
398             ユーザは
399             
400             <link linkend="stacksize">stacksize(..)</link>を増加させることになります. 
401             
402             計算時間が長い場合, 進行状況の棒グラフが表示されます.
403             
404         </para>
405         
406     </refsection>
407     
408     <refsection>
409         
410         <title>例</title>
411         
412         <programlisting role="example"><![CDATA[
413 N = [1 8 4 5 2 1];
414 H = [9 7 4 2 1 4];
415
416 [nb, loc] = members(N, H, "last")
417 // nb  = [1 0 2 0 1 1] を返す: 例えば, Hの中に4が2回現れる.
418 // そして loc = [5 0 6 0 4 5]: 4が最後に現れるのはHの6番目の位置
419
420 [nb, loc] = members(N, H)
421 // loc = [5 0 3 0 4 5]を返す: 4が最初に現れるのはHの3番目の位置
422
423 // ハイパー行列の場合. 前記の N 及び Hを利用:
424 N = matrix(N, [3 1 2]);
425 H = matrix(H, [3 1 2]);
426 [nb, loc] = members(N, H, "last")
427
428 // 整数の場合:
429 N = int8(grand(3, 2, "uin", -5, 5));
430 H = int8(grand(4, 4, "uin", -5, 5));
431 [nb, loc] = members(N, H)
432
433 // 多項式の場合 (複素数の係数を指定可能):
434 z = %z;
435 N = [z (1-z)^2 ; -4 %i*z ];
436 H = [2  %i*z -z  3-z  z  z^3 z];
437 [nb, loc] = members(N, H)
438
439 // テキストの場合:
440 N = [ "Hi" "Hu" "Allo"];
441 H = [ "Hello" "Bonjour" "Allo"
442       "Holà"  "Allo"  "Hallo"
443       "Hi"    "Hé"    "Salud" ];
444 [nb, loc] = members(N, H, "last")
445
446 // 行の場合:
447  H = [
448   3  3  0
449   4  1  0
450   2  0  3
451   0  1  4
452   3  4  3
453   0  4  1
454   3  1  0
455   ];
456  N = [
457   1  2  3
458   0  1  4
459   3  0  3
460   4  1  0
461   2  0  2
462   ];
463  N, H
464  [nb, loc] = members(N, H, "rows")
465  [nb, loc] = members(N, H, "rows","last")
466  [nb, loc] = members(N, H, "rows","shuffle") // [4 1 0], [0 1 4] 及び [0 4 1] は同一とみなされる
467
468 // 列の場合: 定義済みの N 及び H を利用:
469  N = N.', H = H.'
470  [nb, loc] = members(N, H, "cols", "shuffle")
471
472 ]]></programlisting>
473         
474     </refsection>
475     
476     <refsection role="see also">
477         
478         <title>参照</title>
479         
480         <simplelist type="inline">
481             
482             <member>
483                 
484                 <link linkend="dsearch">dsearch</link>
485                 
486             </member>
487             
488             <member>
489                 
490                 <link linkend="intersect">intersect</link>
491                 
492             </member>
493             
494             <member>
495                 
496                 <link linkend="find">find</link>
497                 
498             </member>
499             
500             <member>
501                 
502                 <link linkend="vectorfind">vectorfind</link>
503                 
504             </member>
505             
506         </simplelist>
507         
508     </refsection>
509     
510     <refsection>
511         
512         <title>履歴</title>
513         
514         <revhistory>
515             
516             <revision>
517                 
518                 <revnumber>5.5.0</revnumber>
519                 
520                 <revremark>members() 関数が導入されました.</revremark>
521                 
522             </revision>
523             
524         </revhistory>
525         
526     </refsection>
527     
528 </refentry>
529