Help check: validate the help files on compilation against a derivated docbook schema
[scilab.git] / scilab / modules / elementary_functions / help / en_US / searchandsort / lex_sort.xml
1 <?xml version="1.0" encoding="UTF-8"?>
2 <!--
3  * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
4  * Copyright (C) 2008 - INRIA
5  * 
6  * This file must be used under the terms of the CeCILL.
7  * This source file is licensed as described in the file COPYING, which
8  * you should have received as part of this distribution.  The terms
9  * are also available at    
10  * http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt
11  *
12  -->
13 <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" version="5.0-subset Scilab" xml:id="lex_sort" xml:lang="en">
14   <info>
15     <pubdate>$LastChangedDate$</pubdate>
16   </info>
17   <refnamediv>
18     <refname>lex_sort</refname>
19     <refpurpose>lexicographic matrix rows sorting</refpurpose>
20   </refnamediv>
21   <refsynopsisdiv>
22     <title>Calling Sequence</title>
23     <synopsis>[N, [k]]=lex_sort(M [,sel] [,'unique'])
24 </synopsis>
25   </refsynopsisdiv>
26   <refsection>
27     <title>Arguments</title>
28     <variablelist>
29       <varlistentry>
30         <term>M</term>
31         <listitem>
32           <para>real matrix</para>
33         </listitem>
34       </varlistentry>
35       <varlistentry>
36         <term>N</term>
37         <listitem>
38           <para>real matrix</para>
39         </listitem>
40       </varlistentry>
41       <varlistentry>
42         <term>k</term>
43         <listitem>
44           <para>column vector of integers</para>
45         </listitem>
46       </varlistentry>
47     </variablelist>
48   </refsection>
49   <refsection>
50     <title>Description</title>
51     <para>the <literal>lex_sort</literal> function is now obsolete. It can be
52     replaced by functions <link linkend="gsort">gsort</link> and <link linkend="unique">unique</link>.</para>
53     <para><literal>N=lex_sort(M)</literal> sorts the rows (as a group) of the
54     matrix <literal>M</literal> in ascending order. If required the output
55     argument <literal>k</literal> contains the ordering:
56     <literal>[N,k]=lex_sort(M)</literal> returns <literal>k</literal> such as
57     <literal>N</literal> is uequal to <literal>M(k,:)</literal> .</para>
58     <para><literal>N=lex_sort(M,sel [,'unique'])</literal> produces the same
59     result as the following sequence of instructions:</para>
60     <programlisting><![CDATA[ 
61 [N,k]=lex_sort(M(:,sel) [,'unique']);
62 N=M(k,:)
63  ]]></programlisting>
64     <para>The <literal>'unique'</literal> flag has to be given if one wants to
65     retain only unique rows in the result. Note that
66     <literal>lex_sort(M,sel,'unique')</literal> retains only rows such that
67     M(:,sel) are unique.</para>
68   </refsection>
69   <refsection>
70     <title>Examples</title>
71     <programlisting role="example"><![CDATA[ 
72 M=round(2*rand(20,3));
73
74 lex_sort(M)
75 lex_sort(M,'unique')
76 [N,k]=lex_sort(M,[1 3],'unique')
77  ]]></programlisting>
78   </refsection>
79   <refsection role="see also">
80     <title>See Also</title>
81     <simplelist type="inline">
82       <member>
83         <link linkend="gsort">gsort</link>
84       </member>
85       <member>
86         <link linkend="unique">unique</link>
87       </member>
88     </simplelist>
89   </refsection>
90 </refentry>