japanese translation updated.
[scilab.git] / scilab / modules / elementary_functions / help / ja_JP / searchandsort / gsort.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) 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: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="gsort" xml:lang="ja">
16     
17     <refnamediv>
18         
19         <refname>gsort</refname>
20         
21         <refpurpose>クイックソートアルゴリズムによるソート</refpurpose>
22         
23     </refnamediv>
24     
25     <refsynopsisdiv>
26         
27         <title>呼び出し手順</title>
28         
29         <synopsis>[B [,k]]=gsort(A)
30             
31             [B [,k]]=gsort(A,option)
32             
33             [B [,k]]=gsort(A,option,direction)
34             
35         </synopsis>
36         
37     </refsynopsisdiv>
38     
39     <refsection>
40         
41         <title>引数</title>
42         
43         <variablelist>
44             
45             <varlistentry>
46                 
47                 <term>A</term>
48                 
49                 <listitem>
50                     
51                     <para>実数,整数または文字列のベクトル/行列または疎ベクトル.</para>
52                     
53                 </listitem>
54                 
55             </varlistentry>
56             
57             <varlistentry>
58                 
59                 <term>option</term>
60                 
61                 <listitem>
62                     
63                     <para>文字列. ソートの種類(下記)を指定します:</para>
64                     
65                     <itemizedlist>
66                         
67                         <listitem>
68                             
69                             <para>
70                                 
71                                 'r' : <literal>A</literal> の各列がソートされます
72                                 
73                             </para>
74                             
75                         </listitem>
76                         
77                         <listitem>
78                             
79                             <para>
80                                 
81                                 'c': <literal>A</literal> の各行がソートされます
82                                 
83                             </para>
84                             
85                         </listitem>
86                         
87                         <listitem>
88                             
89                             <para>
90                                 
91                                 'g': <literal>A</literal> の全要素がソートされます. 
92                                 
93                                 デフォルト値です.
94                                 
95                             </para>
96                             
97                         </listitem>
98                         
99                         <listitem>
100                             
101                             <para>
102                                 
103                                 'lr': <literal>A</literal>の列の辞書式ソート
104                                 
105                             </para>
106                             
107                         </listitem>
108                         
109                         <listitem>
110                             
111                             <para>
112                                 
113                                 'lc': <literal>A</literal>のの行の辞書式ソート
114                                 
115                             </para>
116                             
117                         </listitem>
118                         
119                     </itemizedlist>
120                     
121                 </listitem>
122                 
123             </varlistentry>
124             
125             <varlistentry>
126                 
127                 <term>direction</term>
128                 
129                 <listitem>
130                     
131                     <para>文字列. ソートの方向を指定します:
132                         
133                         <literal>'i'</literal> は昇順,
134                         
135                         <literal>'d'</literal> は降順 (デフォルト)を意味します.
136                         
137                     </para>
138                     
139                 </listitem>
140                 
141             </varlistentry>
142             
143             <varlistentry>
144                 
145                 <term>B</term>
146                 
147                 <listitem>
148                     
149                     <para>
150                         
151                         <literal>A</literal>と同じ型と次元の配列.
152                         
153                     </para>
154                     
155                 </listitem>
156                 
157             </varlistentry>
158             
159             <varlistentry>
160                 
161                 <term>k</term>
162                 
163                 <listitem>
164                     
165                     <para>
166                         
167                         整数値を有し,<literal>A</literal>と同じ次元の実数配列.
168                         
169                         元の添え字を有します.
170                         
171                     </para>
172                     
173                 </listitem>
174                 
175             </varlistentry>
176             
177         </variablelist>
178         
179     </refsection>
180     
181     <refsection>
182         
183         <title>説明</title>
184         
185         <para>
186             
187             <literal>gsort</literal> は種々のデータ型に関する
188             
189             "クイックソート" アルゴリズムです.
190             
191         </para>
192         
193         <itemizedlist>
194             
195             <listitem>
196                 
197                 <para>
198                     
199                     <literal>B=gsort(A,'g')</literal>,
200                     
201                     <literal>B=gsort(A,'g','d')</literal> および
202                     
203                     <literal>B=gsort(A)</literal> は
204                     
205                     配列  <literal>A</literal>の要素を<literal>A(:)</literal>として
206                     
207                     降順にソートします.
208                     
209                 </para>
210                 
211                 <para>
212                     
213                     <literal>B=gsort(A,'g','i')</literal> は
214                     
215                     <literal>A</literal>の要素を昇順にソートします.
216                     
217                 </para>
218                 
219             </listitem>
220             
221             <listitem>
222                 
223                 <para>
224                     
225                     <literal>B=gsort(A,'lr')</literal> は<literal>A</literal>
226                     
227                     の行を辞書的に降順にソートします.
228                     
229                     <literal>B</literal>は,
230                     
231                     <literal>B</literal>の各行が<literal>B(i,:)&gt;=B(j,:)</literal>
232                     
233                     (ただし,<literal>i&lt;j</literal>)となるように,
234                     
235                     行列<literal>A</literal>の行を並び替えることにより
236                     
237                     得られます.
238                     
239                 </para>
240                 
241                 <para>
242                     
243                     <literal>B=gsort(A,'lr','i')</literal> は
244                     
245                     昇順の辞書的ソートについても同様に動作します.
246                     
247                 </para>
248                 
249             </listitem>
250             
251             <listitem>
252                 
253                 <para>
254                     
255                     <literal>B=gsort(A,'lc')</literal> 
256                     
257                     の列を辞書的に降順にソートします.
258                     
259                     <literal>B</literal>は,
260                     
261                     <literal>B</literal>の各列が<literal>B(:,i)&gt;=B(:,j)</literal>
262                     
263                     (ただし,<literal>i&lt;j</literal>となるように,
264                     
265                     行列<literal>A</literal>の列を並び替えることにより
266                     
267                     得られます.
268                     
269                 </para>
270                 
271                 <para>
272                     
273                     <literal>B=gsort(A,'lc','i')</literal> は
274                     
275                     昇順の辞書的ソートについても同様に動作します.
276                     
277                 </para>
278                 
279             </listitem>
280             
281         </itemizedlist>
282         
283         <para>二番目の戻り値引数が指定された場合, 
284             
285             <literal>k</literal>に<literal>A</literal>のソートされた値の添え字が
286             
287             代入されます.
288             
289             <literal>[B,k]=gsort(A,'g')</literal>の場合,
290             
291             <literal>B==A(k)</literal>となります.
292             
293             <emphasis role="bold">このアルゴリズムは,等しい値を有する
294                 
295                 レコードの相対的な順序を保持します.
296                 
297             </emphasis>
298             
299         </para>
300         
301         <para>
302             
303             <literal>v</literal> が複素数の場合, その要素は
304             
305             大きさ,すなわち, abs(<literal>v</literal>) によりソートされます,
306             
307             2番目の引数としては<literal>'g'</literal>のみが複素数で使用可能です.
308             
309         </para>
310         
311         <para>
312             
313             複素数の場合, <literal>gsort</literal> はオーバーロードできます.
314             
315         </para>
316         
317         <para>マクロを参照:
318             
319             SCI/modules/elementary_functions/macros/%_gsort.sci
320             
321         </para>
322         
323         <para>
324             
325             (実数,整数または文字列ベクトル/行列または疎ベクトル以外の)
326             
327             管理されない型のオーバーロードが可能です.
328             
329         </para>
330         
331         <para>
332             
333             <literal>v</literal> が <literal>%nan</literal> または
334             
335             <literal>%inf</literal> を要素として有する場合, gsort は
336             
337             これらを <literal>'d'</literal> の場合は先頭,
338             
339             <literal>'i'</literal>の場合は末尾に置きます.
340             
341         </para>
342         
343     </refsection>
344     
345     <refsection>
346         
347         <title>例</title>
348         
349         <programlisting role="example"> 
350             
351             alr=[1,2,2;
352             
353             1,2,1;
354             
355             1,1,2;
356             
357             1,1,1];
358             
359             [alr1,k]=gsort(alr,'lr','i')
360             
361             [alr1,k]=gsort(alr,'lc','i')
362             
363             
364             
365             v=int32(alr)
366             
367             
368             
369             gsort(v)
370             
371             gsort(v,'lr','i')
372             
373             gsort(v,'lc','i')
374             
375             
376             
377             v=['Scilab' '2.6'
378             
379             'Scilab' '2.7'
380             
381             'xcos' '2.7'
382             
383             'Scilab' '3.1'
384             
385             'xcos' '3.1'
386             
387             'xcos' '4.0'
388             
389             'Scilab' '4.0']
390             
391             
392             
393             gsort(v,'lr','i')
394             
395             gsort(v,'lc','i')
396             
397         </programlisting>
398         
399     </refsection>
400     
401     <refsection role="see also">
402         
403         <title>参照</title>
404         
405         <simplelist type="inline">
406             
407             <member>
408                 
409                 <link linkend="find">find</link>
410                 
411             </member>
412             
413         </simplelist>
414         
415         <simplelist type="inline">
416             
417             <member>
418                 
419                 <link linkend="overloading">オーバーロード</link>
420                 
421             </member>
422             
423         </simplelist>
424         
425     </refsection>
426     
427     <refsection>
428         
429         <title>参考文献</title>
430         
431         <para>Quick sort algorithm from Bentley &amp; McIlroy's "Engineering a
432             
433             Sort Function". Software---Practice and Experience,
434             
435             23(11):1249-1265
436             
437         </para>
438         
439     </refsection>
440     
441     <refsection>
442         
443         <title>履歴</title>
444         
445         <revhistory>
446             
447             <revision>
448                 
449                 <revnumber>5.4.0</revnumber>
450                 
451                 <revremark>
452                     
453                     この関数は(実数, 整数または文字列ベクトル/行列または疎ベクトル以外の)
454                     
455                     管理されない型についてオーバーロードできるようになりました.
456                     
457                 </revremark>
458                 
459             </revision>
460             
461         </revhistory>
462         
463     </refsection>
464     
465 </refentry>
466