merge 6.0 into master 69/20169/1
Clément DAVID [Wed, 20 Jun 2018 14:45:28 +0000 (16:45 +0200)]
Change-Id: I4311eff1d39c5944133bd11adec5b97e71b2eb38

173 files changed:
scilab/CHANGES.md
scilab/modules/arnoldi/help/en_US/eigs.xml
scilab/modules/arnoldi/help/ja_JP/eigs.xml
scilab/modules/arnoldi/macros/eigs.sci
scilab/modules/arnoldi/tests/nonreg_tests/bug_13480.tst [new file with mode: 0644]
scilab/modules/ast/includes/types/singlepoly.hxx
scilab/modules/ast/locales/ast.pot
scilab/modules/ast/locales/fr_FR.po
scilab/modules/ast/src/cpp/ast/runvisitor.cpp
scilab/modules/ast/src/cpp/types/arrayof.cpp
scilab/modules/ast/src/cpp/types/implicitlist.cpp
scilab/modules/ast/src/cpp/types/singlepoly.cpp
scilab/modules/ast/tests/nonreg_tests/bug_10197.tst [new file with mode: 0644]
scilab/modules/ast/tests/nonreg_tests/bug_15092.tst [new file with mode: 0644]
scilab/modules/ast/tests/nonreg_tests/bug_15609.tst [new file with mode: 0644]
scilab/modules/core/help/en_US/1_keywords/minus.xml
scilab/modules/core/help/en_US/1_keywords/plus.xml
scilab/modules/core/help/fr_FR/1_keywords/minus.xml
scilab/modules/core/help/fr_FR/1_keywords/plus.xml
scilab/modules/core/help/ja_JP/1_keywords/minus.xml
scilab/modules/core/help/ja_JP/1_keywords/plus.xml
scilab/modules/core/help/pt_BR/1_keywords/minus.xml
scilab/modules/core/help/pt_BR/1_keywords/plus.xml
scilab/modules/core/help/ru_RU/1_keywords/minus.xml
scilab/modules/core/help/ru_RU/1_keywords/plus.xml
scilab/modules/elementary_functions/help/en_US/setoperations/intersect.xml
scilab/modules/elementary_functions/help/en_US/setoperations/unique.xml
scilab/modules/elementary_functions/help/fr_FR/setoperations/intersect.xml
scilab/modules/elementary_functions/help/fr_FR/setoperations/unique.xml
scilab/modules/elementary_functions/help/ja_JP/setoperations/intersect.xml [deleted file]
scilab/modules/elementary_functions/help/ja_JP/setoperations/unique.xml
scilab/modules/elementary_functions/help/pt_BR/setoperations/intersect.xml [deleted file]
scilab/modules/elementary_functions/help/pt_BR/setoperations/unique.xml
scilab/modules/elementary_functions/help/ru_RU/setoperations/intersect.xml [deleted file]
scilab/modules/elementary_functions/help/ru_RU/setoperations/unique.xml
scilab/modules/elementary_functions/macros/unique.sci
scilab/modules/elementary_functions/src/cpp/gsort.cpp
scilab/modules/elementary_functions/tests/nonreg_tests/bug_12659.tst [moved from scilab/modules/graphics/tests/unit_tests/surf_deadlock.dia.ref with 50% similarity]
scilab/modules/elementary_functions/tests/nonreg_tests/bug_15182.tst [new file with mode: 0644]
scilab/modules/elementary_functions/tests/nonreg_tests/bug_4810.dia.ref
scilab/modules/elementary_functions/tests/nonreg_tests/bug_4810.tst
scilab/modules/elementary_functions/tests/nonreg_tests/bug_8779.dia.ref [deleted file]
scilab/modules/elementary_functions/tests/nonreg_tests/bug_8779.tst
scilab/modules/elementary_functions/tests/unit_tests/unique.tst [new file with mode: 0644]
scilab/modules/fileio/tests/nonreg_tests/bug_15484.tst [moved from scilab/modules/fileio/tests/nonreg_tests/bug_15486.tst with 91% similarity]
scilab/modules/functions/sci_gateway/cpp/sci_whereis.cpp
scilab/modules/functions/tests/nonreg_tests/bug_15542.tst [new file with mode: 0644]
scilab/modules/graphics/help/en_US/3d_plot/mesh.xml
scilab/modules/graphics/help/en_US/3d_plot/surf.xml
scilab/modules/graphics/help/en_US/GlobalProperty.xml
scilab/modules/graphics/help/ja_JP/3d_plot/mesh.xml
scilab/modules/graphics/help/ja_JP/3d_plot/surf.xml
scilab/modules/graphics/help/ja_JP/GlobalProperty.xml
scilab/modules/graphics/help/pt_BR/3d_plot/mesh.xml
scilab/modules/graphics/help/pt_BR/3d_plot/surf.xml
scilab/modules/graphics/help/pt_BR/GlobalProperty.xml
scilab/modules/graphics/help/ru_RU/3d_plot/mesh.xml
scilab/modules/graphics/help/ru_RU/GlobalProperty.xml
scilab/modules/graphics/macros/setSurfProperty.sci
scilab/modules/graphics/tests/nonreg_tests/bug_surf.tst [moved from scilab/modules/graphics/tests/unit_tests/surf.dia.ref with 99% similarity]
scilab/modules/graphics/tests/nonreg_tests/bug_surf_deadlock.tst [moved from scilab/modules/graphics/tests/unit_tests/surf_deadlock.tst with 95% similarity]
scilab/modules/graphics/tests/unit_tests/surf.tst
scilab/modules/gui/etc/main_menubar.xml
scilab/modules/hdf5/sci_gateway/cpp/sci_hdf5_listvar_v3.cpp
scilab/modules/hdf5/tests/nonreg_tests/bug_15501.dia.ref [new file with mode: 0644]
scilab/modules/hdf5/tests/nonreg_tests/bug_15501.tst [new file with mode: 0644]
scilab/modules/helptools/etc/images_md5.txt
scilab/modules/helptools/images/intdec_1.png
scilab/modules/optimization/macros/karmarkar.sci
scilab/modules/optimization/src/fortran/minpack/hybrd.f
scilab/modules/optimization/tests/nonreg_tests/bug_14218.tst [new file with mode: 0644]
scilab/modules/optimization/tests/nonreg_tests/bug_9231.tst [new file with mode: 0644]
scilab/modules/overloading/macros/%i_k_s.sci
scilab/modules/overloading/macros/%s_k_i.sci
scilab/modules/polynomials/help/en_US/degree.xml
scilab/modules/polynomials/help/fr_FR/degree.xml
scilab/modules/polynomials/help/ja_JP/degree.xml
scilab/modules/polynomials/help/pt_BR/degree.xml
scilab/modules/polynomials/sci_gateway/cpp/sci_degree.cpp
scilab/modules/polynomials/sci_gateway/cpp/sci_poly.cpp
scilab/modules/polynomials/tests/nonreg_tests/bug_14701.tst [new file with mode: 0644]
scilab/modules/polynomials/tests/nonreg_tests/bug_15599.tst [new file with mode: 0644]
scilab/modules/scinotes/src/java/org/scilab/modules/scinotes/SciNotes.java
scilab/modules/scinotes/src/java/org/scilab/modules/scinotes/actions/RestoreOpenedFilesAction.java
scilab/modules/signal_processing/help/en_US/bilt.xml [moved from scilab/modules/signal_processing/help/en_US/miscellaneous/bilt.xml with 100% similarity]
scilab/modules/signal_processing/help/en_US/correlation_convolution/CHAPTER
scilab/modules/signal_processing/help/en_US/correlation_convolution/convol.xml [moved from scilab/modules/signal_processing/help/en_US/filters/convol.xml with 100% similarity]
scilab/modules/signal_processing/help/en_US/filters/casc.xml
scilab/modules/signal_processing/help/en_US/filters/iir.xml
scilab/modules/signal_processing/help/en_US/intdec.xml [moved from scilab/modules/signal_processing/help/en_US/spectral_estimation/intdec.xml with 64% similarity]
scilab/modules/signal_processing/help/en_US/miscellaneous/CHAPTER [deleted file]
scilab/modules/signal_processing/help/en_US/sincd.xml [moved from scilab/modules/signal_processing/help/en_US/miscellaneous/sincd.xml with 100% similarity]
scilab/modules/signal_processing/help/fr_FR/correlation_convolution/CHAPTER
scilab/modules/signal_processing/help/fr_FR/correlation_convolution/conv.xml [deleted file]
scilab/modules/signal_processing/help/fr_FR/correlation_convolution/conv2.xml [deleted file]
scilab/modules/signal_processing/help/fr_FR/correlation_convolution/convol2d.xml [deleted file]
scilab/modules/signal_processing/help/fr_FR/correlation_convolution/corr.xml [deleted file]
scilab/modules/signal_processing/help/fr_FR/correlation_convolution/hank.xml [deleted file]
scilab/modules/signal_processing/help/fr_FR/correlation_convolution/xcorr.xml [deleted file]
scilab/modules/signal_processing/help/fr_FR/filters/CHAPTER
scilab/modules/signal_processing/help/fr_FR/filters/analpf.xml [deleted file]
scilab/modules/signal_processing/help/fr_FR/filters/buttmag.xml [deleted file]
scilab/modules/signal_processing/help/fr_FR/filters/casc.xml [deleted file]
scilab/modules/signal_processing/help/fr_FR/filters/cheb1mag.xml [deleted file]
scilab/modules/signal_processing/help/fr_FR/filters/cheb2mag.xml [deleted file]
scilab/modules/signal_processing/help/fr_FR/filters/convol.xml [deleted file]
scilab/modules/signal_processing/help/fr_FR/filters/ell1mag.xml [deleted file]
scilab/modules/signal_processing/help/fr_FR/filters/eqfir.xml [deleted file]
scilab/modules/signal_processing/help/fr_FR/filters/eqiir.xml [deleted file]
scilab/modules/signal_processing/help/fr_FR/filters/faurre.xml [deleted file]
scilab/modules/signal_processing/help/fr_FR/filters/ffilt.xml [deleted file]
scilab/modules/signal_processing/help/fr_FR/filters/filt_sinc.xml [deleted file]
scilab/modules/signal_processing/help/fr_FR/filters/filter.xml [deleted file]
scilab/modules/signal_processing/help/fr_FR/filters/find_freq.xml [deleted file]
scilab/modules/signal_processing/help/fr_FR/filters/frmag.xml [deleted file]
scilab/modules/signal_processing/help/fr_FR/filters/fsfirlin.xml [deleted file]
scilab/modules/signal_processing/help/fr_FR/filters/group.xml [deleted file]
scilab/modules/signal_processing/help/fr_FR/filters/hilbert.xml [deleted file]
scilab/modules/signal_processing/help/fr_FR/filters/iir.xml [deleted file]
scilab/modules/signal_processing/help/fr_FR/filters/iirgroup.xml [deleted file]
scilab/modules/signal_processing/help/fr_FR/filters/iirlp.xml [deleted file]
scilab/modules/signal_processing/help/fr_FR/filters/kalm.xml [deleted file]
scilab/modules/signal_processing/help/fr_FR/filters/lev.xml [deleted file]
scilab/modules/signal_processing/help/fr_FR/filters/levin.xml [deleted file]
scilab/modules/signal_processing/help/fr_FR/filters/lindquist.xml [deleted file]
scilab/modules/signal_processing/help/fr_FR/filters/remez.xml [deleted file]
scilab/modules/signal_processing/help/fr_FR/filters/remezb.xml [deleted file]
scilab/modules/signal_processing/help/fr_FR/filters/srfaur.xml [deleted file]
scilab/modules/signal_processing/help/fr_FR/filters/srkf.xml [deleted file]
scilab/modules/signal_processing/help/fr_FR/filters/sskf.xml [deleted file]
scilab/modules/signal_processing/help/fr_FR/filters/syredi.xml [deleted file]
scilab/modules/signal_processing/help/fr_FR/filters/system.xml [deleted file]
scilab/modules/signal_processing/help/fr_FR/filters/trans.xml [deleted file]
scilab/modules/signal_processing/help/fr_FR/filters/wfir.xml [deleted file]
scilab/modules/signal_processing/help/fr_FR/filters/wfir_gui.xml [deleted file]
scilab/modules/signal_processing/help/fr_FR/filters/wiener.xml [deleted file]
scilab/modules/signal_processing/help/fr_FR/filters/wigner.xml [deleted file]
scilab/modules/signal_processing/help/fr_FR/filters/window.xml [deleted file]
scilab/modules/signal_processing/help/fr_FR/filters/yulewalk.xml [deleted file]
scilab/modules/signal_processing/help/fr_FR/filters/zpbutt.xml [deleted file]
scilab/modules/signal_processing/help/fr_FR/filters/zpch1.xml [deleted file]
scilab/modules/signal_processing/help/fr_FR/filters/zpch2.xml [deleted file]
scilab/modules/signal_processing/help/fr_FR/filters/zpell.xml [deleted file]
scilab/modules/signal_processing/help/fr_FR/howto/DesignEllipticFilter.xml [deleted file]
scilab/modules/signal_processing/help/fr_FR/identification/frfit.xml [deleted file]
scilab/modules/signal_processing/help/fr_FR/identification/lattn.xml [deleted file]
scilab/modules/signal_processing/help/fr_FR/identification/lattp.xml [deleted file]
scilab/modules/signal_processing/help/fr_FR/identification/mrfit.xml [deleted file]
scilab/modules/signal_processing/help/fr_FR/identification/phc.xml [deleted file]
scilab/modules/signal_processing/help/fr_FR/identification/rpem.xml [deleted file]
scilab/modules/signal_processing/help/fr_FR/miscellaneous/CHAPTER [deleted file]
scilab/modules/signal_processing/help/fr_FR/miscellaneous/bilt.xml [deleted file]
scilab/modules/signal_processing/help/fr_FR/miscellaneous/sincd.xml [deleted file]
scilab/modules/signal_processing/help/fr_FR/spectral_estimation/cepstrum.xml [deleted file]
scilab/modules/signal_processing/help/fr_FR/spectral_estimation/czt.xml [deleted file]
scilab/modules/signal_processing/help/fr_FR/spectral_estimation/intdec.xml [deleted file]
scilab/modules/signal_processing/help/fr_FR/spectral_estimation/mese.xml [deleted file]
scilab/modules/signal_processing/help/fr_FR/transforms/dct.xml [deleted file]
scilab/modules/signal_processing/help/fr_FR/transforms/dst.xml [deleted file]
scilab/modules/signal_processing/help/fr_FR/transforms/fft2.xml [deleted file]
scilab/modules/signal_processing/help/fr_FR/transforms/fftshift.xml [deleted file]
scilab/modules/signal_processing/help/fr_FR/transforms/hilb.xml [deleted file]
scilab/modules/signal_processing/help/ja_JP/bilt.xml [moved from scilab/modules/signal_processing/help/ja_JP/miscellaneous/bilt.xml with 100% similarity]
scilab/modules/signal_processing/help/ja_JP/correlation_convolution/convol.xml [moved from scilab/modules/signal_processing/help/ja_JP/filters/convol.xml with 100% similarity]
scilab/modules/signal_processing/help/ja_JP/filters/casc.xml
scilab/modules/signal_processing/help/ja_JP/filters/iir.xml
scilab/modules/signal_processing/help/ja_JP/intdec.xml [moved from scilab/modules/signal_processing/help/ja_JP/spectral_estimation/intdec.xml with 67% similarity]
scilab/modules/signal_processing/help/ja_JP/miscellaneous/CHAPTER [deleted file]
scilab/modules/signal_processing/help/ja_JP/sincd.xml [moved from scilab/modules/signal_processing/help/ja_JP/miscellaneous/sincd.xml with 100% similarity]
scilab/modules/signal_processing/macros/casc.sci
scilab/modules/slint/src/cpp/DeprecatedChecker.cpp
scilab/modules/string/sci_gateway/cpp/sci_string.cpp
scilab/modules/string/tests/nonreg_tests/bug_15598.tst [new file with mode: 0644]

index 649c7fd..b621a6d 100644 (file)
@@ -88,6 +88,7 @@ Feature changes and additions
   - Several bits can now be retrieved from each component of an input array.
 * `edit` now accepts a line number as text (like "23").
 
+
 Help pages:
 -----------
 
index d2d4dc3..e33049c 100644 (file)
  * along with this program.
  *
  -->
-<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="eigs" xml:lang="en">
+<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="eigs" xml:lang="en">
     <refnamediv>
         <refname>eigs</refname>
         <refpurpose>calculates largest eigenvalues and eigenvectors of matrices</refpurpose>
     <refsynopsisdiv>
         <title>Syntax</title>
         <synopsis>
-            d = eigs(A [,B [,k [,sigma [,opts]]]])
-            [d, v] = eigs(A [,B [,k [,sigma [,opts]]]])
-
-            d = eigs(Af, n [,B [,k [,sigma [,opts]]]])
-            [d, v] = eigs(Af, n [,B [,k [,sigma [,opts]]]])
+            d = eigs(A)
+            d = eigs(Af, n)
+            d = eigs(.., B)
+            d = eigs(.., B, k)
+            d = eigs(.., B, k, sigma)
+            d = eigs(.., B, k, sigma, opts)
+            [d, v] = eigs(..)
         </synopsis>
     </refsynopsisdiv>
     <refsection>
                 </listitem>
             </varlistentry>
             <varlistentry>
-                <term>Af </term>
-                <listitem>
-                    <para>a function</para>
-                </listitem>
-            </varlistentry>
-            <varlistentry>
-                <term>n </term>
-                <listitem>
-                    <para>
-                        a scalar, defined only if <literal>A</literal> is a function
-                    </para>
-                </listitem>
-            </varlistentry>
-            <varlistentry>
                 <term>B</term>
                 <listitem>
                     <para>
             <varlistentry>
                 <term>k</term>
                 <listitem>
-                    <para>an integer, number of eigenvalues to be computed</para>
+                    <para>
+                      positive integer: number of eigenvalues to be computed. By default,
+                      <literal>k=min(n-1, 6)</literal> (<varname>A</varname> real symetric) or
+                      <literal>k=min(n-2, 6)</literal> (otherwise) eigen values are computed,
+                      with n=size(A,1).
+                    </para>
                 </listitem>
             </varlistentry>
             <varlistentry>
                 </listitem>
             </varlistentry>
             <varlistentry>
+                <term>Af </term>
+                <listitem>
+                    <para>a function</para>
+                </listitem>
+            </varlistentry>
+            <varlistentry>
+                <term>n </term>
+                <listitem>
+                    <para>
+                        a scalar, defined only if <literal>A</literal> is a function
+                    </para>
+                </listitem>
+            </varlistentry>
+            <varlistentry>
                 <term>d</term>
                 <listitem>
                     <para>a real or complex eigenvalues vector or diagonal matrix (eigenvalues along the diagonal)</para>
@@ -173,7 +183,6 @@ function y = A ( x )
                 <listitem>
                     <para>
                         returns in vector <literal>d</literal> the <literal>k</literal> eigenvalues.
-                        If <literal>k</literal> is not specified, <literal>k = min(n, 6)</literal>, where n is the row number of A.
                     </para>
                 </listitem>
             </varlistentry>
index 35e3f05..264b98f 100644 (file)
  * along with this program.
  *
  -->
-<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="eigs" xml:lang="ja">
+<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="eigs" xml:lang="ja">
     <refnamediv>
         <refname>eigs</refname>
         <refpurpose>
     <refsynopsisdiv>
         <title>呼び出し手順</title>
         <synopsis>
-            d = eigs(A [,B [,k [,sigma [,opts]]]])
-            [d, v] = eigs(A [,B [,k [,sigma [,opts]]]])
-            d = eigs(Af, n [,B [,k [,sigma [,opts]]]])
-            [d, v] = eigs(Af, n [,B [,k [,sigma [,opts]]]])
+            d = eigs(A)
+            d = eigs(Af, n)
+            d = eigs(.., B)
+            d = eigs(.., B, k)
+            d = eigs(.., B, k, sigma)
+            d = eigs(.., B, k, sigma, opts)
+            [d, v] = eigs(..)
         </synopsis>
     </refsynopsisdiv>
     <refsection>
                 </listitem>
             </varlistentry>
             <varlistentry>
-                <term>Af </term>
+                <term>B</term>
                 <listitem>
-                    <para>関数</para>
+                    <para>
+                        <literal>A</literal>と同じ次元の疎, 実数または複素数, 正方行列.
+                        Specify <literal>[]</literal> to skip it, as by default.
+                    </para>
                 </listitem>
             </varlistentry>
             <varlistentry>
-                <term>n </term>
+                <term>k</term>
                 <listitem>
                     <para>
-                        スカラー, Aが関数の場合のみ <literal>A</literal> 定義
+                      整数, 計算する固有値の数. By default,
+                      <literal>k=min(n-1, 6)</literal> (<varname>A</varname> real symetric) or
+                      <literal>k=min(n-2, 6)</literal> (otherwise) eigen values are computed,
+                      with n=size(A,1).
                     </para>
                 </listitem>
             </varlistentry>
             <varlistentry>
-                <term>B</term>
+                <term>sigma</term>
                 <listitem>
-                    <para>
-                        <literal> A</literal>と同じ次元の
-                        疎, 実数または複素数, 正方行列
-                    </para>
+                    <para>実スカラーまたは長さ2の文字列</para>
                 </listitem>
             </varlistentry>
             <varlistentry>
-                <term>k</term>
+                <term>opts</term>
                 <listitem>
-                    <para>整数, 計算する固有値の数</para>
+                    <para>構造体</para>
                 </listitem>
             </varlistentry>
             <varlistentry>
-                <term>sigma</term>
+                <term>Af </term>
                 <listitem>
-                    <para>実スカラーまたは長さ2の文字列</para>
+                    <para>関数</para>
                 </listitem>
             </varlistentry>
             <varlistentry>
-                <term>opts</term>
+                <term>n </term>
                 <listitem>
-                    <para>構造体</para>
+                    <para>
+                        スカラー, Aが関数の場合のみ <literal>A</literal> 定義
+                    </para>
                 </listitem>
             </varlistentry>
             <varlistentry>
@@ -186,8 +197,6 @@ function y = A ( x )
                 <listitem>
                     <para>
                         は,<literal>k</literal>個の固有値をベクトル<literal>d</literal>に返します.
-                        <literal>k</literal> が指定されない場合,
-                        <literal>k = min(n, 6)</literal>, ただし, nはAの行数となります.
                     </para>
                 </listitem>
             </varlistentry>
index f25b8db..c06ce9b 100644 (file)
@@ -62,11 +62,15 @@ function [d, v] = eigs(varargin)
     end
 
     if(typeof(varargin(1)) <> "function")
+        if isequal(A, A')   // A is real symmetric
+            nev = min(size(A, "r") - 1, 6);
+        else
+            nev = min(size(A, "r") - 2, 6);
+        end
+
         select rhs
         case 1
-            nev =  min(size(A, "r"), 6);
         case 2
-            nev = min(size(A, "r"), 6);
             B = varargin(2);
         case 3
             B = varargin(2);
diff --git a/scilab/modules/arnoldi/tests/nonreg_tests/bug_13480.tst b/scilab/modules/arnoldi/tests/nonreg_tests/bug_13480.tst
new file mode 100644 (file)
index 0000000..5c4bb03
--- /dev/null
@@ -0,0 +1,24 @@
+// =============================================================================
+// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
+// Copyright (C) 2018 - Samuel GOUGEON
+//
+//  This file is distributed under the same license as the Scilab package.
+// =============================================================================
+// <-- CLI SHELL MODE -->
+// <-- NO CHECK REF -->
+//
+// <-- Non-regression test for bug  -->
+//
+// <-- Bugzilla URL -->
+// http://bugzilla.scilab.org/13480
+//
+// <-- Short Description -->
+// eigs(A) failed for full A with size(A,1)<8
+//
+
+for n = 3:9
+    A = rand(n,n);
+    assert_checktrue(execstr("eigs(A)", "errcatch")==0)
+    assert_checktrue(execstr("eigs(A+A'')", "errcatch")==0)
+    assert_checktrue(execstr("eigs(A+A*%i)", "errcatch")==0)
+end
index e88b6a9..226d356 100644 (file)
@@ -52,6 +52,7 @@ public :
 
     bool                    setZeros();
     int                     getRank();
+    double                  getDegree();
     bool                    setRank(int _iRank, bool bSave = false);
     bool                    setCoef(Double *_poPow);
     bool                    setCoef(const double *_pdblCoefR, const double *_pdblCoefI);
index f4ba8cf..e8e0d70 100644 (file)
@@ -818,3 +818,7 @@ msgstr ""
 #, c-format
 msgid "%s: Wrong type for input argument #%d: An integer expected.\n"
 msgstr ""
+
+#, c-format
+msgid "%ls: Too many %ls or wrong type for argument %d: Real scalar expected.\n"
+msgstr ""
index 82c88cc..ac83ef5 100644 (file)
@@ -458,3 +458,7 @@ msgstr "%s : Type erroné de l'argument d'entrée n°%d : un scalaire attendu.\n
 #, c-format
 msgid "%s: Wrong type for input argument #%d: An integer expected.\n"
 msgstr "%s : Type erroné de l'argument d'entrée n°%d : un entier attendu.\n"
+
+#, c-format
+msgid "%ls: Too many %ls or wrong type for argument %d: Real scalar expected.\n"
+msgstr "%ls : Trop de %ls ou type erroné pour l'argument %d : scalaire réel attendu.\n"
index 15637e2..eb2f775 100644 (file)
@@ -1466,23 +1466,30 @@ void RunVisitorT<T>::visitprivate(const ListExp &e)
         throw;
     }
 
-    types::GenericType* pITStart = static_cast<types::GenericType*>(getResult());
+    types::InternalType* pITStart = getResult();
+    types::GenericType* pStart = static_cast<types::GenericType*>(pITStart);
     if (pITStart == NULL ||
-            ((pITStart->getSize() != 1 || (pITStart->isDouble() && pITStart->getAs<types::Double>()->isComplex())) &&
-             pITStart->isList() == false)) // list case => call overload
+        ((pITStart->isGenericType() == false || pStart->getSize() != 1 || (pStart->isDouble() && pStart->getAs<types::Double>()->isComplex())) &&
+        pStart->isList() == false)) // list case => call overload
     {
+        setResult(NULL);
+        wchar_t szError[bsiz];
+        if (pITStart && pITStart->isImplicitList()) {
+            os_swprintf(szError, bsiz, _W("%ls: Too many %ls or wrong type for argument %d: Real scalar expected.\n").c_str(), L"':'", L"':'", 1);
+        }
+        else
+        {
+            os_swprintf(szError, bsiz, _W("%ls: Wrong type for argument %d: Real scalar expected.\n").c_str(), L"':'", 1);
+        }
+
         if (pITStart)
         {
             pITStart->killMe();
         }
 
-        setResult(NULL);
-        wchar_t szError[bsiz];
-        os_swprintf(szError, bsiz, _W("%ls: Wrong type for argument %d: Real scalar expected.\n").c_str(), L"':'", 1);
         CoverageInstance::stopChrono((void*)&e);
         throw InternalError(szError, 999, e.getLocation());
     }
-    types::InternalType * piStart = pITStart;
 
     try
     {
@@ -1493,11 +1500,13 @@ void RunVisitorT<T>::visitprivate(const ListExp &e)
         CoverageInstance::stopChrono((void*)&e);
         throw;
     }
-    types::GenericType* pITStep = static_cast<types::GenericType*>(getResult());
+
+    types::InternalType* pITStep = getResult();
+    types::GenericType* pStep = static_cast<types::GenericType*>(pITStep);
     setResult(NULL);
     if (pITStep == NULL ||
-            ((pITStep->getSize() != 1 || (pITStep->isDouble() && pITStep->getAs<types::Double>()->isComplex())) &&
-             pITStep->isList() == false)) // list case => call overload
+        ((pITStep->isGenericType() == false || pStep->getSize() != 1 || (pStep->isDouble() && pStep->getAs<types::Double>()->isComplex())) &&
+        pStep->isList() == false)) // list case => call overload
     {
         pITStart->killMe();
         if (pITStep)
@@ -1511,7 +1520,6 @@ void RunVisitorT<T>::visitprivate(const ListExp &e)
         CoverageInstance::stopChrono((void*)&e);
         throw InternalError(szError, 999, e.getLocation());
     }
-    types::InternalType* piStep = pITStep;
 
     try
     {
@@ -1523,11 +1531,12 @@ void RunVisitorT<T>::visitprivate(const ListExp &e)
         throw;
     }
 
-    types::GenericType* pITEnd = static_cast<types::GenericType*>(getResult());
+    types::InternalType* pITEnd = getResult();
+    types::GenericType* pEnd = static_cast<types::GenericType*>(pITEnd);
     setResult(NULL);
     if (pITEnd == NULL ||
-            ((pITEnd->getSize() != 1 || (pITEnd->isDouble() && pITEnd->getAs<types::Double>()->isComplex())) &&
-             pITEnd->isList() == false)) // list case => call overload
+        ((pITEnd->isGenericType() == false || pEnd->getSize() != 1 || (pEnd->isDouble() && pEnd->getAs<types::Double>()->isComplex())) &&
+        pEnd->isList() == false)) // list case => call overload
     {
         pITStart->killMe();
         pITStep->killMe();
@@ -1538,11 +1547,10 @@ void RunVisitorT<T>::visitprivate(const ListExp &e)
 
         setResult(NULL);
         wchar_t szError[bsiz];
-        os_swprintf(szError, bsiz, _W("%ls: Wrong type for argument %d: Real scalar expected.\n").c_str(), L"':'", 3);
+        os_swprintf(szError, bsiz, _W("%ls: Wrong type for argument %d: Real scalar expected.\n").c_str(), L"':'", 2 + e.hasExplicitStep());
         CoverageInstance::stopChrono((void*)&e);
         throw InternalError(szError, 999, e.getLocation());
     }
-    types::InternalType* piEnd = pITEnd;
 
     ////check if implicitlist is 1:$ to replace by ':'
     //if (piStart->isDouble() && piStep->isDouble() && piEnd->isPoly())
@@ -1560,28 +1568,28 @@ void RunVisitorT<T>::visitprivate(const ListExp &e)
 
     //check compatibility
     // double : double : double or poly : poly : poly and mix like double : double : poly
-    if ((piStart->isPoly() || piStart->isDouble()) &&
-            (piStep->isPoly() || piStep->isDouble()) &&
-            (piEnd->isPoly() || piEnd->isDouble()))
+    if ((pStart->isPoly() || pStart->isDouble()) &&
+            (pStep->isPoly() || pStep->isDouble()) &&
+            (pEnd->isPoly() || pEnd->isDouble()))
     {
         // No need to kill piStart, ... because Implicit list ctor will incref them
-        setResult(new types::ImplicitList(piStart, piStep, piEnd));
+        setResult(new types::ImplicitList(pStart, pStep, pEnd));
         CoverageInstance::stopChrono((void*)&e);
         return;
     }
 
     // int : double or int : int
-    if (piStart->isInt() &&
-            (piStep->isDouble() || piStep->isInt()) &&
-            piEnd->isInt())
+    if (pStart->isInt() &&
+            (pStep->isDouble() || pStep->isInt()) &&
+            pEnd->isInt())
     {
         // check for same int type int8, int 16 ...
-        if (piStart->getType() == piEnd->getType() &&
-                (piStart->getType() == piStep->getType() ||
-                 piStep->isDouble()))
+        if (pStart->getType() == pEnd->getType() &&
+                (pStart->getType() == pStep->getType() ||
+                 pStep->isDouble()))
         {
             // No need to kill piStart, ... because Implicit list ctor will incref them
-            setResult(new types::ImplicitList(piStart, piStep, piEnd));
+            setResult(new types::ImplicitList(pStart, pStep, pEnd));
             CoverageInstance::stopChrono((void*)&e);
             return;
         }
@@ -1592,8 +1600,8 @@ void RunVisitorT<T>::visitprivate(const ListExp &e)
     types::typed_list in;
     types::typed_list out;
 
-    piStart->IncreaseRef();
-    in.push_back(piStart);
+    pStart->IncreaseRef();
+    in.push_back(pStart);
 
     try
     {
@@ -1601,20 +1609,20 @@ void RunVisitorT<T>::visitprivate(const ListExp &e)
         {
             // 1:2:4
             //call overload %typeStart_b_typeStep
-            piStep->IncreaseRef();
-            in.push_back(piStep);
-            piEnd->IncreaseRef();
-            in.push_back(piEnd);
-            Ret = Overload::call(L"%" + piStart->getShortTypeStr() + L"_b_" + piStep->getShortTypeStr(), in, 1, out, true);
+            pStep->IncreaseRef();
+            in.push_back(pStep);
+            pEnd->IncreaseRef();
+            in.push_back(pEnd);
+            Ret = Overload::call(L"%" + pStart->getShortTypeStr() + L"_b_" + pStep->getShortTypeStr(), in, 1, out, true);
         }
         else
         {
             // 1:2
             //call overload %typeStart_b_typeEnd
-            piStep->killMe();
-            piEnd->IncreaseRef();
-            in.push_back(piEnd);
-            Ret = Overload::call(L"%" + piStart->getShortTypeStr() + L"_b_" + piEnd->getShortTypeStr(), in, 1, out, true);
+            pStep->killMe();
+            pEnd->IncreaseRef();
+            in.push_back(pEnd);
+            Ret = Overload::call(L"%" + pStart->getShortTypeStr() + L"_b_" + pEnd->getShortTypeStr(), in, 1, out, true);
         }
     }
     catch (const InternalError& error)
index 93fd4a6..3eff60f 100644 (file)
@@ -313,19 +313,18 @@ ArrayOf<T>* ArrayOf<T>::insert(typed_list* _pArgs, InternalType* _pSource)
             {
                 bNeedToResize = true;
                 iNewDims = 2;
-                piNewDims = new int[2];
+                piNewDims = new int[2]{1,1};
 
-                if (getCols() == 1 || getSize() == 0)
+                if (isScalar() || getSize() == 0)
                 {
-                    //column vector
-                    piNewDims[0] = piMaxDim[0];
-                    piNewDims[1] = 1;
+                    int *piSourceDims = pSource->getDimsArray();
+                    // if source is scalar then resize indexed array as a column vector
+                    // otherwise resize with shape of source
+                    piNewDims[(int)(piSourceDims[0] == 1 && pSource->getSize()>1)]=piMaxDim[0];
                 }
-                else if (getRows() == 1)
+                else // resize with same shape as indexed array
                 {
-                    //row vector
-                    piNewDims[0] = 1;
-                    piNewDims[1] = piMaxDim[0];
+                    piNewDims[(int)(getRows() == 1)]=piMaxDim[0];
                 }
             }
         }
index bacefb0..02707ad 100644 (file)
@@ -269,18 +269,14 @@ bool ImplicitList::compute()
                 long long llStart   = convert_input(m_poStart);
                 long long llStep    = convert_input(m_poStep);
                 long long llEnd     = convert_input(m_poEnd);
-
+                
                 // step null
                 if (llStep == 0) // return []
                 {
                     m_bComputed = true;
                     return true;
                 }
-#ifdef _MSC_VER
-                m_iSize = static_cast<int>(floor( static_cast<double>(_abs64(llEnd - llStart) / _abs64(llStep)) )) + 1;
-#else
-                m_iSize = static_cast<int>(floor( static_cast<double>(llabs(llEnd - llStart) / llabs(llStep)) )) + 1;
-#endif
+                m_iSize = std::max(0,static_cast<int>(floor( static_cast<double>((llEnd - llStart) /(llStep)) )) + 1);
             }
             else
             {
@@ -295,11 +291,7 @@ bool ImplicitList::compute()
                     m_bComputed = true;
                     return true;
                 }
-#ifdef _MSC_VER
-                m_iSize = static_cast<int>(floor(static_cast<double>(_abs64(ullEnd - ullStart) / _abs64(ullStep)) )) + 1;
-#else
-                m_iSize = static_cast<int>(floor(static_cast<double>(llabs(ullEnd - ullStart) / llabs(ullStep)) )) + 1;
-#endif
+                m_iSize = std::max(0,static_cast<int>(floor( static_cast<double>((ullEnd - ullStart) /(ullStep)) )) + 1);
             }
         }
         m_bComputed = true;
index 11d0e32..9e33a42 100644 (file)
@@ -134,6 +134,11 @@ int SinglePoly::getRank()
     return m_iSize - 1;
 }
 
+double SinglePoly::getDegree()
+{
+    return m_iSize==1 && m_pRealData[0]==0 && (m_pImgData == NULL || m_pImgData[0]==0) ? -INFINITY : m_iSize - 1;
+}
+
 bool SinglePoly::setRank(int _iRank, bool bSave)
 {
     double *pR = NULL;
diff --git a/scilab/modules/ast/tests/nonreg_tests/bug_10197.tst b/scilab/modules/ast/tests/nonreg_tests/bug_10197.tst
new file mode 100644 (file)
index 0000000..b4dfee0
--- /dev/null
@@ -0,0 +1,32 @@
+// =============================================================================
+// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
+// Copyright (C) 2018 - Stéphane Mottelet
+//
+//  This file is distributed under the same license as the Scilab package.
+// =============================================================================
+//
+// <-- CLI SHELL MODE -->
+// <-- NO CHECK REF -->
+//
+// <-- Non-regression test for bug 10197 -->
+//
+// <-- Bugzilla URL -->
+// http://bugzilla.scilab.org/10197
+//
+// <-- Short Description -->
+// creating implicit vector of short integers may fail
+
+assert_checktrue(isempty(int8(1):int8(-1)));
+assert_checktrue(isempty(int16(1):int16(-1)));
+assert_checktrue(isempty(int32(1):int32(-1)));
+assert_checktrue(isempty(int64(1):int64(-1)));
+assert_checktrue(isempty(int8(120):int8(130)));
+assert_checktrue(isempty(int16(32760):int16(32770))); 
+assert_checktrue(isempty(int32(-2147483640):int32(2147483650)));
+assert_checktrue(isempty(uint8(2):uint8(0)));
+assert_checktrue(isempty(uint16(2):uint16(0)));
+assert_checktrue(isempty(uint32(2):uint32(0)));
+assert_checktrue(isempty(uint64(2):uint64(0)));
+assert_checktrue(isempty(uint8(250):uint8(260)));
+assert_checktrue(isempty(uint16(65530):uint16(65540))); 
+assert_checktrue(isempty(uint32(2):uint32(4294967297)));
diff --git a/scilab/modules/ast/tests/nonreg_tests/bug_15092.tst b/scilab/modules/ast/tests/nonreg_tests/bug_15092.tst
new file mode 100644 (file)
index 0000000..e946374
--- /dev/null
@@ -0,0 +1,44 @@
+// =============================================================================
+// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
+// Copyright (C) 2018 - Stéphane Mottelet
+//
+//  This file is distributed under the same license as the Scilab package.
+// =============================================================================
+//
+// <-- Non-regression test for bug 15092 -->
+// <-- NO CHECK REF -->
+// <-- CLI SHELL MODE -->
+//
+// <-- Bugzilla URL -->
+// http://bugzilla.scilab.org/show_bug.cgi?id=15092
+//
+// <-- Short Description -->
+// New or scalar variable is resized as a column vector instead of row vector
+
+
+x=1;
+x(1:4)=1:4;
+assert_checkequal(x,1:4);
+x=1;
+x(1:4)=(1:4)';
+assert_checkequal(x,(1:4)');
+x=[];
+x(4)=1;
+assert_checkequal(x,[0 0 0 1]');
+x=[];
+x(1:4)=1:4;
+assert_checkequal(x,1:4);
+x=[];
+x(1:4)=(1:4)';
+assert_checkequal(x,(1:4)');
+x=[1 2];
+x(1:4)=1:4;
+assert_checkequal(x,1:4);
+x(1:4)=(1:4)';
+assert_checkequal(x,1:4);
+x=[1 2]';
+x(1:4)=1:4;
+assert_checkequal(x,(1:4)');
+x(1:4)=(1:4)';
+assert_checkequal(x,(1:4)');
+
diff --git a/scilab/modules/ast/tests/nonreg_tests/bug_15609.tst b/scilab/modules/ast/tests/nonreg_tests/bug_15609.tst
new file mode 100644 (file)
index 0000000..b03a510
--- /dev/null
@@ -0,0 +1,35 @@
+// =============================================================================
+// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
+// Copyright (C) 2018 - Stéphane Mottelet
+//
+//  This file is distributed under the same license as the Scilab package.
+// =============================================================================
+// <-- CLI SHELL MODE -->
+// <-- NO CHECK REF -->
+//
+// <-- Non-regression test for bug 15609 -->
+//
+// <-- Bugzilla URL -->
+// http://bugzilla.scilab.org/show_bug.cgi?id=15609
+//
+// <-- Short Description -->
+// (1:1):2 crashes Scilab (regression)
+
+msg = sprintf(_("%ls: Too many %ls or wrong type for argument %d: Real scalar expected.\n"), "'':''", "'':''", 1);
+assert_checkerror("(1:1):2", msg);
+assert_checkerror("1:2:3:4", msg);
+assert_checkerror("(1:2:3):4", msg);
+
+ref = _("%ls: Wrong type for argument %d: Real scalar expected.\n");
+msg = sprintf(ref, "'':''", 1);
+assert_checkerror("[1 2 3]:4", msg);
+
+msg = sprintf(ref, "'':''", 2);
+assert_checkerror("1:[2 3]", msg);
+assert_checkerror("1:[2 3]:4", msg);
+assert_checkerror("1:(2:3)", msg);
+assert_checkerror("1:(2:3):4", msg);
+
+msg = sprintf(ref, "'':''", 3);
+assert_checkerror("1:2:(3:4)", msg);
+assert_checkerror("1:2:[3 4]", msg);
index 48f1472..d1d2c58 100644 (file)
@@ -2,6 +2,7 @@
 <!--
  * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
  * Copyright (C) 2008 - INRIA
+ * Copyright (C) 2018 - Samuel GOUGEON
  *
  * Copyright (C) 2012 - 2016 - Scilab Enterprises
  *
  * along with this program.
  *
  -->
-<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="minus" xml:lang="en">
+<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="minus" xml:lang="en">
     <refnamediv>
         <refname>minus</refname>
-        <refpurpose>(-) subtraction operator, sign changes</refpurpose>
+        <refpurpose>(-) subtraction operator. Sign change</refpurpose>
     </refnamediv>
     <refsynopsisdiv>
         <title>Syntax</title>
         <synopsis>
-            X-Y
-            -Y
+            X - Y
+            -X
         </synopsis>
     </refsynopsisdiv>
     <refsection>
         <title>Arguments</title>
         <variablelist>
             <varlistentry>
-                <term>X</term>
+                <term>X, Y</term>
                 <listitem>
-                    <para>scalar or vector or matrix of numbers, polynomials or
-                        rationals. It may also be a <literal>syslin</literal> list.
-                    </para>
-                </listitem>
-            </varlistentry>
-            <varlistentry>
-                <term>Y</term>
-                <listitem>
-                    <para>scalar or vector or matrix of numbers, polynomials or
-                        rationals. It may also be a <literal>syslin</literal> list.
+                    <para>
+                        scalars, vectors, matrices, or hypermatrices of booleans, numbers,
+                        polynomials or rationals.
+                        They may also be some <literal>syslin</literal> lists.
                     </para>
                 </listitem>
             </varlistentry>
     <refsection>
         <title>Description</title>
         <para>Subtraction</para>
-        <para>For numeric operands subtraction as its usual meaning. If one of
-            the operands is a matrix and the other one a scalar then the operation is
-            performed element-wise. For <literal>X - Y</literal>, if <literal>Y == []</literal> or <literal>Y == []</literal> then <literal>[]</literal> is returned;
+        <para>
+            For numeric operands, the subtraction has its usual meaning. If one of
+            the operands is a scalar, then the substraction is performed with each component of
+            the other operand.
+        </para>
+        <para>
+            As soon as a boolean is involved in a substraction with a number (decimal, complex,
+            or encoded integer), it is automatically converted in the type (and integer type)
+            of the number before performing the substraction or the sign change, as
+            <literal>%F => 0</literal> and <literal>%T => 1</literal>.
         </para>
-        <para>Subtraction may also be defined for other data types through
-            "soft-coded" operations (see <link linkend="overloading">overloading</link>).
+        <para>
+            Whatever is the (regular) type of <varname>X</varname>, then <literal>[]-X</literal>,
+            <literal>X-[]</literal>, and <literal>-[]</literal> return <literal>[]</literal>.
+        </para>
+        <para>
+            The subtraction operator may be extended to other custom data types through the
+            <link linkend="overloading">overloading</link> mechanism.
         </para>
     </refsection>
     <refsection>
         <title>Examples</title>
         <programlisting role="example"><![CDATA[
-[1,2]-1
-[]-2
+[] - 2
+1 - []
+[2, 5] - 1
+[2, 5] - [3 -2]
+
+%s - 2
+1/%s - 2
+]]></programlisting>
+    <screen><![CDATA[
+--> [] - 2
+ ans  =
+    []
+
+--> 1 - []
+ ans  =
+    []
+
+--> [2, 5] - 1
+ ans  =
+   1.   4.
+
+--> [2, 5] - [3 -2]
+ ans  =
+  -1.   7.
+
+--> %s - 2
+ ans  =
+  -2 +s
 
-%s-2
-1/%s-2
+--> 1/%s - 2
+ ans  =
+   1 - 2s
+   -------
+     s
+]]></screen>
+    <para>With booleans:</para>
+        <programlisting role="example"><![CDATA[
+-[%f %t]
+[%f %f %t %t]  - [%f %t %f %t]
+%t - %i
+c = %t - int8(7), inttype(c)
  ]]></programlisting>
+    <screen><![CDATA[
+--> -[%f %t]
+ ans  =
+   0.  -1.
+
+--> [%f %f %t %t]  - [%f %t %f %t]
+ ans  =
+   0.  -1.   1.   0.
+
+--> %t - %i
+ ans  =
+   1. - i
+
+--> c = %t - int8(7), typeof(c)
+ c  =
+ -6
+
+ ans  =
+ int8
+]]></screen>
     </refsection>
     <refsection role="see also">
         <title>See also</title>
         <simplelist type="inline">
             <member>
-                <link linkend="mtlb_mode">mtlb_mode</link>
+                <link linkend="plus">plus</link>
             </member>
             <member>
-                <link linkend="plus">plus</link>
+                <link linkend="symbols">operators</link>
             </member>
             <member>
                 <link linkend="overloading">overloading</link>
             </member>
+            <member>
+                <link linkend="oldEmptyBehaviour">oldEmptyBehaviour</link>
+            </member>
+            <member>
+                <link linkend="mtlb_s">mtlb_s</link>
+            </member>
         </simplelist>
     </refsection>
     <refsection>
             <revision>
                 <revnumber>6.0.0</revnumber>
                 <revremark>
-                    Modified the behaviour of <literal>A- []</literal> and <literal>[] - A</literal> to return the empty matrix <literal>[]</literal> instead of <literal>A</literal> or <literal>-A</literal>
+                    <literal>A - []</literal> and <literal>[] - A</literal> now return
+                    <literal>[]</literal> instead of <literal>A</literal> or <literal>-A</literal>.
                 </revremark>
             </revision>
         </revhistory>
index e493a43..9ba6bbc 100644 (file)
@@ -1,14 +1,32 @@
 <?xml version="1.0" encoding="UTF-8"?>
-<refentry xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:svg="http://www.w3.org/2000/svg" xmlns:mml="http://www.w3.org/1998/Math/MathML" xmlns:db="http://docbook.org/ns/docbook" xmlns:scilab="http://www.scilab.org" xml:lang="en" xml:id="plus">
+<!--
+ * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
+ * Copyright (C) ???? - INRIA
+ * Copyright (C) 2018 - Samuel GOUGEON
+ *
+ * Copyright (C) 2012 - 2016 - Scilab Enterprises
+ *
+ * This file is hereby licensed under the terms of the GNU GPL v2.0,
+ * pursuant to article 5.3.4 of the CeCILL v.2.1.
+ * This file was originally licensed under the terms of the CeCILL v2.1,
+ * and continues to be available under such terms.
+ * For more information, see the COPYING file which you should have received
+ * along with this program.
+ *
+ -->
+<refentry xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink"
+        xmlns:svg="http://www.w3.org/2000/svg" xmlns:mml="http://www.w3.org/1998/Math/MathML"
+        xmlns:db="http://docbook.org/ns/docbook" xmlns:scilab="http://www.scilab.org"
+        xml:lang="en" xml:id="plus">
     <refnamediv>
-        <refname>plus</refname>
-        <refpurpose>(+)  addition operator</refpurpose>
+        <refname>plus (+)</refname>
+        <refpurpose>Numerical addition. Text concatenation (gluing)</refpurpose>
     </refnamediv>
     <refsynopsisdiv>
         <title>Syntax</title>
         <synopsis>
-            X+Y
-            str1+str2
+            X + Y
+            str1 + str2
         </synopsis>
     </refsynopsisdiv>
     <refsection>
                 <term>X,Y</term>
                 <listitem>
                     <para>
-                        scalar or vector or matrix of numbers, polynomials or rationals. It may also be a <literal>syslin</literal> list
+                        scalars, vectors, matrices or hypermatrices of booleans, numbers,
+                        polynomials, or rationals. They may also be <literal>syslin</literal> lists.
                     </para>
                 </listitem>
             </varlistentry>
             <varlistentry>
-                <term>str1,str2</term>
+                <term>str1, str2</term>
                 <listitem>
-                    <para>a character string, a vector or a matrix of character strings</para>
+                    <para>two texts, vectors, matrices, or hypermatrices of texts.</para>
                 </listitem>
             </varlistentry>
         </variablelist>
     <refsection>
         <title>Description</title>
         <para>
-            Addition.
+            For numeric operands, the addition has its usual meaning.
         </para>
         <para>
-            For numeric operands addition as its usual meaning.
-            If one of the operands is a matrix and the other one a scalar the
-            scalar is added to each matrix entries. If one of the operands is an
-            empty matrix the empty matrix <literal>[]</literal> is returned).
+            Adding booleans together or to numbers of integer, decimal or complex type
+            performs the implicit conversions <literal>%F => 0</literal> and <literal>%T => 1</literal>
+            before processing. The result has the type of the input numbers, or is decimal for
+            booleans added together.
         </para>
         <para>
-            For character strings <literal>+</literal> means concatenation.
+            For two texts, <literal>+</literal> concatenates (glues) them together.
         </para>
         <para>
-            Addition may also be defined for other data types through
-            "soft-coded" operations (see <link linkend="overloading">overloading</link>).
+            If an operand is an array and the other one is a scalar, the scalar is applied
+            (added or glued) to each component of the array.
+        </para>
+        <para>
+            If an operand is the empty matrix <literal>[]</literal>, the result is <literal>[]</literal>.
+        </para>
+        <para>
+            The addition operator may be extended to other data types through
+            <link linkend="overloading">overloading</link>.
         </para>
     </refsection>
     <refsection>
         <title>Examples</title>
         <programlisting role="example"><![CDATA[
-[1,2]+1
-[]+2
-s=poly(0,"s");
-s+2
-1/s+2
-"con"+"cat"+"enate"
+[1, 2] + 1
+[] + 2
+%s + 2
+1/%s + %s
+"con" + ["catenate" "crete" "sole"]
+ ]]></programlisting>
+    <screen><![CDATA[
+--> [1, 2] + 1
+ ans  =
+   2.   3.
+
+--> [] + 2
+ ans  =
+    []
+
+--> %s + 2
+ ans  =
+   2 +s
+
+--> 1/%s + %s
+ ans  =
+        2
+   1 + s
+   ------
+     s
+
+--> "con" + ["catenate" "crete" "sole"]
+ ans  =
+!concatenate  concrete  console  !
+]]></screen>
+    <para>With booleans:</para>
+        <programlisting role="example"><![CDATA[
+[%f %f %t %t] + [%f %t %f %t]
+%f + [-1 0 2 %i]
+%t + [-1 0 2 %i]
  ]]></programlisting>
+    <screen><![CDATA[
+--> [%f %f %t %t] + [%f %t %f %t]
+ ans  =
+   0.   1.   1.   2.
+
+--> %f + [-1 0 2 %i]
+ ans  =
+  -1.   0.   2.   i
+
+--> %t + [-1 0 2 %i]
+ ans  =
+   0.   1.   3.   1. + i
+]]></screen>
     </refsection>
     <refsection role="see also">
         <title>See also</title>
         <simplelist type="inline">
             <member>
-                <link linkend="mtlb_mode">mtlb_mode</link>
+                <link linkend="minus">minus</link>
+            </member>
+            <member>
+                <link linkend="symbols">operators</link>
             </member>
             <member>
                 <link linkend="overloading">overloading</link>
             </member>
+            <member>
+                <link linkend="oldEmptyBehaviour">oldEmptyBehaviour</link>
+            </member>
+            <member>
+                <link linkend="mtlb_a">mtlb_a</link>
+            </member>
         </simplelist>
     </refsection>
     <refsection>
@@ -76,7 +153,10 @@ s+2
         <revhistory>
             <revision>
                 <revnumber>6.0.0</revnumber>
-                <revremark>Modified the behaviour of <literal>A + []</literal> to be the empty matrix <literal>[]</literal> instead of <literal>A</literal></revremark>
+                <revremark>
+                    <literal>A + []</literal> now returns <literal>[]</literal> instead of
+                    <literal>A</literal>
+                </revremark>
             </revision>
         </revhistory>
     </refsection>
index 9fedd3a..d7c3c66 100644 (file)
@@ -1,5 +1,23 @@
 <?xml version="1.0" encoding="UTF-8"?>
-<refentry xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:svg="http://www.w3.org/2000/svg" xmlns:mml="http://www.w3.org/1998/Math/MathML" xmlns:db="http://docbook.org/ns/docbook" xmlns:scilab="http://www.scilab.org" xml:lang="fr" xml:id="minus">
+<!--
+ * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
+ * Copyright (C) 2008 - INRIA
+ * Copyright (C) 2018 - Samuel GOUGEON
+ *
+ * Copyright (C) 2012 - 2016 - Scilab Enterprises
+ *
+ * This file is hereby licensed under the terms of the GNU GPL v2.0,
+ * pursuant to article 5.3.4 of the CeCILL v.2.1.
+ * This file was originally licensed under the terms of the CeCILL v2.1,
+ * and continues to be available under such terms.
+ * For more information, see the COPYING file which you should have received
+ * along with this program.
+ *
+ -->
+<refentry xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink"
+        xmlns:svg="http://www.w3.org/2000/svg" xmlns:mml="http://www.w3.org/1998/Math/MathML"
+        xmlns:db="http://docbook.org/ns/docbook" xmlns:scilab="http://www.scilab.org"
+        xml:lang="fr" xml:id="minus">
     <refnamediv>
         <refname>minus (-)</refname>
         <refpurpose>opérateur de soustraction, changement de signe  </refpurpose>
         <title>Paramètres</title>
         <variablelist>
             <varlistentry>
-                <term>X  </term>
+                <term>X, Y</term>
                 <listitem>
                     <para>
-                        scalaire, vecteur ou matrice de nombres, polynômes ou fractions rationnelles, ou liste de type <literal>syslin</literal>.
-                    </para>
-                </listitem>
-            </varlistentry>
-            <varlistentry>
-                <term>Y  </term>
-                <listitem>
-                    <para>
-                        scalaire, vecteur ou matrice de nombres, polynômes ou fractions rationnelles, ou liste de type <literal>syslin</literal>.
+                        scalaires, vecteurs, matrices ou hypermatrices de booléens, nombres,
+                        polynômes ou fractions rationnelles, ou liste de type <literal>syslin</literal>.
                     </para>
                 </listitem>
             </varlistentry>
             Soustraction
         </para>
         <para>
-            Pour les opérandes numériques la signification est celle de la soustraction habituelle. Si l'un des opérandes est une matrice (ou un vecteur) et l'autre un scalaire l'opération est effectuée pour chaque élément de la matrice. Si <literal>Y==[]</literal> le résultat est <literal>X</literal>. Si <literal>X==[]</literal> le résultat est <literal>-Y</literal>.
+            Pour les opérandes numériques, la signification est celle de la soustraction habituelle.
+            Si l'un des opérandes est un scalaire, l'opération est effectuée sur chaque élément
+            de l'autre opérande.
+        </para>
+        <para>
+            Dés que des booléens sont impliqués dans une soustraction avec des nombres (décimaux,
+            complexes, ou entiers encodés), ils sont automatiquement convertis dans le type numérique
+            considéré avant d'effectuer la soustraction, avec
+            <literal>%F => 0</literal> et <literal>%T => 1</literal>.
+        </para>
+        <para>
+            Quel que soit le type (régulier) de <varname>X</varname>, alors <literal>[]-X</literal>,
+            <literal>X-[]</literal>, et <literal>-[]</literal> produisent <literal>[]</literal>.
         </para>
         <para>
-            La soustraction peut être aussi définie pour d'autres types de données via
+            La soustraction peut être définie pour d'autres types de données via
             la surcharge d'opérateurs (voir <link linkend="overloading">overloading</link>).
         </para>
     </refsection>
     <refsection>
         <title>Exemples</title>
         <programlisting role="example"><![CDATA[
-[1,2]-1
-[]-2
+[] - 2
+1 - []
+[2, 5] - 1
+[2, 5] - [3 -2]
+
+%s - 2
+1/%s - 2
+]]></programlisting>
+    <screen><![CDATA[
+--> [] - 2
+ ans  =
+    []
+
+--> 1 - []
+ ans  =
+    []
+
+--> [2, 5] - 1
+ ans  =
+   1.   4.
+
+--> [2, 5] - [3 -2]
+ ans  =
+  -1.   7.
 
-%s-2
-1/%s-2
-"cat"+"enate"
+--> %s - 2
+ ans  =
+  -2 +s
+
+--> 1/%s - 2
+ ans  =
+   1 - 2s
+   -------
+     s
+]]></screen>
+    <para>Avec des booléens :</para>
+        <programlisting role="example"><![CDATA[
+-[%f %t]
+[%f %f %t %t]  - [%f %t %f %t]
+%t - %i
+c = %t - int8(7), inttype(c)
  ]]></programlisting>
+    <screen><![CDATA[
+--> -[%f %t]
+ ans  =
+   0.  -1.
+
+--> [%f %f %t %t]  - [%f %t %f %t]
+ ans  =
+   0.  -1.   1.   0.
+
+--> %t - %i
+ ans  =
+   1. - i
+
+--> c = %t - int8(7), typeof(c)
+ c  =
+ -6
+
+ ans  =
+ int8
+]]></screen>
     </refsection>
     <refsection role="see also">
         <title>Voir aussi</title>
         <simplelist type="inline">
             <member>
-                <link linkend="mtlb_mode">mtlb_mode</link>
+                <link linkend="plus">plus</link>
             </member>
             <member>
-                <link linkend="plus">plus</link>
+                <link linkend="symbols">operators</link>
             </member>
             <member>
                 <link linkend="overloading">overloading</link>
             </member>
+            <member>
+                <link linkend="oldEmptyBehaviour">oldEmptyBehaviour</link>
+            </member>
+            <member>
+                <link linkend="mtlb_s">mtlb_s</link>
+            </member>
         </simplelist>
     </refsection>
+    <refsection>
+        <title>Historique</title>
+        <revhistory>
+            <revision>
+                <revnumber>6.0.0</revnumber>
+                <revremark>
+                    <literal>A - []</literal> et <literal>[] - A</literal> produisent désormais
+                    <literal>[]</literal> au lieu de <literal>A</literal> ou <literal>-A</literal>.
+                </revremark>
+            </revision>
+        </revhistory>
+    </refsection>
 </refentry>
index 19cdfc0..d4585cb 100644 (file)
@@ -1,31 +1,51 @@
 <?xml version="1.0" encoding="UTF-8"?>
-<refentry xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:svg="http://www.w3.org/2000/svg" xmlns:mml="http://www.w3.org/1998/Math/MathML" xmlns:db="http://docbook.org/ns/docbook" xmlns:scilab="http://www.scilab.org" xml:lang="fr" xml:id="plus">
+<!--
+ * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
+ * Copyright (C) ???? - INRIA
+ * Copyright (C) 2018 - Samuel GOUGEON
+ *
+ * Copyright (C) 2012 - 2016 - Scilab Enterprises
+ *
+ * This file is hereby licensed under the terms of the GNU GPL v2.0,
+ * pursuant to article 5.3.4 of the CeCILL v.2.1.
+ * This file was originally licensed under the terms of the CeCILL v2.1,
+ * and continues to be available under such terms.
+ * For more information, see the COPYING file which you should have received
+ * along with this program.
+ *
+ -->
+<refentry xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink"
+        xmlns:svg="http://www.w3.org/2000/svg" xmlns:mml="http://www.w3.org/1998/Math/MathML"
+        xmlns:db="http://docbook.org/ns/docbook" xmlns:scilab="http://www.scilab.org"
+        xml:lang="fr" xml:id="plus">
     <refnamediv>
         <refname>plus (+)</refname>
-        <refpurpose>opérateur d'addition  </refpurpose>
+        <refpurpose>Addition numérique. Concaténation (collage) de textes entre eux</refpurpose>
     </refnamediv>
     <refsynopsisdiv>
         <title>Séquence d'appel</title>
         <synopsis>
-            X+Y
-            str1+str2
+            X + Y
+            str1 + str2
         </synopsis>
     </refsynopsisdiv>
     <refsection>
-        <title>Paramètres</title>
+        <title>Arguments</title>
         <variablelist>
             <varlistentry>
                 <term>X,Y  </term>
                 <listitem>
                     <para>
-                        matrice réelle, complexe, polynomiale, rationnelle ou liste de type <literal>syslin</literal>
+                        matrices booléennes, réelles, complexes, polynomiales, de fractions
+                        rationnelles, ou listes <literal>syslin</literal> représentant un système linéaire.
                     </para>
                 </listitem>
             </varlistentry>
             <varlistentry>
                 <term>str1,str2  </term>
                 <listitem>
-                    <para>chaîne de caractères ou matrice de chaînes de caractères
+                    <para>
+                        textes uniques, ou vecteurs ou matrices de textes.
                     </para>
                 </listitem>
             </varlistentry>
     <refsection>
         <title>Description</title>
         <para>
-            Addition.
+            Pour deux opérandes numériques, l'addition a sa signification et son résultat habituels.
+        </para>
+        <para>
+            Ajouter des booléens entre eux ou à des nombres de type entier, décimal, ou complexe
+            effectue les conversions implicites <literal>%F => 0</literal> et
+            <literal>%T => 1</literal> avant les additions. Le résultat a le type des nombres
+            en entrée, ou est de type décimal pour des booléens ajoutés entre eux.
+        </para>
+        <para>
+            <literal>+</literal> appliquée entre deux textes les concatène (colle) entre eux.
         </para>
         <para>
-            Pour des opérandes numériques l'addition a la signification habituelle.
-            Si l'un des opérandes est une matrice et l'autre un scalaire, ce dernier est ajouté à tous les termes de la matrice. Si l'un des opérandes est une matrice vide, le résultat est égal à l'autre opérande (ce comportement par défaut peut être modifié avec <literal>mtlb_mode</literal>).
+            Si un opérande est un tableau et l'autre est un élément unique (scalaire), le scalaire
+            est appliqué (ajouté ou collé) à chaque élément du tableau.
         </para>
         <para>
-            Pour les chaînes de caractères <literal>+</literal> désigne la concaténation.
+            Si un opérande est la matrice vide <literal>[]</literal>, le résultat est <literal>[]</literal>.
         </para>
         <para>
-            L'addition peut être redéfinie pour de nouveaux types d'objets en utilisant la surcharge d'opérateurs (voir <link linkend="overloading">overloading</link>).
+           L'opérateur "+" peut être étendu à d'autres types d'opérandes par surcharge
+           (voir <link linkend="overloading">overloading</link>).
         </para>
     </refsection>
     <refsection>
         <title>Exemples</title>
         <programlisting role="example"><![CDATA[
-[1,2]+1
-[]+2
-s=poly(0,"s");
-s+2
-1/s+2
-"conca"+"tener"
+[1, 2] + 1
+[] + 2
+%s + 2
+1/%s + %s
+"con" + ["catenate" "crete" "sole"]
+ ]]></programlisting>
+    <screen><![CDATA[
+--> [1, 2] + 1
+ ans  =
+   2.   3.
+
+--> [] + 2
+ ans  =
+    []
+
+--> %s + 2
+ ans  =
+   2 +s
+
+--> 1/%s + %s
+ ans  =
+        2
+   1 + s
+   ------
+     s
+
+--> "con" + ["catenate" "crete" "sole"]
+ ans  =
+!concatenate  concrete  console  !
+]]></screen>
+    <para>Avec des booléeens :</para>
+        <programlisting role="example"><![CDATA[
+[%f %f %t %t] + [%f %t %f %t]
+%f + [-1 0 2 %i]
+%t + [-1 0 2 %i]
  ]]></programlisting>
+    <screen><![CDATA[
+--> [%f %f %t %t] + [%f %t %f %t]
+ ans  =
+   0.   1.   1.   2.
+
+--> %f + [-1 0 2 %i]
+ ans  =
+  -1.   0.   2.   i
+
+--> %t + [-1 0 2 %i]
+ ans  =
+   0.   1.   3.   1. + i
+]]></screen>
     </refsection>
     <refsection role="see also">
         <title>Voir aussi</title>
         <simplelist type="inline">
             <member>
-                <link linkend="mtlb_mode">mtlb_mode</link>
+                <link linkend="minus">minus</link>
+            </member>
+            <member>
+                <link linkend="symbols">operators</link>
             </member>
             <member>
                 <link linkend="overloading">overloading</link>
             </member>
+            <member>
+                <link linkend="oldEmptyBehaviour">oldEmptyBehaviour</link>
+            </member>
+            <member>
+                <link linkend="mtlb_a">mtlb_a</link>
+            </member>
         </simplelist>
     </refsection>
+    <refsection>
+        <title>Historique</title>
+        <revhistory>
+            <revision>
+                <revnumber>6.0.0</revnumber>
+                <revremark>
+                    <literal>A + []</literal> produit désormais <literal>[]</literal> au lieu de
+                    <literal>A</literal>
+                </revremark>
+            </revision>
+        </revhistory>
+    </refsection>
 </refentry>
index ade0501..11562ba 100644 (file)
@@ -2,6 +2,7 @@
 <!--
  * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
  * Copyright (C) 2008 - INRIA
+ * Copyright (C) 2018 - Samuel GOUGEON
  *
  * Copyright (C) 2012 - 2016 - Scilab Enterprises
  *
  * along with this program.
  *
  -->
-<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="minus" xml:lang="ja">
+<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="minus" xml:lang="ja">
     <refnamediv>
         <refname>minus</refname>
         <refpurpose>(-) 減算演算子, 符号変更</refpurpose>
     </refnamediv>
     <refsynopsisdiv>
         <title>呼び出し手順</title>
-        <synopsis>X-Y
+        <synopsis>
+            X - Y
             -Y
         </synopsis>
     </refsynopsisdiv>
         <title>引数</title>
         <variablelist>
             <varlistentry>
-                <term>X</term>
+                <term>X, Y</term>
                 <listitem>
                     <para>
-                        数値,多項式または有理数のスカラーまたはベクトルまたは行列. <literal>syslin</literal>リストを指定することも可能です.
-                    </para>
-                </listitem>
-            </varlistentry>
-            <varlistentry>
-                <term>Y</term>
-                <listitem>
-                    <para>数値,多項式または有理数のスカラーまたはベクトルまたは行列.
+                        数値,多項式または有理数のスカラーまたはベクトルまたは行列.
                         <literal>syslin</literal>リストを指定することも可能です.
                     </para>
                 </listitem>
             <literal>X==[]</literal>の場合, <literal>-Y</literal>が返されます.
         </para>
         <para>
+            As soon as a boolean is involved in a substraction with a number (decimal, complex,
+            or encoded integer), it is automatically converted in the type (and integer type)
+            of the number before performing the substraction or the sign change, as
+            <literal>%F => 0</literal> and <literal>%T => 1</literal>.
+        </para>
+        <para>
+            Whatever is the (regular) type of <varname>X</varname>, then <literal>[]-X</literal>,
+            <literal>X-[]</literal>, and <literal>-[]</literal> return <literal>[]</literal>.
+        </para>
+        <para>
             減算は,"ソフトコードされた"演算により他のデータ型についても
             定義できます
             (<link linkend="overloading">オーバーローディング</link>参照).
     <refsection>
         <title>例</title>
         <programlisting role="example"><![CDATA[
-[1,2]-1
-[]-2
+[] - 2
+1 - []
+[2, 5] - 1
+[2, 5] - [3 -2]
+
+%s - 2
+1/%s - 2
+]]></programlisting>
+    <screen><![CDATA[
+--> [] - 2
+ ans  =
+    []
+
+--> 1 - []
+ ans  =
+    []
+
+--> [2, 5] - 1
+ ans  =
+   1.   4.
+
+--> [2, 5] - [3 -2]
+ ans  =
+  -1.   7.
+
+--> %s - 2
+ ans  =
+  -2 +s
 
-%s-2
-1/%s-2
+--> 1/%s - 2
+ ans  =
+   1 - 2s
+   -------
+     s
+]]></screen>
+    <para>With booleans:</para>
+        <programlisting role="example"><![CDATA[
+-[%f %t]
+[%f %f %t %t]  - [%f %t %f %t]
+%t - %i
+c = %t - int8(7), inttype(c)
  ]]></programlisting>
+    <screen><![CDATA[
+--> -[%f %t]
+ ans  =
+   0.  -1.
+
+--> [%f %f %t %t]  - [%f %t %f %t]
+ ans  =
+   0.  -1.   1.   0.
+
+--> %t - %i
+ ans  =
+   1. - i
+
+--> c = %t - int8(7), typeof(c)
+ c  =
+ -6
+
+ ans  =
+ int8
+]]></screen>
     </refsection>
     <refsection role="see also">
         <title>参照</title>
         <simplelist type="inline">
             <member>
-                <link linkend="mtlb_mode">mtlb_mode</link>
+                <link linkend="plus">plus</link>
             </member>
             <member>
-                <link linkend="plus">plus</link>
+                <link linkend="symbols">operators</link>
             </member>
             <member>
                 <link linkend="overloading">overloading</link>
             </member>
+            <member>
+                <link linkend="oldEmptyBehaviour">oldEmptyBehaviour</link>
+            </member>
+            <member>
+                <link linkend="mtlb_s">mtlb_s</link>
+            </member>
         </simplelist>
     </refsection>
+    <refsection>
+        <title>履歴</title>
+        <revhistory>
+            <revision>
+                <revnumber>6.0.0</revnumber>
+                <revremark>
+                    <literal>A - []</literal> and <literal>[] - A</literal> now return
+                    <literal>[]</literal> instead of <literal>A</literal> or <literal>-A</literal>.
+                </revremark>
+            </revision>
+        </revhistory>
+    </refsection>
 </refentry>
index ad6e41e..4d49f2a 100644 (file)
@@ -1,14 +1,32 @@
 <?xml version="1.0" encoding="UTF-8"?>
-<refentry xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:svg="http://www.w3.org/2000/svg" xmlns:mml="http://www.w3.org/1998/Math/MathML" xmlns:db="http://docbook.org/ns/docbook" xmlns:scilab="http://www.scilab.org" xml:lang="ja" xml:id="plus">
+<!--
+ * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
+ * Copyright (C) ???? - INRIA
+ * Copyright (C) 2018 - Samuel GOUGEON
+ *
+ * Copyright (C) 2012 - 2016 - Scilab Enterprises
+ *
+ * This file is hereby licensed under the terms of the GNU GPL v2.0,
+ * pursuant to article 5.3.4 of the CeCILL v.2.1.
+ * This file was originally licensed under the terms of the CeCILL v2.1,
+ * and continues to be available under such terms.
+ * For more information, see the COPYING file which you should have received
+ * along with this program.
+ *
+ -->
+ <refentry xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink"
+        xmlns:svg="http://www.w3.org/2000/svg" xmlns:mml="http://www.w3.org/1998/Math/MathML"
+        xmlns:db="http://docbook.org/ns/docbook" xmlns:scilab="http://www.scilab.org"
+        xml:lang="ja" xml:id="plus">
     <refnamediv>
-        <refname>plus</refname>
-        <refpurpose>(+)  加算演算子</refpurpose>
+        <refname>plus (+)</refname>
+        <refpurpose>数値の加算。 テキストの連結(グループ化)</refpurpose>
     </refnamediv>
     <refsynopsisdiv>
         <title>呼出し手順</title>
         <synopsis>
-            X+Y
-            str1+str2
+            X + Y
+            str1 + str2
         </synopsis>
     </refsynopsisdiv>
     <refsection>
                 </listitem>
             </varlistentry>
             <varlistentry>
-                <term>str1,str2</term>
+                <term>str1, str2</term>
                 <listitem>
-                    <para>文字列, 文字列のベクトルまたは行列</para>
+                    <para>
+                        2つのテキスト、ベクトル、またはテキストの行列。
+                    </para>
                 </listitem>
             </varlistentry>
         </variablelist>
     <refsection>
         <title>説明</title>
         <para>
-            加算.
+            数値オペランドの場合、加算は通常の意味を持ちます。
+        </para>
+        <para>
+            Adding booleans together or to numbers of integer, decimal or complex type
+            performs the implicit conversions <literal>%F => 0</literal> and <literal>%T => 1</literal>
+            before processing. The result has the type of the input numbers, or is decimal for
+            booleans added together.
         </para>
         <para>
-            オペランドが数値の場合,通常の加算が行われます.
-            オペランドの一つが行列でもう一つがスカラーの場合,
-            そのスカラーが行列の各エントリに加算されます.
-            オペランドの一つが空の行列の場合,もう一方のオペランドが
-            返されます (このデフォルトの動作は
-            関数 <literal>mtlb_mode</literal>で修正できます).
+            2つのテキストの場合、<literal>+</literal>はそれらを連結します(glues)。
         </para>
         <para>
-            文字列の場合, <literal>+</literal> は結合を意味します.
+            オペランドが配列であり、もう一方がスカラーの場合、スカラーが適用されます
+            アレイの各構成要素に追加(接着または接着)される。
         </para>
         <para>
-            "ソフトウエアで定義した"演算子により,
-            加算を他のデータ型に関しても定義できます
-            (<literal>overloading</literal>参照).
+            オペランドが空の行列[]である場合、結果は<literal>[]</literal>です。
+        </para>
+        <para>
+            加算演算子は、他のデータ型に拡張することができます (<link linkend="overloading">overloading</link>).
         </para>
     </refsection>
     <refsection>
         <title>例</title>
         <programlisting role="example"><![CDATA[
-[1,2]+1
-[]+2
-s=poly(0,"s");
-s+2
-1/s+2
-"con"+"cat"+"enate"
+[1, 2] + 1
+[] + 2
+%s + 2
+1/%s + %s
+"con" + ["catenate" "crete" "sole"]
+ ]]></programlisting>
+    <screen><![CDATA[
+--> [1, 2] + 1
+ ans  =
+   2.   3.
+
+--> [] + 2
+ ans  =
+    []
+
+--> %s + 2
+ ans  =
+   2 +s
+
+--> 1/%s + %s
+ ans  =
+        2
+   1 + s
+   ------
+     s
+
+--> "con" + ["catenate" "crete" "sole"]
+ ans  =
+!concatenate  concrete  console  !
+]]></screen>
+    <para>With booleans:</para>
+        <programlisting role="example"><![CDATA[
+[%f %f %t %t] + [%f %t %f %t]
+%f + [-1 0 2 %i]
+%t + [-1 0 2 %i]
  ]]></programlisting>
+    <screen><![CDATA[
+--> [%f %f %t %t] + [%f %t %f %t]
+ ans  =
+   0.   1.   1.   2.
+
+--> %f + [-1 0 2 %i]
+ ans  =
+  -1.   0.   2.   i
+
+--> %t + [-1 0 2 %i]
+ ans  =
+   0.   1.   3.   1. + i
+]]></screen>
     </refsection>
     <refsection role="see also">
         <title>参照</title>
         <simplelist type="inline">
             <member>
-                <link linkend="mtlb_mode">mtlb_mode</link>
+                <link linkend="minus">minus</link>
+            </member>
+            <member>
+                <link linkend="symbols">operators</link>
             </member>
             <member>
                 <link linkend="overloading">overloading</link>
             </member>
+            <member>
+                <link linkend="oldEmptyBehaviour">oldEmptyBehaviour</link>
+            </member>
+            <member>
+                <link linkend="mtlb_a">mtlb_a</link>
+            </member>
         </simplelist>
     </refsection>
+    <refsection>
+        <title>履歴</title>
+        <revhistory>
+            <revision>
+                <revnumber>6.0.0</revnumber>
+                <revremark>
+                    <literal>A + []</literal> now returns <literal>[]</literal> instead of
+                    <literal>A</literal>
+                </revremark>
+            </revision>
+        </revhistory>
+    </refsection>
 </refentry>
index 9e14348..c655fe1 100644 (file)
@@ -1,7 +1,8 @@
-<?xml version="1.0" encoding="ISO-8859-1"?>
+<?xml version="1.0" encoding="UTF-8"?>
 <!--
  * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
  * Copyright (C) 2008 - INRIA
+ * Copyright (C) 2018 - Samuel GOUGEON
  *
  * Copyright (C) 2012 - 2016 - Scilab Enterprises
  *
  * along with this program.
  *
  -->
-<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="minus" xml:lang="pt">
+<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="minus" xml:lang="pt">
     <refnamediv>
         <refname>minus</refname>
-        <refpurpose>(-) operador de subtração, mudança de sinal</refpurpose>
+        <refpurpose>(-) operador de subtração, mudança de sinal</refpurpose>
     </refnamediv>
     <refsynopsisdiv>
-        <title>Seqüência de Chamamento</title>
+        <title>Seqüência de Chamamento</title>
         <synopsis>X-Y
             -Y
         </synopsis>
     </refsynopsisdiv>
     <refsection>
-        <title>Parâmetros</title>
+        <title>Parâmetros</title>
         <variablelist>
             <varlistentry>
                 <term>X</term>
                 <listitem>
-                    <para>escalar, vetor ou matriz de números, polinômios ou razões de
-                        polinômios. Também pode ser uma lista
+                    <para>escalar, vetor ou matriz de números, polinômios ou razões de
+                        polinômios. Também pode ser uma lista
                         <literal>syslin</literal>
                     </para>
                 </listitem>
             <varlistentry>
                 <term>Y</term>
                 <listitem>
-                    <para>escalar, vetor ou matriz de números, polinômios ou razões de
-                        polinômios. Também pode ser uma lista <literal>syslin</literal>
+                    <para>escalar, vetor ou matriz de números, polinômios ou razões de
+                        polinômios. Também pode ser uma lista <literal>syslin</literal>
                     </para>
                 </listitem>
             </varlistentry>
         </variablelist>
     </refsection>
     <refsection>
-        <title>Descrição</title>
-        <para>Subtração</para>
-        <para>Para operandos numéricos, é a operação de subtração em seu sentido
-            usual. Se um dos operandos é uma matriz e o outro um escalar, a operção é
-            realizada elemento a elemento. Se <literal>Y==[] X</literal> é retornado;
-            Se <literal>X==[] -Y</literal> é retornado.
+        <title>Descrição</title>
+        <para>Subtração</para>
+        <para>Para operandos numéricos, é a operação de subtração em seu sentido
+            usual. Se um dos operandos é uma matriz e o outro um escalar, a operção é
+            realizada elemento a elemento.
         </para>
-        <para>A subtração também pode ser definida para outros tipos de dados,
-            através de operações "soft-coded".
+        <para>
+            As soon as a boolean is involved in a substraction with a number (decimal, complex,
+            or encoded integer), it is automatically converted in the type (and integer type)
+            of the number before performing the substraction or the sign change, as
+            <literal>%F => 0</literal> and <literal>%T => 1</literal>.
+        </para>
+        <para>
+            Qualquer que seja o tipo (regular) de <varname>X</varname>, então <literal>[]-X</literal>,
+            <literal>X-[]</literal> e <literal>-[]</literal> produzem <literal>[]</literal>.
+        </para>
+        <para>
+            O operador de subtração pode ser estendido para outros tipos de dados personalizados
+            através do mecanismo <link linked="overloading">overloading</link>.
         </para>
     </refsection>
     <refsection>
         <title>Exemplos</title>
         <programlisting role="example"><![CDATA[
-[1,2]-1
-[]-2
+[] - 2
+1 - []
+[2, 5] - 1
+[2, 5] - [3 -2]
+
+%s - 2
+1/%s - 2
+]]></programlisting>
+    <screen><![CDATA[
+--> [] - 2
+ ans  =
+    []
+
+--> 1 - []
+ ans  =
+    []
+
+--> [2, 5] - 1
+ ans  =
+   1.   4.
+
+--> [2, 5] - [3 -2]
+ ans  =
+  -1.   7.
 
-%s-2
-1/%s-2
-"cat"+"enate"
+--> %s - 2
+ ans  =
+  -2 +s
+
+--> 1/%s - 2
+ ans  =
+   1 - 2s
+   -------
+     s
+]]></screen>
+    <para>Com booleanos :</para>
+        <programlisting role="example"><![CDATA[
+-[%f %t]
+[%f %f %t %t]  - [%f %t %f %t]
+%t - %i
+c = %t - int8(7), inttype(c)
  ]]></programlisting>
+    <screen><![CDATA[
+--> -[%f %t]
+ ans  =
+   0.  -1.
+
+--> [%f %f %t %t]  - [%f %t %f %t]
+ ans  =
+   0.  -1.   1.   0.
+
+--> %t - %i
+ ans  =
+   1. - i
+
+--> c = %t - int8(7), typeof(c)
+ c  =
+ -6
+
+ ans  =
+ int8
+]]></screen>
     </refsection>
     <refsection role="see also">
-        <title>Ver Também</title>
+        <title>Ver Também</title>
         <simplelist type="inline">
             <member>
-                <link linkend="mtlb_mode">mtlb_mode</link>
+                <link linkend="plus">plus</link>
+            </member>
+            <member>
+                <link linkend="symbols">operators</link>
+            </member>
+            <member>
+                <link linkend="overloading">overloading</link>
+            </member>
+            <member>
+                <link linkend="oldEmptyBehaviour">oldEmptyBehaviour</link>
+            </member>
+            <member>
+                <link linkend="mtlb_s">mtlb_s</link>
             </member>
         </simplelist>
     </refsection>
+    <refsection>
+        <title>Histórico</title>
+        <revhistory>
+            <revision>
+                <revnumber>6.0.0</revnumber>
+                <revremark>
+                    <literal>A - []</literal> and <literal>[] - A</literal> now return
+                    <literal>[]</literal> instead of <literal>A</literal> or <literal>-A</literal>.
+                </revremark>
+            </revision>
+        </revhistory>
+    </refsection>
 </refentry>
index 66222e0..99e4fdd 100644 (file)
-<?xml version="1.0" encoding="ISO-8859-1"?>
-<refentry xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:svg="http://www.w3.org/2000/svg" xmlns:ns3="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="plus" xml:lang="pt">
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
+ * Copyright (C) ???? - INRIA
+ * Copyright (C) 2018 - Samuel GOUGEON
+ *
+ * Copyright (C) 2012 - 2016 - Scilab Enterprises
+ *
+ * This file is hereby licensed under the terms of the GNU GPL v2.0,
+ * pursuant to article 5.3.4 of the CeCILL v.2.1.
+ * This file was originally licensed under the terms of the CeCILL v2.1,
+ * and continues to be available under such terms.
+ * For more information, see the COPYING file which you should have received
+ * along with this program.
+ *
+ -->
+<refentry xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink"
+        xmlns:svg="http://www.w3.org/2000/svg" xmlns:ns3="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="plus" xml:lang="pt">
     <refnamediv>
-        <refname>plus</refname>
-        <refpurpose>(+) operador de adição</refpurpose>
+        <refname>plus (+)</refname>
+        <refpurpose>Adição numérica. Concatenação de texto (colagem)</refpurpose>
     </refnamediv>
     <refsynopsisdiv>
-        <title>Seqüência de Chamamento </title>
-        <synopsis>X+Y
-            str1+str2
+        <title>Seqüência de Chamamento </title>
+        <synopsis>
+            X + Y
+            str1 + str2
         </synopsis>
     </refsynopsisdiv>
     <refsection>
-        <title>Parâmetros</title>
+        <title>Parâmetros</title>
         <variablelist>
             <varlistentry>
-                <term>X,Y</term>
+                <term>X, Y</term>
                 <listitem>
-                    <para>escalar, vetor ou matriz de números, polinômios ou razões de
-                        polinômios. Também pode ser uma lista
-                        <literal>syslin</literal>
+                    <para>
+                       escalares, vetores, matrizes ou hipermatrizes de booleanos, números,
+                       polinômios ou racionais. Eles também podem ser <literal>syslin</literal> listas.
                     </para>
                 </listitem>
             </varlistentry>
             <varlistentry>
-                <term>str1,str2</term>
+                <term>str1, str2</term>
                 <listitem>
-                    <para>um string, um vetor ou uma matriz de strings</para>
+                    <para>dois textos, vetores, matrizes, ou hipermatrizes de textos.</para>
                 </listitem>
             </varlistentry>
         </variablelist>
     </refsection>
     <refsection>
-        <title>Descrição</title>
-        <para>Adição.</para>
-        <para>Para operandos numéricos, é a adição em sentido usual. Se um dos
-            operandos é uma matriz e o outro um escalar, o escalar é adicionado a cada
-            uma das entradas da matriz. Se um dos operandos é a matriz vazia, um o
-            outro operando é retornado (este comportamento padrão pode ser modificado
-            pela função <literal>mtlb_mode</literal>).
+        <title>Descrição</title>
+        <para>
+            Para operandos numéricos, a adição tem seu significado usual.
         </para>
-        <para>Para strings ' + ' significa concatenação.</para>
-        <para>A adição também pode ser definida para outros tipos de dados através
-            de operações "soft-coded" ("codificação suave") (ver
-            <literal>overloading</literal>).
+        <para>
+            Adding booleans together or to numbers of integer, decimal or complex type
+            performs the implicit conversions <literal>%F => 0</literal> and <literal>%T => 1</literal>
+            before processing. The result has the type of the input numbers, or is decimal for
+            booleans added together.
+        </para>
+        <para>
+            Para dois textos, <literal>+</literal> concatena (cola) os dois juntos.
+        </para>
+        <para>
+            Se um operando é um array e o outro é um escalar, o escalar é aplicado
+            (adicionado ou colado) a cada componente da matriz.
+        </para>
+        <para>
+            Se um operando é a matriz vazia <literal>[]</literal>, o resultado é <literal>[]</literal>.
+        </para>
+        <para>
+            O operador de adição pode ser estendido para outros tipos de dados atravès
+            <link linkend="overloading">overloading</link>.
         </para>
     </refsection>
-    <refsection role="see also">
-        <title>Ver Também</title>
+    <refsection role="examples">
+        <title>Examplos</title>
+        <programlisting role="example"><![CDATA[
+[1, 2] + 1
+[] + 2
+%s + 2
+1/%s + %s
+"con" + ["catenate" "crete" "sole"]
+ ]]></programlisting>
+    <screen><![CDATA[
+--> [1, 2] + 1
+ ans  =
+   2.   3.
+
+--> [] + 2
+ ans  =
+    []
+
+--> %s + 2
+ ans  =
+   2 +s
+
+--> 1/%s + %s
+ ans  =
+        2
+   1 + s
+   ------
+     s
+
+--> "con" + ["catenate" "crete" "sole"]
+ ans  =
+!concatenate  concrete  console  !
+]]></screen>
+    <para>Com booleanos :</para>
         <programlisting role="example"><![CDATA[
-[1,2]+1
-[]+2
-s=poly(0,"s");
-s+2
-1/s+2
-"cat"+"enate"
+[%f %f %t %t] + [%f %t %f %t]
+%f + [-1 0 2 %i]
+%t + [-1 0 2 %i]
  ]]></programlisting>
+    <screen><![CDATA[
+--> [%f %f %t %t] + [%f %t %f %t]
+ ans  =
+   0.   1.   1.   2.
+
+--> %f + [-1 0 2 %i]
+ ans  =
+  -1.   0.   2.   i
+
+--> %t + [-1 0 2 %i]
+ ans  =
+   0.   1.   3.   1. + i
+]]></screen>
     </refsection>
     <refsection role="see also">
-        <title>See also</title>
+        <title>Ver Também</title>
         <simplelist type="inline">
             <member>
-                <link linkend="mtlb_mode">mtlb_mode</link>
+                <link linkend="minus">minus</link>
+            </member>
+            <member>
+                <link linkend="symbols">operators</link>
             </member>
             <member>
                 <link linkend="overloading">overloading</link>
             </member>
+            <member>
+                <link linkend="oldEmptyBehaviour">oldEmptyBehaviour</link>
+            </member>
+            <member>
+                <link linkend="mtlb_a">mtlb_a</link>
+            </member>
         </simplelist>
     </refsection>
+    <refsection>
+        <title>Histórico</title>
+        <revhistory>
+            <revision>
+                <revnumber>6.0.0</revnumber>
+                <revremark>
+                    <literal>A + []</literal> now returns <literal>[]</literal> instead of
+                    <literal>A</literal>
+                </revremark>
+            </revision>
+        </revhistory>
+    </refsection>
 </refentry>
index 8eff1a9..9c2b301 100644 (file)
@@ -2,6 +2,7 @@
 <!--
  * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
  * Copyright (C) 2008 - INRIA
+ * Copyright (C) 2018 - Samuel GOUGEON
  *
  * Copyright (C) 2012 - 2016 - Scilab Enterprises
  *
  * along with this program.
  *
  -->
-<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="minus" xml:lang="ru">
+<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="minus" xml:lang="ru">
     <refnamediv>
         <refname>минус</refname>
         <refpurpose>(-) оператор вычитания; меняет знак</refpurpose>
         <title>Аргументы</title>
         <variablelist>
             <varlistentry>
-                <term>X</term>
+                <term>X, Y</term>
                 <listitem>
                     <para>
-                        скаляр или матрица/вектор числовых, полиномиальных или рациональных значений. Это также может быть список <literal>syslin</literal>.
-                    </para>
-                </listitem>
-            </varlistentry>
-            <varlistentry>
-                <term>Y</term>
-                <listitem>
-                    <para>
-                        скаляр или матрица/вектор числовых, полиномиальных или рациональных значений. Это также может быть список <literal>syslin</literal>.
+                        скаляр или матрица/вектор числовых, полиномиальных или рациональных значений.
+                        Это также может быть список <literal>syslin</literal>.
                     </para>
                 </listitem>
             </varlistentry>
         <para>Вычитание</para>
         <para>
             Для числовых операндов вычитание имеет своё обычное значение. Если один из операндов
-            является матрицей, а другой -- скаляр, то операция выполняется поэлементно.
-            Для <literal>X - Y</literal>, если <literal>Y==[]</literal>, то возвращается значение <literal>X</literal>;
-            если <literal>X==[]</literal>, то возвращается значение <literal>-Y</literal>.
+            является матрицей, а другой - скаляр, то операция выполняется поэлементно.
+        </para>
+        <para>
+            Поскольку логическое значение допускается использовать в вычитании из чисел (десятичных,
+            комплексных или кодированных целых чисел), то оно автоматически преобразуется в тип числа
+            (и тип целого числа) перед выполнение вычитания или смены знака, как
+            <literal>%F => 0</literal> и <literal>%T => 1</literal>.
+        </para>
+        <para>
+            Для <literal>X - Y</literal>, если <literal>Y==[]</literal>, то возвращается значение
+            <literal>X</literal>;  если <literal>X==[]</literal>, то возвращается значение
+            <literal>-Y</literal>.
         </para>
         <para>
             Вычитание может быть также определено для других типов данных через "запрограммированные"
     <refsection>
         <title>Примеры</title>
         <programlisting role="example"><![CDATA[
-[1,2]-1
-[]-2
+[] - 2
+1 - []
+[2, 5] - 1
+[2, 5] - [3 -2]
+
+%s - 2
+1/%s - 2
+]]></programlisting>
+    <screen><![CDATA[
+--> [] - 2
+ ans  =
+    []
+
+--> 1 - []
+ ans  =
+    []
+
+--> [2, 5] - 1
+ ans  =
+   1.   4.
+
+--> [2, 5] - [3 -2]
+ ans  =
+  -1.   7.
 
-%s-2
-1/%s-2
+--> %s - 2
+ ans  =
+  -2 +s
+
+--> 1/%s - 2
+ ans  =
+   1 - 2s
+   -------
+     s
+]]></screen>
+    <para>С булевыми:</para>
+        <programlisting role="example"><![CDATA[
+-[%f %t]
+[%f %f %t %t]  - [%f %t %f %t]
+%t - %i
+c = %t - int8(7), inttype(c)
  ]]></programlisting>
+    <screen><![CDATA[
+--> -[%f %t]
+ ans  =
+   0.  -1.
+
+--> [%f %f %t %t]  - [%f %t %f %t]
+ ans  =
+   0.  -1.   1.   0.
+
+--> %t - %i
+ ans  =
+   1. - i
+
+--> c = %t - int8(7), typeof(c)
+ c  =
+ -6
+
+ ans  =
+ int8
+]]></screen>
     </refsection>
     <refsection role="see also">
         <title>Смотрите также</title>
         <simplelist type="inline">
             <member>
-                <link linkend="mtlb_mode">mtlb_mode</link>
+                <link linkend="plus">плюс</link>
             </member>
             <member>
-                <link linkend="plus">плюс</link>
+                <link linkend="symbols">операторы</link>
             </member>
             <member>
                 <link linkend="overloading">перегрузка</link>
             </member>
+            <member>
+                <link linkend="oldEmptyBehaviour">oldEmptyBehaviour</link>
+            </member>
+            <member>
+                <link linkend="mtlb_s">mtlb_s</link>
+            </member>
         </simplelist>
     </refsection>
+    <refsection>
+        <title>История</title>
+        <revhistory>
+            <revision>
+                <revnumber>6.0.0</revnumber>
+                <revremark>
+                    <literal>A - []</literal> и <literal>[] - A</literal> теперь возвращают
+                    <literal>[]</literal> вместо <literal>A</literal> или <literal>-A</literal>.
+                </revremark>
+            </revision>
+        </revhistory>
+    </refsection>
 </refentry>
index 89c5cff..c4b4015 100644 (file)
@@ -1,29 +1,48 @@
 <?xml version="1.0" encoding="UTF-8"?>
-<refentry xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:svg="http://www.w3.org/2000/svg" xmlns:mml="http://www.w3.org/1998/Math/MathML" xmlns:db="http://docbook.org/ns/docbook" xmlns:scilab="http://www.scilab.org" xml:lang="ru" xml:id="plus">
+<!--
+ * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
+ * Copyright (C) ???? - INRIA
+ * Copyright (C) 2018 - Samuel GOUGEON
+ *
+ * Copyright (C) 2012 - 2016 - Scilab Enterprises
+ *
+ * This file is hereby licensed under the terms of the GNU GPL v2.0,
+ * pursuant to article 5.3.4 of the CeCILL v.2.1.
+ * This file was originally licensed under the terms of the CeCILL v2.1,
+ * and continues to be available under such terms.
+ * For more information, see the COPYING file which you should have received
+ * along with this program.
+ *
+ -->
+<refentry xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink"
+        xmlns:svg="http://www.w3.org/2000/svg" xmlns:mml="http://www.w3.org/1998/Math/MathML"
+        xmlns:db="http://docbook.org/ns/docbook" xmlns:scilab="http://www.scilab.org"
+        xml:lang="ru" xml:id="plus">
     <refnamediv>
-        <refname>плюс</refname>
-        <refpurpose>(+)  оператор суммирования</refpurpose>
+        <refname>плюс (+)</refname>
+        <refpurpose>Суммирование чисел. Конкатенация текста (склейка)</refpurpose>
     </refnamediv>
     <refsynopsisdiv>
         <title>Синтаксис</title>
         <synopsis>
-            X+Y
-            str1+str2
+            X + Y
+            str1 + str2
         </synopsis>
     </refsynopsisdiv>
     <refsection>
         <title>Аргументы</title>
         <variablelist>
             <varlistentry>
-                <term>X,Y</term>
+                <term>X, Y</term>
                 <listitem>
                     <para>
-                        скаляр или матрица/вектор числовых, полиномиальных или рациональных значений. Это также может быть список <literal>syslin</literal>.
+                      скаляры, векторы, матрицы или гиперматрицы чисел, многочлены, рациональные
+                      или логические значения. Они также могут быть <literal>syslin</literal>.
                     </para>
                 </listitem>
             </varlistentry>
             <varlistentry>
-                <term>str1,str2</term>
+                <term>str1, str2</term>
                 <listitem>
                     <para>символьная строка, вектор или матрица символьных строк.</para>
                 </listitem>
     <refsection>
         <title>Описание</title>
         <para>
-            Суммирование.
+            Для числовых операндов суммирование имеет свое обычное значение.
         </para>
         <para>
-            Для числовых операндов суммирование имеет свой обычный смысл. Если один из операндов является
-            матрицей, а другой -- скаляр, то скаляр добавляется к каждому элементу матрицы. Если один из
-            операндов является пустой матрицей, то возвращается второй операнд (это поведение по умолчанию,
-            но его можно изменить с помощью функции <literal>mtlb_mode</literal>).
+            Суммирование логических значений друг с другом или числами целыми, десятичными или комплексными
+            выполняет перед обработкой неявные преобразования <literal>%F => 0</literal> и <literal>%T => 1</literal>.
+            Результат имеет тот же тип, который у входных чисел, либо десятичный для суммируемых друг с
+            другом логических значений.
         </para>
         <para>
-            Для символьных строк <literal>+</literal> означает конкатенацию.
+            Для двух текстов <literal>+</literal> объединяет (склеивает) их вместе.
         </para>
         <para>
-            Суммирование может быть также определено для других типов данных через "запрограммированные"
-            операции (см. <link linkend="overloading">перегрузку</link>).
+            Если один операнд является массивом, а другой - скаляром, то скаляр применяется
+            (добавляется или склеивается) к каждому компоненту массива.
+        </para>
+        <para>
+            Если операндом является пустая матрица <literal>[]</literal>, то результатом будет
+            <literal>[]</literal>.
+        </para>
+        <para>
+            Оператор суммирования может быть распространен на другие типы данных через
+            <link linkend="overloading">перегрузку</link>.
         </para>
     </refsection>
     <refsection>
         <title>Примеры</title>
         <programlisting role="example"><![CDATA[
-[1,2]+1
-[]+2
-s=poly(0,"s");
-s+2
-1/s+2
-"кон"+"кат"+"енация"
+[1, 2] + 1
+[] + 2
+%s + 2
+1/%s + %s
+"кон" + ["катенация" "такт" "соль"]
  ]]></programlisting>
+    <screen><![CDATA[
+--> [1, 2] + 1
+ ans  =
+   2.   3.
+
+--> [] + 2
+ ans  =
+    []
+
+--> %s + 2
+ ans  =
+   2 +s
+
+--> 1/%s + %s
+ ans  =
+        2
+   1 + s
+   ------
+     s
+
+--> "кон" + ["катенация" "такт" "соль"]
+ ans  =
+!конкатенация  контакт  консоль  !
+]]></screen>
+    <para>С логическими значенниями:</para>
+        <programlisting role="example"><![CDATA[
+[%f %f %t %t] + [%f %t %f %t]
+%f + [-1 0 2 %i]
+%t + [-1 0 2 %i]
+ ]]></programlisting>
+    <screen><![CDATA[
+--> [%f %f %t %t] + [%f %t %f %t]
+ ans  =
+   0.   1.   1.   2.
+
+--> %f + [-1 0 2 %i]
+ ans  =
+  -1.   0.   2.   i
+
+--> %t + [-1 0 2 %i]
+ ans  =
+   0.   1.   3.   1. + i
+]]></screen>
     </refsection>
     <refsection role="see also">
         <title>Смотрите также</title>
         <simplelist type="inline">
             <member>
-                <link linkend="mtlb_mode">mtlb_mode</link>
+                <link linkend="minus">минус</link>
+            </member>
+            <member>
+                <link linkend="symbols">символы</link>
             </member>
             <member>
                 <link linkend="overloading">перегрузка</link>
             </member>
+            <member>
+                <link linkend="oldEmptyBehaviour">oldEmptyBehaviour</link>
+            </member>
+            <member>
+                <link linkend="mtlb_a">mtlb_a</link>
+            </member>
         </simplelist>
     </refsection>
+    <refsection>
+        <title>История</title>
+        <revhistory>
+            <revision>
+                <revnumber>6.0.0</revnumber>
+                <revremark>
+                    <literal>A + []</literal> теперь возвращает <literal>[]</literal> вместо
+                    <literal>A</literal>
+                </revremark>
+            </revision>
+        </revhistory>
+    </refsection>
 </refentry>
index 36e5dad..2038204 100644 (file)
@@ -2,6 +2,7 @@
 <!--
  * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
  * Copyright (C) 2008 - INRIA
+ * Copyright (C) 2018 - Samuel GOUGEON
  *
  * Copyright (C) 2012 - 2016 - Scilab Enterprises
  *
  * along with this program.
  *
  -->
-<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="intersect" xml:lang="en">
+<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="intersect" xml:lang="en">
     <refnamediv>
         <refname>intersect</refname>
-        <refpurpose>returns the vector of common values of two
-            vectors
+        <refpurpose>
+            returns the unduplicated elements or rows or columns met in both input arrays
         </refpurpose>
     </refnamediv>
     <refsynopsisdiv>
         <title>Syntax</title>
-        <synopsis>[v [,ka,kb]]=intersect(a,b)</synopsis>
-        <synopsis>[v [,ka,kb]]=intersect(a,b,orient)</synopsis>
+        <synopsis>
+            M = intersect(a, b)
+            M = intersect(a, b, orient)
+            [M, ka] = intersect(..)
+            [M, ka, kb] = intersect(..)
+        </synopsis>
     </refsynopsisdiv>
     <refsection>
         <title>Arguments</title>
         <variablelist>
             <varlistentry>
-                <term>a</term>
+                <term>a, b</term>
                 <listitem>
-                    <para>vector of numbers or strings</para>
-                </listitem>
-            </varlistentry>
-            <varlistentry>
-                <term>b</term>
-                <listitem>
-                    <para>vector of numbers or strings</para>
+                    <para>
+                        vectors, matrices or hypermatrices of encoded integers, decimal real
+                        numbers, or text. <varname>a</varname> and <varname>b</varname> must have
+                        the same datatype, but have independent sizes.
+                        For text inputs, UTF characters are accepted.
+                    </para>
                 </listitem>
             </varlistentry>
             <varlistentry>
                 <term>orient</term>
                 <listitem>
-                    <para>flag with possible values : 1 or "r", 2 or "c"</para>
+                    <para>
+                        flag with possible values : 1 or "r", 2 or "c". Can't be used if
+                        <varname>a</varname> or/and <varname>b</varname> is an hypermatrix.
+                    </para>
                 </listitem>
             </varlistentry>
             <varlistentry>
-                <term>v</term>
+                <term>M</term>
                 <listitem>
-                    <para>row vector of numbers or strings</para>
+                    <para>
+                        matrix of the same datatype as <varname>a</varname> and <varname>b</varname>.
+                        <itemizedlist>
+                            <listitem>
+                                Without <varname>orient</varname>: <varname>M</varname> is a row vector.
+                            </listitem>
+                            <listitem>
+                                With <literal>orient="r"|1</literal>: <varname>M</varname> is a
+                                matrix stacking the common rows of <varname>a</varname> and
+                                <varname>b</varname>.
+                            </listitem>
+                            <listitem>
+                                With <literal>orient="c"|2</literal>: <varname>M</varname> is a
+                                matrix stacking the common columns of <varname>a</varname> and
+                                <varname>b</varname>.
+                            </listitem>
+                        </itemizedlist>
+                    </para>
                 </listitem>
             </varlistentry>
             <varlistentry>
                 <term>ka</term>
                 <listitem>
-                    <para>row vector of integers</para>
+                    <para>
+                        row vector of indices in <varname>a</varname>.
+                    </para>
                 </listitem>
             </varlistentry>
             <varlistentry>
                 <term>kb</term>
                 <listitem>
-                    <para>row vector of integers</para>
+                    <para>
+                        row vector of indices in <varname>b</varname>.
+                    </para>
                 </listitem>
             </varlistentry>
         </variablelist>
     <refsection>
         <title>Description</title>
         <para>
-            <literal>intersect(a,b)</literal> returns a sorted row vector of
-            common values of two vectors of <literal>a</literal> and
-            <literal>b</literal>.
+            <literal>intersect(a,b)</literal> returns a row vector of unduplicated sorted values
+            present in both <literal>a</literal> and <literal>b</literal> arrays.
         </para>
+        <warning>
+            Two NaN elements are always considered as different. So NaN or rows or columns having
+            NaN will never be in the result <literal>M</literal>.
+        </warning>
         <para>
-            <literal>[v,ka,kb]=intersect(a,b)</literal> also returns index
-            vectors <literal>ka</literal> and <literal>kb</literal> such that
-            <literal>v=a(ka)</literal> and <literal>v=b(kb)</literal>.
+            <literal>[M, ka, kb] = intersect(a,b)</literal> additionnaly returns the vectors
+            <literal>ka</literal> and <literal>kb</literal> of indices in <literal>a</literal>
+            and <literal>b</literal> of selected components firstly met, such that
+            <literal>M=a(ka)</literal> and <literal>M=b(kb)</literal>.
         </para>
+        <refsect3>
+            <title>Common rows or columns</title>
         <para>
-            <literal>intersect(a,b,"r")</literal> or
-            <literal>intersect(a,b,1)</literal>returns the matrix formed by the
-            intersection of the unique rows of <literal>a</literal> and
-            <literal>b</literal> sorted in lexicographic ascending order. In this case
-            matrices <literal>a</literal> and <literal>b</literal> must have the same
-            number of columns.
+            When the <varname>orient</varname> argument is provided, the comparison is performed
+            between the rows of <literal>a</literal> and <literal>b</literal> -- each one being
+            considered as a whole --, or between their columns.
         </para>
         <para>
-            <literal>[v,ka,kb]=intersect(a,b,"r")</literal> also returns index
-            vectors <literal>ka</literal> and <literal>kb</literal> such that
-            <literal>v=a(ka,:)</literal> and <literal>v=b(kb,:)</literal>.
+            <literal>intersect(a,b,"r")</literal> or <literal>intersect(a,b,1)</literal> will return
+            the matrix of stacked unduplicated rows met in both  <literal>a</literal> and
+            <literal>b</literal>, sorted in lexicographic ascending order.
+            If <literal>a</literal> and <literal>b</literal> don't have the same number of columns,
+            [] is returned without comparing the values.
         </para>
         <para>
-            <literal>intersect(a,b,"c")</literal> or
-            <literal>intersect(a,b,2)</literal>returns the matrix formed by the
-            intersection of the unique columns of <literal>a</literal> and
-            <literal>b</literal> sorted in lexicographic ascending order. In this case
-            matrices <literal>a</literal> and <literal>b</literal> must have the same
-            number of rows.
+            <literal>[M,ka,kb] = intersect(a,b,"r")</literal> additionnaly returns the vectors
+            <literal>ka</literal> and <literal>kb</literal> of the minimal indices of common rows,
+            respectively in <literal>a</literal> and <literal>b</literal>,
+            such that <literal>M=a(ka,:)</literal> and <literal>M=b(kb,:)</literal>.
         </para>
         <para>
-            <literal>[v,ka,kb]=intersect(a,b,"c")</literal> also returns index
-            vectors <literal>ka</literal> and <literal>kb</literal> such that
-            <literal>v=a(:,ka)</literal> and <literal>v=b(:,kb)</literal>.
-        </para>
-    </refsection>
-    <refsection>
-        <title>Remark</title>
-        <para>NaN are considered as different from themselves so they are excluded
-            out of intersection in case of vector intersection.
+            <literal>intersect(a,b,"c")</literal> or <literal>intersect(a,b,2)</literal> does
+            the same for columns.
         </para>
+        </refsect3>
     </refsection>
     <refsection>
         <title>Examples</title>
         <programlisting role="example"><![CDATA[
-A=round(5*rand(10,1));
-B=round(5*rand(7,1));
+A = grand(3, 3, "uin", 0, 9)
+B = grand(2, 4, "uin", 0, 9)
+intersect(A, B)
+[N, ka, kb] = intersect(A,B);
+ka, kb
+ ]]></programlisting>
+    <screen><![CDATA[
+--> A = grand(3, 3, "uin", 0, 9)
+ A  =
+   0.   6.   4.
+   6.   6.   6.
+   2.   7.   9.
 
-intersect(A,B)
-[N,ka,kb]=intersect(A,B)
+--> B = grand(2, 4, "uin", 0, 9)
+ B  =
+   1.   8.   0.   2.
+   6.   2.   2.   1.
 
-intersect('a'+string(A),'a'+string(B))
+--> intersect(A, B)
+ ans  =
+   0.   2.   6.
 
-intersect(int16(A),int16(B))
+--> [N, ka, kb] = intersect(A,B);
+--> ka, kb
+ ka  =
+   1.   3.   2.
+ kb  =
+   5.   4.   2.
+]]></screen>
+    <para>
+        In the above example, note that 6 is met four times in A, at indices [2 4 5 8].
+        Only the minimal index 2 is returned in ka. Same situation for 2 in B.
+    </para>
+    <para/>
+    <para>
+    NaN values can never be in the result:
+    </para>
+    <programlisting role="example"><![CDATA[
+%nan == %nan
+intersect([1 -2 %nan 3 6], [%nan 1:3])
+ ]]></programlisting>
+    <screen><![CDATA[
+--> %nan == %nan
+ ans  =
+  F
+
+--> intersect([1 -2 %nan 3 6], [%nan 1:3])
+ ans  =
+   1.   3.
+]]></screen>
+    <para/>
+    <para>
+        intersect() can also process some characters or some texts. Since Scilab is great with UTF
+        characters, here is an example with some Arabic contents, getting characters present in
+        both sentences:
+    </para>
+        <programlisting role="example"><![CDATA[
+A = strsplit("هو برنامج علمي كبير ""Scilab""")'
+B = strsplit("فهو حر ومفتوح")'
+intersect(A,B)
+ ]]></programlisting>
+    <screen><![CDATA[
+--> A = strsplit("هو برنامج علمي كبير ""Scilab""")'
+ A  =
+!ه  و     ب  ر  ن  ا  م  ج     ع  ل  م  ي     ك  ب  ي  ر     "  S  c  i  l  a  b  "  !
 
-//with matrices
- A = [0,0,1,1 1;
-      0,1,1,1,1;
-      2,0,1,1,1;
-      0,2,2,2,2;
-      2,0,1,1,1;
-      0,0,1,1,%nan];
-B = [1,0,1;
-     1,0,2;
-     1,2,3;
-     2,0,4;
-     1,2,5;
-     %nan,0,6];
+--> B = strsplit("فهو حر ومفتوح")'
+ B  =
+!ف  ه  و     ح  ر     و  م  ف  ت  و  ح  !
 
-[v,ka,kb] = intersect(A,B,'c')
-A(:,ka)
+--> intersect(A,B)
+ ans  =
+!   ر  م  ه  و  !
+]]></screen>
+    <para/>
+    <para>
+        Column-wise or Row-wise processing of two matrices: Here we process 2 matrices of
+        signed 1-byte integers, and get the common columns:
+    </para>
+    <programlisting role="example"><![CDATA[
+A = int8(grand(3,5,"uin",0,1))
+B = int8(grand(3,9,"uin",0,1))
+[M,ka,kb] = intersect(A, B, "c");
+M, ka, kb
  ]]></programlisting>
+    <screen><![CDATA[
+--> A = int8(grand(3,5,"uin",0,1))
+ A  =
+  0  0  1  1  1
+  0  0  1  1  0
+  0  0  0  0  1
+
+--> B = int8(grand(3,9,"uin",0,1))
+ B  =
+  1  0  1  1  1  0  1  1  1
+  1  0  0  1  1  1  0  0  0
+  1  0  1  0  1  1  1  0  0
+
+--> [M,ka,kb] = intersect(A, B, "c");
+--> M, ka, kb
+ M  =
+  0  1  1
+  0  0  1
+  0  1  0
+
+ ka  =
+   1.   5.   3.
+
+ kb  =
+   2.   3.   4.
+]]></screen>
     </refsection>
     <refsection role="see also">
         <title>See also</title>
index af55985..341fa59 100644 (file)
@@ -2,7 +2,7 @@
 <!--
  * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
  * Copyright (C) 2008 - INRIA
- * Copyright (C) 2017 - Samuel GOUGEON
+ * Copyright (C) 2017, 2018 - Samuel GOUGEON
  *
  * Copyright (C) 2012 - 2016 - Scilab Enterprises
  *
           xmlns:scilab="http://www.scilab.org" xml:id="unique" xml:lang="en">
     <refnamediv>
         <refname>unique</refname>
-        <refpurpose>extracts (and sorts) distinct components of a vector or a matrix</refpurpose>
+        <refpurpose>extracts (and sorts) distinct elements, rows or columns of a matrix</refpurpose>
     </refnamediv>
     <refsynopsisdiv>
         <title>Syntax</title>
         <synopsis>
-            [N ,k] = unique(M)
-            [N ,k] = unique(M, orient)
+            N = unique(M)
+            N = unique(M, orient)
+            [N, k] = unique(..)
         </synopsis>
     </refsynopsisdiv>
     <refsection role="parameters">
             <varlistentry>
                 <term>M</term>
                 <listitem>
-                    <para>vector or matrix of numbers or strings.</para>
+                    <para>vector, matrix, or hypermatrix of numbers or strings.</para>
                 </listitem>
             </varlistentry>
             <varlistentry>
                 <term>orient</term>
                 <listitem>
-                    <para>flag with possible values : 1 or "r", 2 or "c"</para>
+                    <para>
+                        flag with possible values : 1 or "r", 2 or "c". It can't be used if
+                        <varname>M</varname> is an hypermatrix.
+                    </para>
                 </listitem>
             </varlistentry>
             <varlistentry>
         </para>
         <note>
           Extracted components, rows or columns can be resorted in their initial order by sorting
-          <varname>k</varname>:
-          <programlisting role="no-example"><![CDATA[
-              [N, k] = unique(M);      k = gsort(k,"g",i); N = N(k)
-              [N, k] = unique(M, "c"); k = gsort(k,"g",i); N = N(:, k)
-              [N, k] = unique(M, "r"); k = gsort(k,"g",i); N = N(k, :)
-          ]]></programlisting>
+          <varname>k</varname>. See the first example.
         </note>
     </refsection>
     <refsection role="examples">
         <title>Examples</title>
+        <para>With some numbers:</para>
         <programlisting role="example"><![CDATA[
-M = round(2*rand(20,1));
+M = int8([2  0  2  2  1  1  1  2  1  1  0  1  1  0  1  1
+          0  1  2  0  1  2  2  0  1  1  2  0  1  0  0  0
+          ])
+[u, k] = unique(M)
+[uc, kc] = unique(M, "c")
+
+// Get unduplicated columns in initial order:
+M(:, gsort(kc,"g","i"))
+ ]]></programlisting>
+    <screen><![CDATA[
+--> M 
+ M = 
+  2  0  2  2  1  1  1  2  1  1  0  1  1  0  1  1
+  0  1  2  0  1  2  2  0  1  1  2  0  1  0  0  0
 
-unique(M)
-[N,k] = unique(M)
+--> [u, k] = unique(M)
+ u  =
+  0
+  1
+  2
 
-unique(string(M))
-[N,k] = unique(string(M))
+ k  =
+   2.
+   4.
+   1.
 
-A = [0,0,1,1;
-     0,1,1,1;
-     2,0,1,1;
-     0,2,2,2;
-     2,0,1,1;
-     0,0,1,1];
-T = 'x'+string(A);
+--> [uc, kc] = unique(M, "c")
+ uc  =
+  0  0  0  1  1  1  2  2
+  0  1  2  0  1  2  0  2
+
+ kc  =
+   14.   2.   11.   12.   5.   6.   1.   3.
+
+--> // Get unduplicated columns in initial order:
+--> M(:, gsort(kc,"g","i"))
+ ans  =
+  2  0  2  1  1  0  1  0
+  0  1  2  1  2  2  0  0
+]]></screen>
+        <para>With complex numbers:</para>
+        <programlisting role="example"><![CDATA[
+i = %i;
+c = [1+i, 1-i, -i, i, -i, 1+i]
+[u, k] = unique(c)
+[uc, kc] = unique(c, "c")
+ ]]></programlisting>
+    <screen><![CDATA[
+--> c = [1+i, 1-i, -i, i, -i, 1+i]
+ c  =
+   1. + i     1. - i  -i    i   -i    1. + i
 
-//unique rows
+--> [u, k] = unique(c)
+ u  =
+  -i    i    1. - i   1. + i
 
-[m,k] = unique(A,'r')
-unique(T,'r')
+ k  =
+   3.   4.   2.   1.
+]]></screen>
 
-//unique columns
-[m,k] = unique(T,'c')
-unique(A,'c')
+    <para>With some texts:</para>
+        <programlisting role="example"><![CDATA[
+t = ["AB" "BA" "BA" "BA" "AB" "BA" "AB" "AB" "BB" "AA" "AB" "BA" "BA" "BA" "AA"
+     "AA" "AA" "AB" "AA" "BB" "BB" "BB" "BA" "AB" "AB" "BB" "BB" "AB" "AB" "AA"
+    ]
+[u, k] = unique(t)
+[uc, kc] = unique(t, "c")
  ]]></programlisting>
+    <screen><![CDATA[
+ t  =
+!AB  BA  BA  BA  AB  BA  AB  AB  BB  AA  AB  BA  BA  BA  AA  !
+!AA  AA  AB  AA  BB  BB  BB  BA  AB  AB  BB  BB  AB  AB  AA  !
+
+--> [u, k] = unique(t);
+ u  =
+!AA  !
+!AB  !
+!BA  !
+!BB  !
+
+ k  =
+   2.
+   1.
+   3.
+   10.
+
+--> [uc, kc] = unique(t, "c")
+ uc  =
+!AA  AA  AB  AB  AB  BA  BA  BA  BB  !
+!AA  AB  AA  BA  BB  AA  AB  BB  AB  !
+
+ kc  =
+   15.   10.   1.   8.   5.   2.   3.   6.   9.
+]]></screen>
     </refsection>
     <refsection role="see also">
         <title>See also</title>
@@ -151,4 +220,15 @@ unique(A,'c')
             </member>
         </simplelist>
     </refsection>
+    <refsection role="history">
+        <title>History</title>
+        <revhistory>
+            <revision>
+                <revnumber>6.0.2</revnumber>
+                <revdescription>
+                    unique() can now be used to unduplicate complex numbers.
+                </revdescription>
+            </revision>
+        </revhistory>
+    </refsection>
 </refentry>
index 277331d..2ab8d4e 100644 (file)
 <?xml version="1.0" encoding="UTF-8"?>
-<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="intersect" xml:lang="fr">
+<!--
+ * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
+ * Copyright (C) 2008 - INRIA
+ * Copyright (C) 2018 - Samuel GOUGEON
+ *
+ * Copyright (C) 2012 - 2016 - Scilab Enterprises
+ *
+ * This file is hereby licensed under the terms of the GNU GPL v2.0,
+ * pursuant to article 5.3.4 of the CeCILL v.2.1.
+ * This file was originally licensed under the terms of the CeCILL v2.1,
+ * and continues to be available under such terms.
+ * For more information, see the COPYING file which you should have received
+ * along with this program.
+ *
+ -->
+<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="intersect" xml:lang="fr">
     <refnamediv>
         <refname>intersect</refname>
-        <refpurpose>recherche de valeurs communes à deux vecteurs.</refpurpose>
+        <refpurpose>
+            éléments, lignes, ou colonnes communs aux 2 tableaux d'entrée, sans doublon
+        </refpurpose>
     </refnamediv>
     <refsynopsisdiv>
-        <title>Séquence d'appel</title>
+        <title>Syntaxe</title>
         <synopsis>
-            [v [,ka,kb]]=intersect(a,b)
-            [v [,ka,kb]]=intersect(a,b,orient)
+            M = intersect(a, b)
+            M = intersect(a, b, orient)
+            [M, ka] = intersect(..)
+            [M, ka, kb] = intersect(..)
         </synopsis>
     </refsynopsisdiv>
     <refsection>
-        <title>Paramètres</title>
+        <title>Arguments</title>
         <variablelist>
             <varlistentry>
-                <term>a</term>
+                <term>a, b</term>
                 <listitem>
-                    <para>vecteur de nombres ou de chaînes de caractères</para>
+                    <para>
+                        vecteurs, matrices ou hypermatrices d'entiers encodés, de nombres décimaux
+                        réels, ou de texte. <varname>a</varname> et <varname>b</varname> doivent
+                        être du même type de données, mais ont des tailles indépendantes.
+                        Pour les données texte, les caractères UTF sont admis.
+                    </para>
                 </listitem>
             </varlistentry>
             <varlistentry>
-                <term>b</term>
+                <term>orient</term>
                 <listitem>
-                    <para>vecteur de nombres ou de chaînes de caractères</para>
+                    <para>
+                        indicateur de traitement par colonnes ou lignes. Valeurs possibles :
+                        1 ou "r", 2 ou "c". Ne peut pas être utilisé lorsque <varname>a</varname>
+                        ou/et <varname>b</varname> est une hypermatrice.
+                    </para>
                 </listitem>
             </varlistentry>
             <varlistentry>
-                <term>v</term>
+                <term>M</term>
                 <listitem>
-                    <para>vecteur ligne ou matrice de nombres ou de chaînes de
-                        caractères
+                    <para>
+                        Matrice du type de <varname>a</varname> et <varname>b</varname>.
+                        <itemizedlist>
+                            <listitem>
+                                Sans <varname>orient</varname>: <varname>M</varname> est un vecteur
+                                ligne.
+                            </listitem>
+                            <listitem>
+                                Avec <literal>orient="r"|1</literal>: <varname>M</varname> est une
+                                matrice empilant les lignes communes à <varname>a</varname> et
+                                <varname>b</varname>.
+                            </listitem>
+                            <listitem>
+                                Avec <literal>orient="c"|2</literal>: <varname>M</varname> est une
+                                matrice concaténant les colonnes communes à <varname>a</varname> et
+                                <varname>b</varname>.
+                            </listitem>
+                        </itemizedlist>
                     </para>
                 </listitem>
             </varlistentry>
             <varlistentry>
                 <term>ka</term>
                 <listitem>
-                    <para>vecteur ligne d'entiers</para>
+                    <para>
+                        Vecteur ligne d'indices dans <varname>a</varname>.
+                    </para>
                 </listitem>
             </varlistentry>
             <varlistentry>
                 <term>kb</term>
                 <listitem>
-                    <para>vecteur ligne d'entiers</para>
+                    <para>
+                        Vecteur lignes d'indices dans <varname>b</varname>.
+                    </para>
                 </listitem>
             </varlistentry>
         </variablelist>
     <refsection>
         <title>Description</title>
         <para>
-            <literal>intersect(a,b)</literal> renvoie un vecteur trié des
-            valeurs communes à <literal>a</literal> et <literal>b</literal>. A noter
-            que 2 NaN sont toujours considérés comme différents.
+            <literal>intersect(a,b)</literal> produit un vecteur ligne des éléments dédoublonnés
+            présents à la fois dans les tableaux <literal>a</literal> et <literal>b</literal>,
+            triés en ordre croissant.
         </para>
+        <warning>
+            Deux éléments NaN étant toujours considérés comme différents, NaN ou les lignes ou
+            colonnes en contenant ne seront jamais présents dans le résultat <literal>M</literal>.
+        </warning>
         <para>
-            <literal>[v,ka,kb]=intersect(a,b)</literal> renvoie aussi deux
-            vecteurs d'indices <literal>ka</literal> et <literal>kb</literal> tels que
-            <literal>v=a(ka)</literal> et <literal>v=b(kb)</literal>.
+            <literal>[M, ka, kb] = intersect(a,b)</literal> fournit en outre les vecteurs lignes
+            <literal>ka</literal> et <literal>kb</literal> des indices dans <literal>a</literal>
+            et <literal>b</literal> des éléments communs rencontrés à leur première position,
+            tels que <literal>M=a(ka)</literal> and <literal>M=b(kb)</literal>.
         </para>
+        <refsect3>
+            <title>Lignes ou colonnes en commun</title>
         <para>
-            <literal>intersect(a,b,"r")</literal> ou
-            <literal>intersect(a,b,1)</literal> retourne la matrice formée de
-            l'intersection des lignes distinctes des matrices <literal>a</literal> et
-            <literal>b</literal> triées dans l'ordre lexicographique croissant. Dans
-            ce cas les matrices <literal>a</literal> et <literal>b</literal> doivent
-            avoir le même nombre de colonnes.
+            Lorsque l'option <varname>orient</varname> est utilisée, la comparaison entre
+            <literal>a</literal> et <literal>b</literal> est réalisée en considérant leurs lignes
+            ou leurs colonnes dans leur entier.
         </para>
         <para>
-            <literal>[v,ka,kb]=intersect(a,b,"r")</literal> retourne aussi les
-            vecteurs d'indices <literal>ka</literal> et <literal>kb</literal> tels que
-            <literal>v=a(ka,:)</literal> et <literal>v=b(kb,:)</literal>.
+            <literal>intersect(a,b,"r")</literal> ou <literal>intersect(a,b,1)</literal> fournira
+            la matrice des lignes (sans doublons) présentes à la fois dans <literal>a</literal> et
+            dans <literal>b</literal>, triées en ordre lexicographique croissant.
+            Lorsque <literal>a</literal> et <literal>b</literal> n'ont pas le même nombre de
+            colonnes, [] est retourné sans comparer aucun élément.
         </para>
         <para>
-            <literal>intersect(a,b,"c")</literal> ou
-            <literal>intersect(a,b,2)</literal> retourne la matrice formée de
-            l'intersection des colonnes distinctes des matrices <literal>a</literal>
-            et <literal>b</literal> triées dans l'ordre lexicographique croissant.
-            Dans ce cas les matrices <literal>a</literal> et <literal>b</literal>
-            doivent avoir le même nombre de lignes.
+            <literal>[M,ka,kb]=intersect(a,b,"r")</literal> fournit en outre les vecteurs
+            <literal>ka</literal> et <literal>kb</literal> des indices minimaux des lignes communes,
+            indices respectivement dans <literal>a</literal> dans <literal>b</literal>. On a alors
+            <literal>M=a(ka,:)</literal> et <literal>M=b(kb,:)</literal>.
         </para>
         <para>
-            <literal>[v,ka,kb]=intersect(a,b,"r")</literal> retourne aussi les
-            vecteurs d'indices <literal>ka</literal> et <literal>kb</literal> tels que
-            <literal>v=a(:,ka)</literal> et <literal>v=b(:,kb)</literal>.
+            <literal>intersect(a,b,"c")</literal> ou <literal>intersect(a,b,2)</literal> réalise
+            la même chose sur les colonnes.
         </para>
+        </refsect3>
     </refsection>
     <refsection>
         <title>Exemples</title>
         <programlisting role="example"><![CDATA[
-A=round(5*rand(10,1));
-B=round(5*rand(7,1));
+A = grand(3, 3, "uin", 0, 9)
+B = grand(2, 4, "uin", 0, 9)
+intersect(A, B)
+[N, ka, kb] = intersect(A,B);
+ka, kb
+ ]]></programlisting>
+    <screen><![CDATA[
+--> A = grand(3, 3, "uin", 0, 9)
+ A  =
+   0.   6.   4.
+   6.   6.   6.
+   2.   7.   9.
+
+--> B = grand(2, 4, "uin", 0, 9)
+ B  =
+   1.   8.   0.   2.
+   6.   2.   2.   1.
+
+--> intersect(A, B)
+ ans  =
+   0.   2.   6.
 
+--> [N, ka, kb] = intersect(A,B);
+--> ka, kb
+ ka  =
+   1.   3.   2.
+ kb  =
+   5.   4.   2.
+]]></screen>
+    <para>
+        Dans l'exemple ci-dessus, on notera que 6 est présent quatre fois dans A, aux indices [2 4 5 8].
+        Seule la position d'indice minimal 2 est donnée dans ka. Même situation pour 2 dans B.
+    </para>
+    <para/>
+    <para>
+    La valeur NaN (Not-a-Number) ne peut jamais figurer dans le résultat :
+    </para>
+    <programlisting role="example"><![CDATA[
+%nan == %nan
+intersect([1 -2 %nan 3 6], [%nan 1:3])
+ ]]></programlisting>
+    <screen><![CDATA[
+--> %nan == %nan
+ ans  =
+  F
+
+--> intersect([1 -2 %nan 3 6], [%nan 1:3])
+ ans  =
+   1.   3.
+]]></screen>
+    <para/>
+    <para>
+        intersect() peut aussi traiter des caractères ou du texte. Scilab sait traiter les textes
+        encodés en UTF. Voici un exemple avec du texte en arabe, afin d'obtenir les caractères
+        arabes communs à deux phrases :
+    </para>
+        <programlisting role="example"><![CDATA[
+A = strsplit("هو برنامج علمي كبير ""Scilab""")'
+B = strsplit("فهو حر ومفتوح")'
 intersect(A,B)
-[N,ka,kb]=intersect(A,B)
+ ]]></programlisting>
+    <screen><![CDATA[
+--> A = strsplit("هو برنامج علمي كبير ""Scilab""")'
+ A  =
+!ه  و     ب  ر  ن  ا  م  ج     ع  ل  م  ي     ك  ب  ي  ر     "  S  c  i  l  a  b  "  !
 
-intersect('a'+string(A),'a'+string(B))
+--> B = strsplit("فهو حر ومفتوح")'
+ B  =
+!ف  ه  و     ح  ر     و  م  ف  ت  و  ح  !
 
+--> intersect(A,B)
+ ans  =
+!   ر  م  ه  و  !
+]]></screen>
+    <para/>
+    <para>
+        Lignes ou colonnes communes à deux matrices : l'exemple suivant extrait les colonnes communes
+        à deux matrices d'entiers signés encodés sur un octet :
+    </para>
+    <programlisting role="example"><![CDATA[
+A = int8(grand(3,5,"uin",0,1))
+B = int8(grand(3,9,"uin",0,1))
+[M,ka,kb] = intersect(A, B, "c");
+M, ka, kb
+ ]]></programlisting>
+    <screen><![CDATA[
+--> A = int8(grand(3,5,"uin",0,1))
+ A  =
+  0  0  1  1  1
+  0  0  1  1  0
+  0  0  0  0  1
 
+--> B = int8(grand(3,9,"uin",0,1))
+ B  =
+  1  0  1  1  1  0  1  1  1
+  1  0  0  1  1  1  0  0  0
+  1  0  1  0  1  1  1  0  0
 
-intersect(int16(A),int16(B))
+--> [M,ka,kb] = intersect(A, B, "c");
+--> M, ka, kb
+ M  =
+  0  1  1
+  0  0  1
+  0  1  0
 
-//with matrices
- A = [0,0,1,1 1;
-      0,1,1,1,1;
-      2,0,1,1,1;
-      0,2,2,2,2;
-      2,0,1,1,1;
-      0,0,1,1,%nan];
-B = [1,0,1;
-     1,0,2;
-     1,2,3;
-     2,0,4;
-     1,2,5;
-     %nan,0,6];
+ ka  =
+   1.   5.   3.
 
-[v,ka,kb] = intersect(A,B,'c')
-A(:,ka)
- ]]></programlisting>
+ kb  =
+   2.   3.   4.
+]]></screen>
     </refsection>
     <refsection role="see also">
         <title>Voir aussi</title>
index 426a077..e00d599 100644 (file)
@@ -2,7 +2,7 @@
 <!--
  * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
  * Copyright (C) 2008 - INRIA
- * Copyright (C) 2017 - Samuel GOUGEON
+ * Copyright (C) 2017, 2018 - Samuel GOUGEON
  *
  * Copyright (C) 2012 - 2016 - Scilab Enterprises
  *
           xmlns:scilab="http://www.scilab.org" xml:id="unique" xml:lang="fr">
     <refnamediv>
         <refname>unique</refname>
-        <refpurpose>extrait (et trie) tous les éléments distincts d'un vecteur ou d'une matrice
+        <refpurpose>extrait (et trie) les éléments distincts d'un vecteur, matrice, hypermatrice
         </refpurpose>
     </refnamediv>
     <refsynopsisdiv>
         <title>Séquence d'appel</title>
         <synopsis>
-            [N [,k]] = unique(M)
-            [N [,k]] = unique(M, orient)
+            N = unique(M)
+            N = unique(M, orient)
+            [N, k] = unique(..)
         </synopsis>
     </refsynopsisdiv>
     <refsection role="parameters">
             <varlistentry>
                 <term>M</term>
                 <listitem>
-                    <para>vecteur ou matrice de nombres ou de textes.
+                    <para>vecteur, matrice, ou hypermatrice de nombres ou de textes.
                     </para>
                 </listitem>
             </varlistentry>
             <varlistentry>
                 <term>orient</term>
                 <listitem>
-                    <para>flag qui peut prendre les valeurs : 1 ou "r", 2 ou "c"</para>
+                    <para>1 ou "r", 2 ou "c". Ne peut pas être utilisé si <varname>M</varname>
+                        est une hypermatrice.
+                    </para>
                 </listitem>
             </varlistentry>
             <varlistentry>
             <literal>M</literal> triées dans l'ordre lexicographique croissant.
         </para>
         <note>
-          Les éléments, lignes ou colonnes extraits peuvent être remis dans leur ordre d'origine en
-          triant <varname>k</varname> :
-          <programlisting role="no-example"><![CDATA[
-              [N, k] = unique(M);      k = gsort(k,"g",i); N = N(k)
-              [N, k] = unique(M, "c"); k = gsort(k,"g",i); N = N(:, k)
-              [N, k] = unique(M, "r"); k = gsort(k,"g",i); N = N(k, :)
-          ]]></programlisting>
+          Les éléments, lignes ou colonnes extraits peuvent être remis dans leur ordre initial en
+          triant <varname>k</varname>. Voir le 1er exemple.
         </note>
     </refsection>
     <refsection role="examples">
         <title>Exemples</title>
+        <para>Dédoublonnement de nombres :</para>
         <programlisting role="example"><![CDATA[
-M = round(2*rand(20,1));
+M = int8([2  0  2  2  1  1  1  2  1  1  0  1  1  0  1  1
+          0  1  2  0  1  2  2  0  1  1  2  0  1  0  0  0
+          ])
+[u, k] = unique(M)
+[uc, kc] = unique(M, "c")
 
-unique(M)
-[N,k] = unique(M)
+// Obtenir les colonnes dédoublonnées dans leur ordre initial :
+M(:, gsort(kc,"g","i"))
+ ]]></programlisting>
+    <screen><![CDATA[
+--> M 
+ M = 
+  2  0  2  2  1  1  1  2  1  1  0  1  1  0  1  1
+  0  1  2  0  1  2  2  0  1  1  2  0  1  0  0  0
 
-unique(string(M))
-[N,k] = unique(string(M))
+--> [u, k] = unique(M)
+ u  =
+  0
+  1
+  2
 
-A = [0,0,1,1;
-     0,1,1,1;
-     2,0,1,1;
-     0,2,2,2;
-     2,0,1,1;
-     0,0,1,1];
-T = 'x'+string(A);
+ k  =
+   2.
+   4.
+   1.
 
-//unique rows
+--> [uc, kc] = unique(M, "c")
+ uc  =
+  0  0  0  1  1  1  2  2
+  0  1  2  0  1  2  0  2
 
-[m,k] = unique(A,'r')
-unique(T,'r')
+ kc  =
+   14.   2.   11.   12.   5.   6.   1.   3.
 
-//unique columns
-[m,k] = unique(T,'c')
-unique(A,'c')
+--> // Obtenir les colonnes dédoublonnées dans leur ordre initial :
+--> M(:, gsort(kc,"g","i"))
+ ans  =
+  2  0  2  1  1  0  1  0
+  0  1  2  1  2  2  0  0
+]]></screen>
+        <para>Dédoublonnement de nombres complexes :</para>
+        <programlisting role="example"><![CDATA[
+i = %i;
+c = [1+i, 1-i, -i, i, -i, 1+i]
+[u, k] = unique(c)
+[uc, kc] = unique(c, "c")
  ]]></programlisting>
+    <screen><![CDATA[
+--> c = [1+i, 1-i, -i, i, -i, 1+i]
+ c  =
+   1. + i     1. - i  -i    i   -i    1. + i
+
+--> [u, k] = unique(c)
+ u  =
+  -i    i    1. - i   1. + i
+
+ k  =
+   3.   4.   2.   1.
+]]></screen>
+
+    <para>Dédoublonnement de textes :</para>
+        <programlisting role="example"><![CDATA[
+t = ["AB" "BA" "BA" "BA" "AB" "BA" "AB" "AB" "BB" "AA" "AB" "BA" "BA" "BA" "AA"
+     "AA" "AA" "AB" "AA" "BB" "BB" "BB" "BA" "AB" "AB" "BB" "BB" "AB" "AB" "AA"
+    ]
+[u, k] = unique(t)
+[uc, kc] = unique(t, "c")
+ ]]></programlisting>
+    <screen><![CDATA[
+ t  =
+!AB  BA  BA  BA  AB  BA  AB  AB  BB  AA  AB  BA  BA  BA  AA  !
+!AA  AA  AB  AA  BB  BB  BB  BA  AB  AB  BB  BB  AB  AB  AA  !
+
+--> [u, k] = unique(t);
+ u  =
+!AA  !
+!AB  !
+!BA  !
+!BB  !
+
+ k  =
+   2.
+   1.
+   3.
+   10.
+
+--> [uc, kc] = unique(t, "c")
+ uc  =
+!AA  AA  AB  AB  AB  BA  BA  BA  BB  !
+!AA  AB  AA  BA  BB  AA  AB  BB  AB  !
+
+ kc  =
+   15.   10.   1.   8.   5.   2.   3.   6.   9.
+]]></screen>
     </refsection>
     <refsection role="see also">
         <title>Voir aussi</title>
@@ -154,4 +222,15 @@ unique(A,'c')
             </member>
         </simplelist>
     </refsection>
+    <refsection role="history">
+        <title>Historique</title>
+        <revhistory>
+            <revision>
+                <revnumber>6.0.2</revnumber>
+                <revdescription>
+                    unique() peut maintenant être utilisée pour dédoublonner des nombres complexes.
+                </revdescription>
+            </revision>
+        </revhistory>
+    </refsection>
 </refentry>
diff --git a/scilab/modules/elementary_functions/help/ja_JP/setoperations/intersect.xml b/scilab/modules/elementary_functions/help/ja_JP/setoperations/intersect.xml
deleted file mode 100644 (file)
index 33e90e4..0000000
+++ /dev/null
@@ -1,281 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-
-<!--
- * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
- * Copyright (C) 2008 - INRIA
- *
- * Copyright (C) 2012 - 2016 - Scilab Enterprises
- *
- * This file is hereby licensed under the terms of the GNU GPL v2.0,
- * pursuant to article 5.3.4 of the CeCILL v.2.1.
- * This file was originally licensed under the terms of the CeCILL v2.1,
- * and continues to be available under such terms.
- * For more information, see the COPYING file which you should have received
- * along with this program.
- *
- -->
-
-<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="intersect" xml:lang="ja">
-
-    <refnamediv>
-
-        <refname>intersect</refname>
-
-        <refpurpose>2つのベクトルで共通の値のベクトルを返す</refpurpose>
-
-    </refnamediv>
-
-    <refsynopsisdiv>
-
-        <title>呼び出し手順</title>
-
-        <synopsis>
-
-            [v [,ka,kb]]=intersect(a,b)
-
-            [v [,ka,kb]]=intersect(a,b,orient)
-
-        </synopsis>
-
-    </refsynopsisdiv>
-
-    <refsection>
-
-        <title>引数</title>
-
-        <variablelist>
-
-            <varlistentry>
-
-                <term>a</term>
-
-                <listitem>
-
-                    <para>数値または文字列のベクトル</para>
-
-                </listitem>
-
-            </varlistentry>
-
-            <varlistentry>
-
-                <term>b</term>
-
-                <listitem>
-
-                    <para>数値または文字列のベクトル</para>
-
-                </listitem>
-
-            </varlistentry>
-
-            <varlistentry>
-
-                <term>orient</term>
-
-                <listitem>
-
-                    <para>flag で, 次の値を指定可能 : 1 または "r", 2 または "c"</para>
-
-                </listitem>
-
-            </varlistentry>
-
-            <varlistentry>
-
-                <term>v</term>
-
-                <listitem>
-
-                    <para>数値または文字列の行ベクトル</para>
-
-                </listitem>
-
-            </varlistentry>
-
-            <varlistentry>
-
-                <term>ka</term>
-
-                <listitem>
-
-                    <para>整数の行ベクトル</para>
-
-                </listitem>
-
-            </varlistentry>
-
-            <varlistentry>
-
-                <term>kb</term>
-
-                <listitem>
-
-                    <para>整数の行ベクトル</para>
-
-                </listitem>
-
-            </varlistentry>
-
-        </variablelist>
-
-    </refsection>
-
-    <refsection>
-
-        <title>説明</title>
-
-        <para>
-
-            <literal>intersect(a,b)</literal> は2つのベクトル
-
-            <literal>a</literal> および
-
-            <literal>b</literal>で共通な値をソートした行ベクトルを返します.
-
-        </para>
-
-        <para>
-
-            <literal>[v,ka,kb]=intersect(a,b)</literal> は
-
-            <literal>v=a(ka)</literal> および <literal>v=b(kb)</literal>となるような
-
-            添字ベクトル<literal>ka</literal> および <literal>kb</literal>も返します.
-
-        </para>
-
-        <para>
-
-            <literal>intersect(a,b,"r")</literal> または
-
-            <literal>intersect(a,b,1)</literal>は,辞書式で昇順にソートされた
-
-            <literal>a</literal> および <literal>b</literal> のユニークな行の
-
-            共通な値からなる行列を返します.この場合,
-
-            行列 <literal>a</literal> および <literal>b</literal> の列の数は
-
-            同じである必要があります.
-
-        </para>
-
-        <para>
-
-            <literal>[v,ka,kb]=intersect(a,b,"r")</literal> は
-
-            <literal>v=a(ka,:)</literal> および <literal>v=b(kb,:)</literal>となるような
-
-            添字ベクトル<literal>ka</literal> および <literal>kb</literal>も返します.
-
-        </para>
-
-        <para>
-
-            <literal>intersect(a,b,"c")</literal> または
-
-            <literal>intersect(a,b,2)</literal> は,辞書式で昇順にソートされた
-
-            <literal>a</literal> および <literal>b</literal> のユニークな列の
-
-            共通な値からなる行列を返します.この場合,
-
-            行列 <literal>a</literal> および <literal>b</literal> の行の数は
-
-            同じである必要があります.
-
-        </para>
-
-        <para>
-
-            <literal>[v,ka,kb]=intersect(a,b,"c")</literal>
-
-            は
-
-            <literal>v=a(:,ka)</literal> および <literal>v=b(:,kb)</literal>となるような
-
-            添字ベクトル<literal>ka</literal> および <literal>kb</literal>も返します.
-
-        </para>
-
-    </refsection>
-
-    <refsection>
-
-        <title>注意</title>
-
-        <para>NaN は処理対象ではないとみなされ,ベクトルの共通項の場合,
-
-            共通要素から除外されます.
-
-        </para>
-
-    </refsection>
-
-    <refsection>
-
-        <title>例</title>
-
-        <programlisting role="example"><![CDATA[
-A=round(5*rand(10,1));
-B=round(5*rand(7,1));
-intersect(A,B)
-[N,ka,kb]=intersect(A,B)
-intersect('a'+string(A),'a'+string(B))
-intersect(int16(A),int16(B))
-//行列の場合
- A = [0,0,1,1 1;
-      0,1,1,1,1;
-      2,0,1,1,1;
-      0,2,2,2,2;
-      2,0,1,1,1;
-      0,0,1,1,%nan];
-B = [1,0,1;
-     1,0,2;
-     1,2,3;
-     2,0,4;
-     1,2,5;
-     %nan,0,6];
-[v,ka,kb] = intersect(A,B,'c')
-A(:,ka)
- ]]></programlisting>
-
-    </refsection>
-
-    <refsection role="see also">
-
-        <title>参照</title>
-
-        <simplelist type="inline">
-
-            <member>
-
-                <link linkend="members">members</link>
-
-            </member>
-
-            <member>
-
-                <link linkend="unique">unique</link>
-
-            </member>
-
-            <member>
-
-                <link linkend="gsort">gsort</link>
-
-            </member>
-
-            <member>
-
-                <link linkend="union">union</link>
-
-            </member>
-
-        </simplelist>
-
-    </refsection>
-
-</refentry>
-
index 1bed8bd..d6cc82c 100644 (file)
@@ -2,7 +2,7 @@
 <!--
  * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
  * Copyright (C) 2008 - INRIA
- * Copyright (C) 2017 - Samuel GOUGEON
+ * Copyright (C) 2017, 2018 - Samuel GOUGEON
  *
  * Copyright (C) 2012 - 2016 - Scilab Enterprises
  *
@@ -25,8 +25,9 @@
     <refsynopsisdiv>
         <title>呼び出し手順</title>
         <synopsis>
-            [N ,k] = unique(M)
-            [N ,k] = unique(M, orient)
+            N = unique(M)
+            N = unique(M, orient)
+            [N, k] = unique(..)
         </synopsis>
     </refsynopsisdiv>
     <refsection role="parameters">
@@ -41,7 +42,9 @@
             <varlistentry>
                 <term>orient</term>
                 <listitem>
-                    <para>フラグで以下の値のどれかとなる : 1 または "r", 2 または "c"</para>
+                    <para>フラグで以下の値のどれかとなる : 1 または "r", 2 または "c".
+                        It can't be used if <varname>M</varname> is an hypermatrix.
+                    </para>
                 </listitem>
             </varlistentry>
             <varlistentry>
         </para>
         <note>
           Extracted components, rows or columns can be resorted in their initial order by sorting
-          <varname>k</varname>:
-          <programlisting role="no-example"><![CDATA[
-              [N, k] = unique(M);      k = gsort(k,"g",i); N = N(k)
-              [N, k] = unique(M, "c"); k = gsort(k,"g",i); N = N(:, k)
-              [N, k] = unique(M, "r"); k = gsort(k,"g",i); N = N(k, :)
-          ]]></programlisting>
+          <varname>k</varname>. See the first example.
         </note>
     </refsection>
     <refsection role="examples">
         <title>例</title>
+        <para>With some numbers:</para>
+        <programlisting role="example"><![CDATA[
+M = int8([2  0  2  2  1  1  1  2  1  1  0  1  1  0  1  1
+          0  1  2  0  1  2  2  0  1  1  2  0  1  0  0  0
+          ])
+[u, k] = unique(M)
+[uc, kc] = unique(M, "c")
+
+// Get unduplicated columns in initial order:
+M(:, gsort(kc,"g","i"))
+ ]]></programlisting>
+    <screen><![CDATA[
+--> M 
+ M = 
+  2  0  2  2  1  1  1  2  1  1  0  1  1  0  1  1
+  0  1  2  0  1  2  2  0  1  1  2  0  1  0  0  0
+
+--> [u, k] = unique(M)
+ u  =
+  0
+  1
+  2
+
+ k  =
+   2.
+   4.
+   1.
+
+--> [uc, kc] = unique(M, "c")
+ uc  =
+  0  0  0  1  1  1  2  2
+  0  1  2  0  1  2  0  2
+
+ kc  =
+   14.   2.   11.   12.   5.   6.   1.   3.
+
+--> // Get unduplicated columns in initial order:
+--> M(:, gsort(kc,"g","i"))
+ ans  =
+  2  0  2  1  1  0  1  0
+  0  1  2  1  2  2  0  0
+]]></screen>
+        <para>With complex numbers:</para>
         <programlisting role="example"><![CDATA[
-M = round(2*rand(20,1));
-unique(M)
-[N,k] = unique(M)
-unique(string(M))
-[N,k] = unique(string(M))
+i = %i;
+c = [1+i, 1-i, -i, i, -i, 1+i]
+[u, k] = unique(c)
+[uc, kc] = unique(c, "c")
+ ]]></programlisting>
+    <screen><![CDATA[
+--> c = [1+i, 1-i, -i, i, -i, 1+i]
+ c  =
+   1. + i     1. - i  -i    i   -i    1. + i
 
-A = [0,0,1,1;
-     0,1,1,1;
-     2,0,1,1;
-     0,2,2,2;
-     2,0,1,1;
-     0,0,1,1];
-T = 'x'+string(A);
+--> [u, k] = unique(c)
+ u  =
+  -i    i    1. - i   1. + i
 
-//ユニークな行
-[m,k] = unique(A,'r')
-unique(T,'r')
+ k  =
+   3.   4.   2.   1.
+]]></screen>
 
-//ユニークな列
-[m,k] = unique(T,'c')
-unique(A,'c')
+    <para>With some texts:</para>
+        <programlisting role="example"><![CDATA[
+t = ["AB" "BA" "BA" "BA" "AB" "BA" "AB" "AB" "BB" "AA" "AB" "BA" "BA" "BA" "AA"
+     "AA" "AA" "AB" "AA" "BB" "BB" "BB" "BA" "AB" "AB" "BB" "BB" "AB" "AB" "AA"
+    ]
+[u, k] = unique(t)
+[uc, kc] = unique(t, "c")
  ]]></programlisting>
+    <screen><![CDATA[
+ t  =
+!AB  BA  BA  BA  AB  BA  AB  AB  BB  AA  AB  BA  BA  BA  AA  !
+!AA  AA  AB  AA  BB  BB  BB  BA  AB  AB  BB  BB  AB  AB  AA  !
+
+--> [u, k] = unique(t);
+ u  =
+!AA  !
+!AB  !
+!BA  !
+!BB  !
+
+ k  =
+   2.
+   1.
+   3.
+   10.
+
+--> [uc, kc] = unique(t, "c")
+ uc  =
+!AA  AA  AB  AB  AB  BA  BA  BA  BB  !
+!AA  AB  AA  BA  BB  AA  AB  BB  AB  !
+
+ kc  =
+   15.   10.   1.   8.   5.   2.   3.   6.   9.
+]]></screen>
     </refsection>
     <refsection role="see also">
         <title>参照</title>
@@ -151,4 +222,15 @@ unique(A,'c')
             </member>
         </simplelist>
     </refsection>
+    <refsection role="history">
+        <title>履歴</title>
+        <revhistory>
+            <revision>
+                <revnumber>6.0.2</revnumber>
+                <revdescription>
+                    unique() can now be used to unduplicate complex numbers.
+                </revdescription>
+            </revision>
+        </revhistory>
+    </refsection>
 </refentry>
\ No newline at end of file
diff --git a/scilab/modules/elementary_functions/help/pt_BR/setoperations/intersect.xml b/scilab/modules/elementary_functions/help/pt_BR/setoperations/intersect.xml
deleted file mode 100644 (file)
index 1ba2099..0000000
+++ /dev/null
@@ -1,159 +0,0 @@
-<?xml version="1.0" encoding="ISO-8859-1"?>
-<!--
- * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
- * Copyright (C) 2008 - INRIA
- *
- * Copyright (C) 2012 - 2016 - Scilab Enterprises
- *
- * This file is hereby licensed under the terms of the GNU GPL v2.0,
- * pursuant to article 5.3.4 of the CeCILL v.2.1.
- * This file was originally licensed under the terms of the CeCILL v2.1,
- * and continues to be available under such terms.
- * For more information, see the COPYING file which you should have received
- * along with this program.
- *
- -->
-<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="intersect" xml:lang="pt">
-    <refnamediv>
-        <refname>intersect</refname>
-        <refpurpose>returns the vector of common values of two
-            vectors
-        </refpurpose>
-    </refnamediv>
-    <refsynopsisdiv>
-        <title>Seqüência de Chamamento</title>
-        <synopsis>
-            [v [,ka,kb]]=intersect(a,b)
-            [v [,ka,kb]]=intersect(a,b,orient)
-        </synopsis>
-    </refsynopsisdiv>
-    <refsection>
-        <title>Parâmetros</title>
-        <variablelist>
-            <varlistentry>
-                <term>a</term>
-                <listitem>
-                    <para>vetor de números ou strings </para>
-                </listitem>
-            </varlistentry>
-            <varlistentry>
-                <term>b</term>
-                <listitem>
-                    <para>vetor de números ou strings </para>
-                </listitem>
-            </varlistentry>
-            <varlistentry>
-                <term>orient</term>
-                <listitem>
-                    <para>flag com possíveis valores : 1 ou "r", 2 ou "c"</para>
-                </listitem>
-            </varlistentry>
-            <varlistentry>
-                <term>v</term>
-                <listitem>
-                    <para>vetor linha de números ou strings </para>
-                </listitem>
-            </varlistentry>
-            <varlistentry>
-                <term>ka</term>
-                <listitem>
-                    <para>vetor linha de inteiros </para>
-                </listitem>
-            </varlistentry>
-            <varlistentry>
-                <term>kb</term>
-                <listitem>
-                    <para>vetor linha de inteiros </para>
-                </listitem>
-            </varlistentry>
-        </variablelist>
-    </refsection>
-    <refsection>
-        <title>Descrição</title>
-        <para>
-            <literal>intersect(a,b)</literal> retorna um vetor-linha ordenado
-            dos valores comuns a dois vetores <literal>a</literal> e
-            <literal>b</literal>.
-        </para>
-        <para>
-            <literal>[v,ka,kb]=intersect(a,b)</literal> retorna também dois
-            vetores de índices <literal>ka</literal> e <literal>kb</literal> tais que
-            <literal>v=a(ka)</literal> e <literal>v=b(kb)</literal>.
-        </para>
-        <para>
-            <literal>intersect(a,b,"r")</literal> ou
-            <literal>intersect(a,b,1)</literal>retorna a matriz formada interseção das
-            linhas únicas de <literal>a</literal> e <literal>b</literal> ordenadas em
-            ordem lexicográfica ascendente. Neste caso, <literal>a</literal> e
-            <literal>b</literal> devem ter o mesmo número de colunas.
-        </para>
-        <para>
-            <literal>[v,ka,kb]=intersect(a,b,"r")</literal> retorna também dois
-            vetores de índices <literal>ka</literal> e <literal>kb</literal> tais que
-            <literal>v=a(ka,:)</literal> e <literal>v=b(kb,:)</literal>.
-        </para>
-        <para>
-            <literal>intersect(a,b,"c")</literal> ou
-            <literal>intersect(a,b,2)</literal>retorna a matriz formada interseção das
-            colunas únicas de <literal>a</literal> e <literal>b</literal> ordenadas em
-            ordem lexicográfica ascendente. Neste caso, <literal>a</literal> e
-            <literal>b</literal> devem ter o mesmo número de linhas.
-        </para>
-        <para>
-            <literal>[v,ka,kb]=intersect(a,b,"c")</literal> retorna também dois
-            vetores de índices <literal>ka</literal> e <literal>kb</literal> tais que
-            <literal>v=a(:,ka)</literal> e <literal>v=b(:,kb)</literal>.
-        </para>
-    </refsection>
-    <refsection>
-        <title>Observação</title>
-        <para>NaN são considerados diferentes deles mesmos , então são excluídos
-            da interseção em caso de interseção de vetores.
-        </para>
-    </refsection>
-    <refsection>
-        <title>Exemplos</title>
-        <programlisting role="example"><![CDATA[
-A=round(5*rand(10,1));
-B=round(5*rand(7,1));
-
-intersect(A,B)
-[N,ka,kb]=intersect(A,B)
-
-intersect('a'+string(A),'a'+string(B))
-
-intersect(int16(A),int16(B))
-
-//com matrizes
- A = [0,0,1,1 1;
-      0,1,1,1,1;
-      2,0,1,1,1;
-      0,2,2,2,2;
-      2,0,1,1,1;
-      0,0,1,1,%nan];
-B = [1,0,1;
-     1,0,2;
-     1,2,3;
-     2,0,4;
-     1,2,5;
-     %nan,0,6];
-
-[v,ka,kb] = intersect(A,B,'c')
-A(:,ka)
- ]]></programlisting>
-    </refsection>
-    <refsection role="see also">
-        <title>Ver Também</title>
-        <simplelist type="inline">
-            <member>
-                <link linkend="unique">unique</link>
-            </member>
-            <member>
-                <link linkend="gsort">gsort</link>
-            </member>
-            <member>
-                <link linkend="union">union</link>
-            </member>
-        </simplelist>
-    </refsection>
-</refentry>
index 2b41882..aab2cf4 100644 (file)
@@ -1,8 +1,8 @@
-<?xml version="1.0" encoding="ISO-8859-1"?>
+<?xml version="1.0" encoding="UTF-8"?>
 <!--
  * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
  * Copyright (C) 2008 - INRIA
- * Copyright (C) 2017 - Samuel GOUGEON
+ * Copyright (C) 2017, 2018 - Samuel GOUGEON
  *
  * Copyright (C) 2012 - 2016 - Scilab Enterprises
  *
@@ -26,8 +26,9 @@
     <refsynopsisdiv>
         <title>Seqüência de Chamamento</title>
         <synopsis>
-            [N ,k] = unique(M)
-            [N ,k] = unique(M, orient)
+            N = unique(M)
+            N = unique(M, orient)
+            [N, k] = unique(..)
         </synopsis>
     </refsynopsisdiv>
     <refsection role="parameters">
@@ -42,7 +43,9 @@
             <varlistentry>
                 <term>orient</term>
                 <listitem>
-                    <para>flag com valores possíveis : 1 ou "r", 2 ou "c"</para>
+                    <para>flag com valores possíveis : 1 ou "r", 2 ou "c".
+                        It can't be used if <varname>M</varname> is an hypermatrix.
+                    </para>
                 </listitem>
             </varlistentry>
             <varlistentry>
         </para>
         <note>
           Extracted components, rows or columns can be resorted in their initial order by sorting
-          <varname>k</varname>:
-          <programlisting role="no-example"><![CDATA[
-              [N, k] = unique(M);      k = gsort(k,"g",i); N = N(k)
-              [N, k] = unique(M, "c"); k = gsort(k,"g",i); N = N(:, k)
-              [N, k] = unique(M, "r"); k = gsort(k,"g",i); N = N(k, :)
-          ]]></programlisting>
+          <varname>k</varname>. See the first example.
         </note>
     </refsection>
     <refsection role="description">
         <title>Exemplos</title>
+        <para>With some numbers:</para>
         <programlisting role="example"><![CDATA[
-M = round(2*rand(20,1));
+M = int8([2  0  2  2  1  1  1  2  1  1  0  1  1  0  1  1
+          0  1  2  0  1  2  2  0  1  1  2  0  1  0  0  0
+          ])
+[u, k] = unique(M)
+[uc, kc] = unique(M, "c")
+
+// Get unduplicated columns in initial order:
+M(:, gsort(kc,"g","i"))
+ ]]></programlisting>
+    <screen><![CDATA[
+--> M 
+ M = 
+  2  0  2  2  1  1  1  2  1  1  0  1  1  0  1  1
+  0  1  2  0  1  2  2  0  1  1  2  0  1  0  0  0
+
+--> [u, k] = unique(M)
+ u  =
+  0
+  1
+  2
 
-unique(M)
-[N,k] = unique(M)
+ k  =
+   2.
+   4.
+   1.
 
-unique(string(M))
-[N,k] = unique(string(M))
+--> [uc, kc] = unique(M, "c")
+ uc  =
+  0  0  0  1  1  1  2  2
+  0  1  2  0  1  2  0  2
+
+ kc  =
+   14.   2.   11.   12.   5.   6.   1.   3.
+
+--> // Get unduplicated columns in initial order:
+--> M(:, gsort(kc,"g","i"))
+ ans  =
+  2  0  2  1  1  0  1  0
+  0  1  2  1  2  2  0  0
+]]></screen>
+        <para>With complex numbers:</para>
+        <programlisting role="example"><![CDATA[
+i = %i;
+c = [1+i, 1-i, -i, i, -i, 1+i]
+[u, k] = unique(c)
+[uc, kc] = unique(c, "c")
+ ]]></programlisting>
+    <screen><![CDATA[
+--> c = [1+i, 1-i, -i, i, -i, 1+i]
+ c  =
+   1. + i     1. - i  -i    i   -i    1. + i
 
-A = [0,0,1,1;
-     0,1,1,1;
-     2,0,1,1;
-     0,2,2,2;
-     2,0,1,1;
-     0,0,1,1];
-T = 'x'+string(A);
+--> [u, k] = unique(c)
+ u  =
+  -i    i    1. - i   1. + i
 
-//linhas únicas
-[m,k] = unique(A,'r')
-unique(T,'r')
+ k  =
+   3.   4.   2.   1.
+]]></screen>
 
-//colunas únicas
-[m,k] = unique(T,'c')
-unique(A,'c')
+    <para>With some texts:</para>
+        <programlisting role="example"><![CDATA[
+t = ["AB" "BA" "BA" "BA" "AB" "BA" "AB" "AB" "BB" "AA" "AB" "BA" "BA" "BA" "AA"
+     "AA" "AA" "AB" "AA" "BB" "BB" "BB" "BA" "AB" "AB" "BB" "BB" "AB" "AB" "AA"
+    ]
+[u, k] = unique(t)
+[uc, kc] = unique(t, "c")
  ]]></programlisting>
+    <screen><![CDATA[
+ t  =
+!AB  BA  BA  BA  AB  BA  AB  AB  BB  AA  AB  BA  BA  BA  AA  !
+!AA  AA  AB  AA  BB  BB  BB  BA  AB  AB  BB  BB  AB  AB  AA  !
+
+--> [u, k] = unique(t);
+ u  =
+!AA  !
+!AB  !
+!BA  !
+!BB  !
+
+ k  =
+   2.
+   1.
+   3.
+   10.
+
+--> [uc, kc] = unique(t, "c")
+ uc  =
+!AA  AA  AB  AB  AB  BA  BA  BA  BB  !
+!AA  AB  AA  BA  BB  AA  AB  BB  AB  !
+
+ kc  =
+   15.   10.   1.   8.   5.   2.   3.   6.   9.
+]]></screen>
     </refsection>
     <refsection role="see also">
         <title>Ver Também</title>
@@ -151,4 +220,15 @@ unique(A,'c')
             </member>
         </simplelist>
     </refsection>
+    <refsection role="history">
+        <title>Histórico</title>
+        <revhistory>
+            <revision>
+                <revnumber>6.0.2</revnumber>
+                <revdescription>
+                    unique() can now be used to unduplicate complex numbers.
+                </revdescription>
+            </revision>
+        </revhistory>
+    </refsection>
 </refentry>
diff --git a/scilab/modules/elementary_functions/help/ru_RU/setoperations/intersect.xml b/scilab/modules/elementary_functions/help/ru_RU/setoperations/intersect.xml
deleted file mode 100644 (file)
index e182d0c..0000000
+++ /dev/null
@@ -1,150 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
- * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
- * Copyright (C) 2008 - INRIA
- *
- * Copyright (C) 2012 - 2016 - Scilab Enterprises
- *
- * This file is hereby licensed under the terms of the GNU GPL v2.0,
- * pursuant to article 5.3.4 of the CeCILL v.2.1.
- * This file was originally licensed under the terms of the CeCILL v2.1,
- * and continues to be available under such terms.
- * For more information, see the COPYING file which you should have received
- * along with this program.
- *
- -->
-<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="intersect" xml:lang="ru">
-    <refnamediv>
-        <refname>intersect</refname>
-        <refpurpose>возвращает вектор значений, общих для двух векторов/матриц</refpurpose>
-    </refnamediv>
-    <refsynopsisdiv>
-        <title>Синтаксис</title>
-        <synopsis>[v [,ka,kb]]=intersect(a,b)</synopsis>
-        <synopsis>[v [,ka,kb]]=intersect(a,b,orient)</synopsis>
-    </refsynopsisdiv>
-    <refsection>
-        <title>Аргументы</title>
-        <variablelist>
-            <varlistentry>
-                <term>a</term>
-                <listitem>
-                    <para>вектор (матрица) чисел или строк</para>
-                </listitem>
-            </varlistentry>
-            <varlistentry>
-                <term>b</term>
-                <listitem>
-                    <para>вектор (матрица) чисел или строк</para>
-                </listitem>
-            </varlistentry>
-            <varlistentry>
-                <term>orient</term>
-                <listitem>
-                    <para>флаг с возможными значениями: 1 или "r", 2 или "c"</para>
-                </listitem>
-            </varlistentry>
-            <varlistentry>
-                <term>v</term>
-                <listitem>
-                    <para>вектор-строка чисел или строковых значений</para>
-                </listitem>
-            </varlistentry>
-            <varlistentry>
-                <term>ka</term>
-                <listitem>
-                    <para>вектор-строка целых чисел</para>
-                </listitem>
-            </varlistentry>
-            <varlistentry>
-                <term>kb</term>
-                <listitem>
-                    <para>вектор-строка целых чисел</para>
-                </listitem>
-            </varlistentry>
-        </variablelist>
-    </refsection>
-    <refsection>
-        <title>Описание</title>
-        <para>
-            <literal>intersect(a,b)</literal> возвращает отсортированный вектор-строку значений, общих для двух векторов (матриц) <literal>a</literal> и     <literal>b</literal>.
-        </para>
-        <para>
-            <literal>[v,ka,kb]=intersect(a,b)</literal> также возвращает векторы индексов  <literal>ka</literal> и <literal>kb</literal> такие, что <literal>v=a(ka)</literal>
-            и <literal>v=b(kb)</literal>.
-        </para>
-        <para>
-            <literal>intersect(a,b,"r")</literal> или <literal>intersect(a,b,1)</literal>
-            возвращает матрицу, сформированную пересечением уникальных строк <literal>a</literal> и
-            <literal>b</literal>, отсортированную в лексикографическом порядке возрастания. В этом случае матрицы <literal>a</literal> и <literal>b</literal> должны иметь одинаковое количество столбцов.
-        </para>
-        <para>
-            <literal>[v,ka,kb]=intersect(a,b,"r")</literal> также возвращает векторы индексов
-            <literal>ka</literal> и <literal>kb</literal> такие, что
-            <literal>v=a(ka,:)</literal> и <literal>v=b(kb,:)</literal>.
-        </para>
-        <para>
-            <literal>intersect(a,b,"c")</literal> или
-            <literal>intersect(a,b,2)</literal> возвращает матрицу, сформированную пересечением
-            уникальных столбцов <literal>a</literal> и <literal>b</literal>, отсортированную в
-            лексикографическом порядке возрастания. В этом случае матрицы <literal>a</literal> и
-            <literal>b</literal> должны иметь одинаковое количество строк.
-        </para>
-        <para>
-            <literal>[v,ka,kb]=intersect(a,b,"c")</literal> также возвращает векторы индексов
-            <literal>ka</literal> и <literal>kb</literal> такие, что
-            <literal>v=a(:,ka)</literal> и <literal>v=b(:,kb)</literal>.
-        </para>
-    </refsection>
-    <refsection>
-        <title>Примечание</title>
-        <para>
-            Значения NaN рассматриваются как отличные друг от друга, так что они исключаются из пересечения в случае пересечения двух векторов.
-        </para>
-    </refsection>
-    <refsection>
-        <title>Примеры</title>
-        <programlisting role="example"><![CDATA[
-A=round(5*rand(10,1));
-B=round(5*rand(7,1));
-
-intersect(A,B)
-[N,ka,kb]=intersect(A,B)
-
-intersect('a'+string(A),'a'+string(B))
-
-intersect(int16(A),int16(B))
-
-//с матрицами
- A = [0,0,1,1 1;
-      0,1,1,1,1;
-      2,0,1,1,1;
-      0,2,2,2,2;
-      2,0,1,1,1;
-      0,0,1,1,%nan];
-B = [1,0,1;
-     1,0,2;
-     1,2,3;
-     2,0,4;
-     1,2,5;
-     %nan,0,6];
-
-[v,ka,kb] = intersect(A,B,'c')
-A(:,ka)
- ]]></programlisting>
-    </refsection>
-    <refsection role="see also">
-        <title>Смотрите также</title>
-        <simplelist type="inline">
-            <member>
-                <link linkend="unique">unique</link>
-            </member>
-            <member>
-                <link linkend="gsort">gsort</link>
-            </member>
-            <member>
-                <link linkend="union">union</link>
-            </member>
-        </simplelist>
-    </refsection>
-</refentry>
index e48bbf5..d818f66 100644 (file)
@@ -2,7 +2,7 @@
 <!--
  * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
  * Copyright (C) 2008 - INRIA
- * Copyright (C) 2017 - Samuel GOUGEON
+ * Copyright (C) 2017, 2018 - Samuel GOUGEON
  *
  * Copyright (C) 2012 - 2016 - Scilab Enterprises
  *
@@ -25,8 +25,9 @@
     <refsynopsisdiv>
         <title>Синтаксис</title>
         <synopsis>
-            [N ,k] = unique(M)
-            [N ,k] = unique(M ,orient)
+            N = unique(M)
+            N = unique(M, orient)
+            [N, k] = unique(..)
         </synopsis>
     </refsynopsisdiv>
     <refsection role="parameters">
@@ -41,7 +42,9 @@
             <varlistentry>
                 <term>orient</term>
                 <listitem>
-                    <para>флаг с возможными значениями: 1 или "r", 2 или "c"</para>
+                    <para>флаг с возможными значениями: 1 или "r", 2 или "c".
+                        Не может использоваться, если <varname>M</varname> является гиперматрицей.
+                    </para>
                 </listitem>
             </varlistentry>
             <varlistentry>
         </para>
         <note>
           Извлечённые компоненты, строки или столбцы могут быть пересортированны в их исходном порядке через
-          сортировку с помощью <varname>k</varname>:
-          <programlisting role="no-example"><![CDATA[
-              [N, k] = unique(M);      k = gsort(k,"g",i); N = N(k)
-              [N, k] = unique(M, "c"); k = gsort(k,"g",i); N = N(:, k)
-              [N, k] = unique(M, "r"); k = gsort(k,"g",i); N = N(k, :)
-          ]]></programlisting>
+          сортировку с помощью <varname>k</varname>. См. первый пример.
         </note>
     </refsection>
     <refsection role="examples">
         <title>Примеры</title>
+        <para>With some numbers:</para>
         <programlisting role="example"><![CDATA[
-M = round(2*rand(20,1));
-unique(M)
-[N,k] = unique(M)
+M = int8([2  0  2  2  1  1  1  2  1  1  0  1  1  0  1  1
+          0  1  2  0  1  2  2  0  1  1  2  0  1  0  0  0
+          ])
+[u, k] = unique(M)
+[uc, kc] = unique(M, "c")
+
+// Получим недублированные столбцы в исходном порядке:
+M(:, gsort(kc,"g","i"))
+ ]]></programlisting>
+    <screen><![CDATA[
+--> M 
+ M = 
+  2  0  2  2  1  1  1  2  1  1  0  1  1  0  1  1
+  0  1  2  0  1  2  2  0  1  1  2  0  1  0  0  0
+
+--> [u, k] = unique(M)
+ u  =
+  0
+  1
+  2
 
-unique(string(M))
-[N,k] = unique(string(M))
+ k  =
+   2.
+   4.
+   1.
 
-A = [0,0,1,1;
-     0,1,1,1;
-     2,0,1,1;
-     0,2,2,2;
-     2,0,1,1;
-     0,0,1,1];
-T = 'x' + string(A);
+--> [uc, kc] = unique(M, "c")
+ uc  =
+  0  0  0  1  1  1  2  2
+  0  1  2  0  1  2  0  2
 
-//уникальные строки
-[m,k] = unique(A,'r')
-unique(T,'r')
+ kc  =
+   14.   2.   11.   12.   5.   6.   1.   3.
 
-//уникальные столбцы
-[m,k] = unique(T,'c')
-unique(A,'c')
+--> // Получим недублированные столбцы в исходном порядке:
+--> M(:, gsort(kc,"g","i"))
+ ans  =
+  2  0  2  1  1  0  1  0
+  0  1  2  1  2  2  0  0
+]]></screen>
+        <para>С комплексными числами:</para>
+        <programlisting role="example"><![CDATA[
+i = %i;
+c = [1+i, 1-i, -i, i, -i, 1+i]
+[u, k] = unique(c)
+[uc, kc] = unique(c, "c")
  ]]></programlisting>
+    <screen><![CDATA[
+--> c = [1+i, 1-i, -i, i, -i, 1+i]
+ c  =
+   1. + i     1. - i  -i    i   -i    1. + i
+
+--> [u, k] = unique(c)
+ u  =
+  -i    i    1. - i   1. + i
+
+ k  =
+   3.   4.   2.   1.
+]]></screen>
+
+    <para>С текстом:</para>
+        <programlisting role="example"><![CDATA[
+t = ["AB" "BA" "BA" "BA" "AB" "BA" "AB" "AB" "BB" "AA" "AB" "BA" "BA" "BA" "AA"
+     "AA" "AA" "AB" "AA" "BB" "BB" "BB" "BA" "AB" "AB" "BB" "BB" "AB" "AB" "AA"
+    ]
+[u, k] = unique(t)
+[uc, kc] = unique(t, "c")
+ ]]></programlisting>
+    <screen><![CDATA[
+ t  =
+!AB  BA  BA  BA  AB  BA  AB  AB  BB  AA  AB  BA  BA  BA  AA  !
+!AA  AA  AB  AA  BB  BB  BB  BA  AB  AB  BB  BB  AB  AB  AA  !
+
+--> [u, k] = unique(t);
+ u  =
+!AA  !
+!AB  !
+!BA  !
+!BB  !
+
+ k  =
+   2.
+   1.
+   3.
+   10.
+
+--> [uc, kc] = unique(t, "c")
+ uc  =
+!AA  AA  AB  AB  AB  BA  BA  BA  BB  !
+!AA  AB  AA  BA  BB  AA  AB  BB  AB  !
+
+ kc  =
+   15.   10.   1.   8.   5.   2.   3.   6.   9.
+]]></screen>
     </refsection>
     <refsection role="see also">
         <title>Смотрите также</title>
@@ -147,4 +217,15 @@ unique(A,'c')
             </member>
         </simplelist>
     </refsection>
+    <refsection role="history">
+        <title>История</title>
+        <revhistory>
+            <revision>
+                <revnumber>6.0.2</revnumber>
+                <revdescription>
+                    unique() теперь может использоваться для удаления дубликатов комплексных чисел.
+                </revdescription>
+            </revision>
+        </revhistory>
+    </refsection>
 </refentry>
index 56107b5..d724f6a 100644 (file)
@@ -1,5 +1,6 @@
 // Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
 // Copyright (C) INRIA
+// Copyright (C) 2018 - Samuel GOUGEON
 //
 // Copyright (C) 2012 - 2016 - Scilab Enterprises
 //
 
 function [x,k]=unique(x,orient)
     // extract unique components of a vector
-    if argn(2)<2 then orient="*",end
-    if size(x,orient)==1 then k = 1;return,end
+
+    if argn(2)<2 then orient = "*",end
+    sz = size(x);
+    if size(x, orient)==1 then
+        k = 1
+        return
+    end
+
+    // PROCESSING complex numbers
+    if or(type(x)==[1 5]) then
+        if ~isreal(x)
+            if isreal(x,0)
+                x = real(x);
+            else
+                if orient=="*"
+                    x = [real(x(:)) imag(x(:))]
+                    if argn(1)==1
+                        x = unique(x,"r")
+                    else
+                        [x, k] = unique(x,"r")
+                    end
+                    x = complex(x(:,1),x(:,2));
+                    if sz(1)==1 // => put results in row
+                        x = x.'
+                        k = k'
+                    end
+                elseif orient=="r" | orient==1
+                    x = [real(x) imag(x)]
+                    if argn(1)==1
+                        x = unique(x,"r")
+                    else
+                        [x, k] = unique(x,"r")
+                    end
+                    x = complex(x(:,1:sz(2)), x(:,sz(2)+1:$));
+                elseif orient=="c" | orient==2
+                    x = [real(x) ; imag(x)]
+                    if argn(1)==1
+                        x = unique(x,"c")
+                    else
+                        [x, k] = unique(x,"c")
+                    end
+                    x = complex(x(1:sz(1),:), x(sz(1)+1:$,:));
+                else
+                    msg = _("%s: Argument #%d: Must be in the set {%s}.\n")
+                    error(msprintf(msg, "unique", 2, "1,""r"",2,""c"""));
+                end
+                return
+            end
+        end
+    end
+
+    // PROCESSING text and other numerical types
     if orient=="*" then
         if argn(1) == 2 then
             [x,k] = gsort(x,"g","d");
@@ -55,6 +106,7 @@ function [x,k]=unique(x,orient)
             x(:, find(and(x(:,2:$) == x(:,1:$-1),"r")) ) = [];
         end
     else
-        error(msprintf(gettext("%s: Wrong value for input argument #%d: %d,''%s'',%d or ''%s'' expected\n"),"unique",2,1,"r",2,"c"));
+        msg = _("%s: Argument #%d: Must be in the set {%s}.\n")
+        error(msprintf(msg, "unique", 2, "1,""r"",2,""c"""));
     end
 endfunction
index b2df454..942874c 100644 (file)
@@ -299,7 +299,14 @@ types::Double* gsort(types::Double* pIn, types::Double* pDblInd, const std::wstr
                 V.push_back(std::pair<int, std::pair<double*, double*> >(i, std::pair<double*, double*>(pdblTemp + (i * iItem), pdblTemp + (i + 1) * iItem)));
             }
 
-            std::sort(V.begin(), V.end(), (*pFuncWayL));
+            if (pdblInd) 
+            {
+                std::stable_sort(V.begin(), V.end(), (*pFuncWayL));                    
+            }
+            else
+            {
+                std::sort(V.begin(), V.end(), (*pFuncWayL));
+            }
 
             int j = 0;
             for (it = V.begin(); it != V.end(); it++, j++)
@@ -348,7 +355,7 @@ types::Double* gsort(types::Double* pIn, types::Double* pDblInd, const std::wstr
                         V.push_back(std::pair<std::pair<int, int>, double>(std::pair<int, int>(iPos, j), pdblInR[iPos]));
                     }
 
-                    std::sort(V.begin(), V.end(), (*pFuncWay));
+                    std::sort(V.begin(), V.end(), (*pFuncWay));                    
 
                     int j = 0;
                     for (it = V.begin(); it != V.end(); it++, j++)
@@ -422,7 +429,14 @@ types::Double* gsort(types::Double* pIn, types::Double* pDblInd, const std::wstr
                 V.push_back(std::pair<int, std::pair<double*, double*> >(i, std::pair<double*, double*>(pdblInR + i * iItem, pdblInR + (i + 1) * iItem)));
             }
 
-            std::sort(V.begin(), V.end(), (*pFuncWayL));
+            if (pDblInd)
+            {
+                std::stable_sort(V.begin(), V.end(), (*pFuncWayL));
+            }
+            else
+            {
+                std::sort(V.begin(), V.end(), (*pFuncWayL));
+            }
 
             int j = 0;
             for (it = V.begin(); it != V.end(); it++, j++)
@@ -651,7 +665,14 @@ types::String* gsort(types::String* pIn, types::Double* pDblInd, const std::wstr
             V.push_back(std::pair<int, std::pair<wchar_t**, wchar_t**> >(i, std::pair<wchar_t**, wchar_t**>(pwstIn + (i * iItem), pwstIn + (i + 1) * iItem)));
         }
 
-        std::sort(V.begin(), V.end(), (*pFuncWayStrL));
+        if (pDblInd)
+        {
+            std::stable_sort(V.begin(), V.end(), (*pFuncWayStrL));
+        }
+        else
+        {
+            std::sort(V.begin(), V.end(), (*pFuncWayStrL));
+        }
 
         int j = 0;
         for (it = V.begin(); it != V.end(); it++, j++)
@@ -872,7 +893,14 @@ types::Int8* gsort(types::Int8* pIn, types::Double* pDblInd, const std::wstring&
             V.push_back(std::pair<int, std::pair<char*, char*> >(i, std::pair<char*, char*>(piIn + i * iItem, piIn + (i + 1) * iItem)));
         }
 
-        std::sort(V.begin(), V.end(), (*pFuncWayL));
+        if (pDblInd)
+        {
+            std::stable_sort(V.begin(), V.end(), (*pFuncWayL));
+        }
+        else
+        {
+            std::sort(V.begin(), V.end(), (*pFuncWayL));
+        }
 
         int j = 0;
         for (it = V.begin(); it != V.end(); it++, j++)
@@ -1093,8 +1121,15 @@ types::Int16* gsort(types::Int16* pIn, types::Double* pDblInd, const std::wstrin
             V.push_back(std::pair<int, std::pair<short*, short*> >(i, std::pair<short*, short*>(piIn + i * iItem, piIn + (i + 1) * iItem)));
         }
 
-        std::sort(V.begin(), V.end(), (*pFuncWayL));
-
+        if (pDblInd)
+        {
+            std::stable_sort(V.begin(), V.end(), (*pFuncWayL));
+        }
+        else
+        {
+            std::sort(V.begin(), V.end(), (*pFuncWayL));
+        }
+        
         int j = 0;
         for (it = V.begin(); it != V.end(); it++, j++)
         {
@@ -1314,8 +1349,15 @@ types::Int32* gsort(types::Int32* pIn, types::Double* pDblInd, const std::wstrin
             V.push_back(std::pair<int, std::pair<int*, int*> >(i, std::pair<int*, int*>(piIn + i * iItem, piIn + (i + 1) * iItem)));
         }
 
-        std::sort(V.begin(), V.end(), (*pFuncWayL));
-
+        if (pDblInd)
+        {
+            std::stable_sort(V.begin(), V.end(), (*pFuncWayL));
+        }
+        else
+        {
+            std::sort(V.begin(), V.end(), (*pFuncWayL));
+        }
+        
         int j = 0;
         for (it = V.begin(); it != V.end(); it++, j++)
         {
@@ -1535,8 +1577,15 @@ types::Int64* gsort(types::Int64* pIn, types::Double* pDblInd, const std::wstrin
             V.push_back(std::pair<int, std::pair<long long*, long long*> >(i, std::pair<long long*, long long*>(piIn + i * iItem, piIn + (i + 1) * iItem)));
         }
 
-        std::sort(V.begin(), V.end(), (*pFuncWayL));
-
+        if (pDblInd)
+        {
+            std::stable_sort(V.begin(), V.end(), (*pFuncWayL));
+        }
+        else
+        {
+            std::sort(V.begin(), V.end(), (*pFuncWayL));
+        }
+        
         int j = 0;
         for (it = V.begin(); it != V.end(); it++, j++)
         {
@@ -1756,8 +1805,15 @@ types::UInt8* gsort(types::UInt8* pIn, types::Double* pDblInd, const std::wstrin
             V.push_back(std::pair<int, std::pair<unsigned char*, unsigned char*> >(i, std::pair<unsigned char*, unsigned char*>(piIn + i * iItem, piIn + (i + 1) * iItem)));
         }
 
-        std::sort(V.begin(), V.end(), (*pFuncWayL));
-
+        if (pDblInd)
+        {
+            std::stable_sort(V.begin(), V.end(), (*pFuncWayL));
+        }
+        else
+        {
+            std::sort(V.begin(), V.end(), (*pFuncWayL));
+        }
+        
         int j = 0;
         for (it = V.begin(); it != V.end(); it++, j++)
         {
@@ -1977,8 +2033,15 @@ types::UInt16* gsort(types::UInt16* pIn, types::Double* pDblInd, const std::wstr
             V.push_back(std::pair<int, std::pair<unsigned short*, unsigned short*> >(i, std::pair<unsigned short*, unsigned short*>(piIn + i * iItem, piIn + (i + 1) * iItem)));
         }
 
-        std::sort(V.begin(), V.end(), (*pFuncWayL));
-
+        if (pDblInd)
+        {
+            std::stable_sort(V.begin(), V.end(), (*pFuncWayL));
+        }
+        else
+        {
+            std::sort(V.begin(), V.end(), (*pFuncWayL));
+        }
+        
         int j = 0;
         for (it = V.begin(); it != V.end(); it++, j++)
         {
@@ -2198,8 +2261,15 @@ types::UInt32* gsort(types::UInt32* pIn, types::Double* pDblInd, const std::wstr
             V.push_back(std::pair<int, std::pair<unsigned int*, unsigned int*> >(i, std::pair<unsigned int*, unsigned int*>(piIn + i * iItem, piIn + (i + 1) * iItem)));
         }
 
-        std::sort(V.begin(), V.end(), (*pFuncWayL));
-
+        if (pDblInd)
+        {
+            std::stable_sort(V.begin(), V.end(), (*pFuncWayL));
+        }
+        else
+        {
+            std::sort(V.begin(), V.end(), (*pFuncWayL));
+        }
+        
         int j = 0;
         for (it = V.begin(); it != V.end(); it++, j++)
         {
@@ -2419,8 +2489,15 @@ types::UInt64* gsort(types::UInt64* pIn, types::Double* pDblInd, const std::wstr
             V.push_back(std::pair<int, std::pair<unsigned long long*, unsigned long long*> >(i, std::pair<unsigned long long*, unsigned long long*>(piIn + i * iItem, piIn + (i + 1) * iItem)));
         }
 
-        std::sort(V.begin(), V.end(), (*pFuncWayL));
-
+        if (pDblInd)
+        {
+            std::stable_sort(V.begin(), V.end(), (*pFuncWayL));
+        }
+        else
+        {
+            std::sort(V.begin(), V.end(), (*pFuncWayL));
+        }
+        
         int j = 0;
         for (it = V.begin(); it != V.end(); it++, j++)
         {
@@ -1,14 +1,19 @@
 // =============================================================================
 // Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
-// Copyright (C) 2008 - INRIA - Jean-Baptiste SILVY <jean-baptiste.silvy@inria.fr>
+// Copyright (C) 2018 - ESI Group - Cedric Delamarre
 //
 //  This file is distributed under the same license as the Scilab package.
 // =============================================================================
-// <-- TEST WITH GRAPHIC -->
-// non regression bug for surf
-plot3d;
-scf();
-plot3d;
-// used to lead to deadlock in OpenGL thread.
-// Scilab hanged
-xdel(winsid());
+//
+// <-- CLI SHELL MODE -->
+// <-- NO CHECK REF -->
+//
+// <-- Non-regression test for bug 12659 -->
+//
+// <-- Bugzilla URL -->
+// http://bugzilla.scilab.org/show_bug.cgi?id=12659
+//
+// Crash on big modulo
+
+tab =  1:5000000;
+tab = modulo(5000000,tab);
diff --git a/scilab/modules/elementary_functions/tests/nonreg_tests/bug_15182.tst b/scilab/modules/elementary_functions/tests/nonreg_tests/bug_15182.tst
new file mode 100644 (file)
index 0000000..9da08c1
--- /dev/null
@@ -0,0 +1,27 @@
+// =============================================================================
+// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
+// Copyright (C) 2018 - Samuel GOUGEON
+//
+//  This file is distributed under the same license as the Scilab package.
+// =============================================================================
+
+// <-- CLI SHELL MODE -->
+// <-- NO CHECK REF -->
+
+// <-- Non-regression test for bug 15182 -->
+//
+// <-- Bugzilla URL -->
+// http://bugzilla.scilab.org/15182
+//
+// <-- Short Description -->
+// a .*. b or kron(a,b) returned floats instead of encoded integers when a or b
+//  is an encoded integer and the other a decimal
+
+a = [1 2 ; 3 4];
+b = [-1 2.3];
+
+it = [1 2 4 8];
+for i = it
+    assert_checkequal(inttype(iconvert(a,i).*.b), i);
+    assert_checkequal(inttype(a.*.iconvert(b,i)), i);
+end
index 424aac0..6ff8884 100644 (file)
@@ -18,4 +18,4 @@ A = gsort(sp);
 if and(ref == A) <> %t then bugmes();quit;end
 sp = sparse([1,2;4,5;3,10]);
 ierr = execstr('A = gsort(sp);','errcatch');
-if ierr <> 999 then bugmes();quit;end
+if ierr <> 10000 then bugmes();quit;end
index 55b7450..383fb1e 100644 (file)
@@ -19,6 +19,6 @@ A = gsort(sp);
 if and(ref == A) <> %t then pause,end
 
 sp = sparse([1,2;4,5;3,10]);
-ierr = execstr('A = gsort(sp);','errcatch');
-if ierr <> 999 then pause,end
+ierr = execstr("A = gsort(sp);","errcatch");
+if ierr <> 10000 then pause,end
 
diff --git a/scilab/modules/elementary_functions/tests/nonreg_tests/bug_8779.dia.ref b/scilab/modules/elementary_functions/tests/nonreg_tests/bug_8779.dia.ref
deleted file mode 100644 (file)
index 9244f3c..0000000
+++ /dev/null
@@ -1,31 +0,0 @@
-// =============================================================================
-// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
-// Copyright (C) 2013 - Scilab Enterprises - Adeline CARNIS
-//
-//  This file is distributed under the same license as the Scilab package.
-// =============================================================================
-// <-- CLI SHELL MODE -->
-// <-- Non-regression test for bug 8779 -->
-//
-// <-- Bugzilla URL -->
-// http://bugzilla.scilab.org/show_bug.cgi?id=8779
-//
-// <-- Short Description -->
-//    gsort() did not preserve order of equal elements, in lexicographic sort.
-// =============================================================================
-[y,k] = gsort(ones(8,1), "lr");
-assert_checkequal(y, ones(8, 1));
-assert_checkequal(k, (1:8)');
-[y,k] = gsort(ones(8,1), "lr", "i");
-assert_checkequal(y, ones(8, 1));
-assert_checkequal(k, (1:8)');
-[y,k] = gsort(ones(1,8), "lc");
-assert_checkequal(y, ones(1, 8));
-assert_checkequal(k, (1:8));
-[y,k] = gsort(ones(1,8), "lc", "i");
-assert_checkequal(y, ones(1, 8));
-assert_checkequal(k, (1:8));
-A = [1 2 3;4 5 6;4 5 6;7 8 9;8 9 10;4 5 6];
-[x,k] = gsort(A, "lr", "i");
-assert_checkequal(k, [1;2;3;6;4;5]);
-assert_checkequal(x, [1 2 3;4 5 6;4 5 6; 4 5 6;7 8 9;8 9 10]);
index 5b8803f..260f54d 100644 (file)
@@ -1,35 +1,51 @@
 // =============================================================================
 // Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
-// Copyright (C) 2013 - Scilab Enterprises - Adeline CARNIS
+// Copyright (C) 2018 - Stéphane Mottelet
 //
 //  This file is distributed under the same license as the Scilab package.
 // =============================================================================
 // <-- CLI SHELL MODE -->
+// <-- NO CHECK REF -->
 // <-- Non-regression test for bug 8779 -->
 //
 // <-- Bugzilla URL -->
 // http://bugzilla.scilab.org/show_bug.cgi?id=8779
 //
 // <-- Short Description -->
-//    gsort() did not preserve order of equal elements, in lexicographic sort.
+//  gsort(x,'lr') does not preserve order of equal items in index output
 // =============================================================================
-[y,k] = gsort(ones(8,1), "lr");
-assert_checkequal(y, ones(8, 1));
-assert_checkequal(k, (1:8)');
 
-[y,k] = gsort(ones(8,1), "lr", "i");
-assert_checkequal(y, ones(8, 1));
-assert_checkequal(k, (1:8)');
+x=[ 1     0
+2     2
+0     1
+1     0
+1     2
+1     2
+2     1
+2     1
+0     1
+1     0
+2     2
+0     1];
+[y,k]=gsort(x,"lr");
+assert_checkequal(k,[2,11,7,8,5,6,1,4,10,3,9,12]');
+[y,k]=gsort(int8(x),"lr");
+assert_checkequal(k,[2,11,7,8,5,6,1,4,10,3,9,12]');
+[y,k]=gsort(int16(x),"lr");
+assert_checkequal(k,[2,11,7,8,5,6,1,4,10,3,9,12]');
+[y,k]=gsort(int32(x),"lr");
+assert_checkequal(k,[2,11,7,8,5,6,1,4,10,3,9,12]');
+[y,k]=gsort(int64(x),"lr");
+assert_checkequal(k,[2,11,7,8,5,6,1,4,10,3,9,12]');
 
-[y,k] = gsort(ones(1,8), "lc");
-assert_checkequal(y, ones(1, 8));
-assert_checkequal(k, (1:8));
+[y,k]=gsort(uint8(x),"lr");
+assert_checkequal(k,[2,11,7,8,5,6,1,4,10,3,9,12]');
+[y,k]=gsort(uint16(x),"lr");
+assert_checkequal(k,[2,11,7,8,5,6,1,4,10,3,9,12]');
+[y,k]=gsort(uint32(x),"lr");
+assert_checkequal(k,[2,11,7,8,5,6,1,4,10,3,9,12]');
+[y,k]=gsort(uint64(x),"lr");
+assert_checkequal(k,[2,11,7,8,5,6,1,4,10,3,9,12]');
 
-[y,k] = gsort(ones(1,8), "lc", "i");
-assert_checkequal(y, ones(1, 8));
-assert_checkequal(k, (1:8));
-
-A = [1 2 3;4 5 6;4 5 6;7 8 9;8 9 10;4 5 6];
-[x,k] = gsort(A, "lr", "i");
-assert_checkequal(k, [1;2;3;6;4;5]);
-assert_checkequal(x, [1 2 3;4 5 6;4 5 6; 4 5 6;7 8 9;8 9 10]);
+[y,k]=gsort(string(x),"lr");
+assert_checkequal(k,[2,11,7,8,5,6,1,4,10,3,9,12]');
diff --git a/scilab/modules/elementary_functions/tests/unit_tests/unique.tst b/scilab/modules/elementary_functions/tests/unit_tests/unique.tst
new file mode 100644 (file)
index 0000000..c0d6043
--- /dev/null
@@ -0,0 +1,112 @@
+// =============================================================================
+// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
+// Copyright (C) 2018 - Samuel Gougeon
+//
+//  This file is distributed under the same license as the Scilab package.
+// =============================================================================
+// unit test of unique()
+//
+// <-- CLI SHELL MODE -->
+// <-- NO CHECK REF -->
+
+// Checking output sizes
+// ---------------------
+// "*"
+[u,k] = unique([]);
+assert_checkequal(u,[]);
+assert_checkequal(k,[]);
+[u,k] = unique([1 4 5]);
+assert_checkequal(size(u),[1 3]);
+assert_checkequal(size(k),[1 3]);
+[u,k] = unique([1 4 5]');
+assert_checkequal(size(u),[3 1]);
+assert_checkequal(size(k),[3 1]);
+[u,k] = unique([1 4 5]');
+assert_checkequal(size(u),[3 1]);
+assert_checkequal(size(k),[3 1]);
+[u,k] = unique([1 3 4 ; 5 6 7]);
+assert_checkequal(size(u),[6 1]);
+assert_checkequal(size(k),[6 1]);
+[u,k] = unique([1 3 4 ; 5 6 7]);
+assert_checkequal(size(u),[6 1]);
+assert_checkequal(size(k),[6 1]);
+[u,k] = unique(rand(3,4,2));
+assert_checkequal(size(u),[24 1]);
+assert_checkequal(size(k),[24 1]);
+
+// "r"
+[u,k] = unique([], "r");
+assert_checkequal(u,[]);
+assert_checkequal(k,[]);
+[u,k] = unique([1 3 4 ; 5 6 7], "r");
+assert_checkequal(size(u),[2 3]);
+assert_checkequal(size(k),[2 1]);
+
+// "c"
+[u,k] = unique([], "c");
+assert_checkequal(u,[]);
+assert_checkequal(k,[]);
+[u,k] = unique([1 3 4 ; 5 6 7], "c");
+assert_checkequal(size(u),[2 3]);
+assert_checkequal(size(k),[1 3]);
+
+// With decimal numbers
+// --------------------
+x = [ 2  0  2  2  2  0  0  0  2  0  0  2  2  1  0  1
+      1  2  2  2  1  0  2  2  0  0  1  0  1  1  0  0
+    ];
+[u, k] = unique(x);
+assert_checkequal(u, [0 1 2]');
+assert_checkequal(k, [3 2 1]');
+[u, k] = unique(x, "c");
+uxc = [ 0  0  0  1  1  2  2  2
+        0  1  2  0  1  0  1  2
+      ];
+assert_checkequal(u, uxc);
+assert_checkequal(k, [6  11  2  16  14  9  1  3]);
+
+// With encoded integers
+// ---------------------
+x = int8([-3 0 2 0 -3
+          -3 0 2 0 -3
+          -3 2 0 2 -3
+         ]);
+[u,k] = unique(x);
+assert_checkequal(u, int8([-3 0 2])');
+assert_checkequal(k, [1 4 6]');
+[u,k] = unique(x, "r");
+assert_checkequal(u, int8([-3 0 2 0 -3 ; -3 2 0 2 -3]));
+assert_checkequal(k, [1;3]);
+[u,k] = unique(x, "c");
+assert_checkequal(u, int8([-3 0 2 ; -3 0 2; -3 2 0]));
+assert_checkequal(k, [1 2 3]);
+
+// With complex numbers
+// --------------------
+i = %i;
+x = [1-i, 3+2*i, 1+i, 3-2*i, 3+2*i, 3-%i, 1-i];
+assert_checkequal(unique(x), [1-i, 1+i, 3-2*i, 3-i, 3+2*i]);
+c = [x($:-1:1) ; x ; x($:-1:1) ; 1:7 ; x];
+[u, k] = unique(c, "r");
+assert_checkequal(u, c([4 2 1],:));
+[u, k] = unique(c', "c");
+assert_checkequal(u, c'(:,[4 2 1]));
+// With some text
+// --------------
+t = ["AB" "BA" "BA" "BA" "AB" "BA" "AB" "AB" "BB" "AA" "AB" "BA" "BA" "BA" "AA"
+     "AA" "AA" "AB" "AA" "BB" "BB" "BB" "BA" "AB" "AB" "BB" "BB" "AB" "AB" "AA"
+    ];
+[u, k] = unique(t);
+assert_checkequal(u, ["AA" "AB" "BA" "BB"]');
+assert_checkequal(k, [2 1 3 10]');
+
+utc = ["AA"  "AA"  "AB"  "AB"  "AB"  "BA"  "BA"  "BA"  "BB"
+       "AA"  "AB"  "AA"  "BA"  "BB"  "AA"  "AB"  "BB"  "AB"
+      ];
+[u, k] = unique(t, "c");
+assert_checkequal(u, utc);
+assert_checkequal(k, [15 10 1 8 5 2 3 6 9]);
+[u, k] = unique(t', "r");
+assert_checkequal(u, utc');
+assert_checkequal(k, [15 10 1 8 5 2 3 6 9]');
@@ -9,10 +9,10 @@
 // <-- NO CHECK REF -->
 // <-- WINDOWS ONLY -->
 //
-// <-- Non-regression test for bug 15486 -->
+// <-- Non-regression test for bug 15484 -->
 //
 // <-- Bugzilla URL -->
-// https://bugzilla.scilab.org/15486
+// https://bugzilla.scilab.org/15484
 //
 // <-- Short Description -->
 // isdir("w:"), isdir("w:\"), and  isdir("w:/") returned %T whenever the w:
index 58a5844..e031479 100644 (file)
@@ -58,6 +58,8 @@ types::Function::ReturnValue sci_whereis(types::typed_list &in, int _iRetCount,
             switch (pIT->getType())
             {
                 case types::InternalType::ScilabFunction:
+                case types::InternalType::ScilabMacro:
+                case types::InternalType::ScilabMacroFile:
                     out.push_back(new types::String(pIT->getAs<types::Callable>()->getModule().c_str()));
                     return types::Function::OK;
             }
diff --git a/scilab/modules/functions/tests/nonreg_tests/bug_15542.tst b/scilab/modules/functions/tests/nonreg_tests/bug_15542.tst
new file mode 100644 (file)
index 0000000..e1cc06e
--- /dev/null
@@ -0,0 +1,20 @@
+// =============================================================================
+// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
+// Copyright (C) 2018 - Stéphane Mottelet
+//
+//  This file is distributed under the same license as the Scilab package.
+// =============================================================================
+// <-- CLI SHELL MODE -->
+// <-- NO CHECK REF -->
+//
+// <-- Non-regression test for bug 15542 -->
+//
+// <-- Bugzilla URL -->
+// http://bugzilla.scilab.org/15542
+//
+// <-- Short Description -->
+// whereis("my_user_defined_fun") returns [] and expects a function handle, unlike for macros in libraries and primitives in gateways
+
+deff('out=test()','out=%t');
+assert_checkequal(whereis('test'),'script');
+assert_checkequal(whereis(test),'script');
\ No newline at end of file
index 19a014c..13dd4ce 100644 (file)
  * along with this program.
  *
  -->
-<refentry xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:svg="http://www.w3.org/2000/svg" xmlns:mml="http://www.w3.org/1998/Math/MathML" xmlns:db="http://docbook.org/ns/docbook" xmlns:scilab="http://www.scilab.org"  xml:lang="en" xml:id="mesh">
+<refentry xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink"
+        xmlns:svg="http://www.w3.org/2000/svg" xmlns:mml="http://www.w3.org/1998/Math/MathML"
+        xmlns:db="http://docbook.org/ns/docbook" xmlns:scilab="http://www.scilab.org"
+        xml:lang="en" xml:id="mesh">
     <refnamediv>
         <refname>mesh</refname>
         <refpurpose>3D mesh plot</refpurpose>
@@ -155,4 +158,17 @@ mesh(X,Y,Z);
             </member>
         </simplelist>
     </refsection>
+    <refsection role="history">
+        <title>History</title>
+        <revhistory>
+            <revision>
+                <revnumber>6.0.2</revnumber>
+                <revdescription>
+                    The "Foreground", "markForeground", and "markBackground" global properties
+                    colors can now be specified as named colors chosen in the full predefined colors
+                    list, or by their "#RRGGBB" hexadecimal codes, or by their colormap indices.
+                </revdescription>
+            </revision>
+        </revhistory>
+    </refsection>
 </refentry>
index 1ff5a42..6b22eb8 100644 (file)
  * along with this program.
  *
  -->
-<refentry xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:svg="http://www.w3.org/2000/svg" xmlns:mml="http://www.w3.org/1998/Math/MathML" xmlns:db="http://docbook.org/ns/docbook" xmlns:scilab="http://www.scilab.org"  xml:lang="en" xml:id="surf">
+<refentry xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink"
+        xmlns:svg="http://www.w3.org/2000/svg" xmlns:mml="http://www.w3.org/1998/Math/MathML"
+        xmlns:db="http://docbook.org/ns/docbook" xmlns:scilab="http://www.scilab.org"
+        xml:lang="en" xml:id="surf">
     <refnamediv>
         <refname>surf</refname>
         <refpurpose>3D surface plot</refpurpose>
@@ -705,4 +708,18 @@ surf(axfig10,Z,'ydat',[100:109],'marker','d','markerfac','green','markeredg','ye
             </member>
         </simplelist>
     </refsection>
+    <refsection role="history">
+        <title>History</title>
+        <revhistory>
+            <revision>
+                <revnumber>6.0.2</revnumber>
+                <revdescription>
+                    The "Foreground", "markForeground", and "markBackground" global properties
+                    colors can now be specified as named colors chosen in the full predefined
+                    colors list, or by their "#RRGGBB" hexadecimal codes, or by their colormap
+                    indices.
+                </revdescription>
+            </revision>
+        </revhistory>
+    </refsection>
 </refentry>
index ad97ce9..0537184 100644 (file)
  * along with this program.
  *
  -->
-<refentry xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:svg="http://www.w3.org/2000/svg" xmlns:mml="http://www.w3.org/1998/Math/MathML" xmlns:db="http://docbook.org/ns/docbook" xmlns:scilab="http://www.scilab.org"  xml:lang="en" xml:id="GlobalProperty">
+<refentry xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink"
+        xmlns:svg="http://www.w3.org/2000/svg" xmlns:mml="http://www.w3.org/1998/Math/MathML"
+        xmlns:db="http://docbook.org/ns/docbook" xmlns:scilab="http://www.scilab.org"
+        xml:lang="en" xml:id="GlobalProperty">
     <refnamediv>
         <refname>GlobalProperty</refname>
         <refpurpose>
-            to customize the objects appearance (curves, surfaces...) in a plot
-            or surf command
+            customizes the objects appearance (curves, surfaces...) in a plot or surf command
         </refpurpose>
     </refnamediv>
     <refsection>
         <title>Description</title>
         <para>
-            The <literal>GlobalProperty</literal> is an optional argument
-            that can be used inside a <link linkend="plot">plot</link> or
-            <link linkend="surf">surf</link> command. It allows a global
-            customization of all the new plotted lines (respectively surfaces).
-            It has to be given as a couple
-            {<literal>PropertyName</literal>,
-            <literal>PropertyValue</literal>}. Several couples can be set
-            at the same time in a <function>plot</function> or
-            <function>surf</function> call.
+            The <literal>GlobalProperty</literal> is an optional argument that can be used inside
+            a <code>plot</code> or a <code>surf()</code> command. It allows a global customization
+            of all the new plotted lines (respectively surfaces).  It has to be given as a
+            {<literal>PropertyName</literal>, <literal>PropertyValue</literal>} pair.
+            Several (Name,Value) pairs can be specified in a single call to <code>plot()</code> or
+            <code>surf()</code>.
         </para>
         <para>
-            <literal>PropertyName</literal> must be a string defining the
+            <literal>PropertyName</literal> must be a case-insensitive string defining the
             property to set. The <literal>PropertyValue</literal> can be a
             real, integer or string (scalar or matrix) depending on the type of
             property used. For example, to specify a red (color) longdash-dot
             (line style) with diamond marker (marker), the sequence should be:
-            <literal>'Colo'</literal>, <literal>'red'</literal>, <literal>'LineSt'</literal>, <literal>'-.'</literal>, <literal>'Marker'</literal>, <literal>'diam'</literal>.
+            <literal>'Color'</literal>, <literal>'red'</literal>, <literal>'LineSt'</literal>,
+            <literal>'-.'</literal>, <literal>'Marker'</literal>, <literal>'diam'</literal>.
         </para>
         <para>
             As you can see, a full complete spelling of each property name and
             value is not required but those arguments, specified in any order,
-            must remain unambiguous. Furthermore, the string specification is
-            not case sensitive. <literal>GlobalProperty</literal> is
+            must remain unambiguous. <literal>GlobalProperty</literal> is
             predominant on all <literal>LineSpec</literal> previously stated.
         </para>
 
         <para>
             Here is a complete list of the <literal>PropertyName</literal> you
-            can specify (using <link linkend="plot">plot</link> or <link linkend="surf">surf</link>) and their available
-            associated <literal>PropertyValue</literal>. If not specified,
+            can specify (using <link linkend="plot">plot</link> or <link linkend="surf">surf</link>)
+            and their available associated <literal>PropertyValue</literal>. If not specified,
             those properties are available for both <literal>Polyline</literal>
-            and <literal>Fac3d</literal> objects (created respectively by
-            <function>plot</function> or <function>surf</function>) and, as
-            previously said, they are applied to the new created objects (lines
-            or surfaces).
+            and <literal>Fac3d</literal> objects (created respectively by <function>plot</function>
+            or <function>surf</function>) and, as previously said, they are applied to the new
+            created objects (lines or surfaces).
         </para>
         <para>
             Sometimes, you may have two <literal>PropertyName</literal>
@@ -69,7 +67,7 @@
         </para>
         <variablelist>
             <varlistentry>
-                <term>CData or ColorData: </term>
+                <term>"CData" or "ColorData": </term>
                 <listitem>
                     <para>
                         a real matrix specifying the color at every points
                         <literal>data.color</literal> property (see
                         <link linkend="surface_properties">surface properties</link>).
                         <note>
-                            Note that this property is available for surfaces only.
+                            This property is available for surfaces only.
                         </note>
                     </para>
                 </listitem>
             </varlistentry>
             <varlistentry>
-                <term>CDataMapping or ColorDataMapping: </term>
+                <term>"CDataMapping" or "ColorDataMapping": </term>
                 <listitem>
                     <para>
                         a string with value <literal>'scaled'</literal> or
                         <literal>2</literal>, <literal>3</literal> or
                         <literal>4</literal>.
                         <note>
-                            Note that this property exists only with
-                            <literal>Fac3d</literal> entities. Note also that
-                            <function>plot3d</function> has
+                            This property exists only with <literal>Fac3d</literal> entities.
+                            Note also that <function>plot3d</function> has
                             <literal>'direct'</literal> mode by default and
                             <function>surf</function> has <literal>'scaled'</literal> mode by default.
                         </note>
                 </listitem>
             </varlistentry>
             <varlistentry>
-                <term>Clipping: </term>
+                <term>"Clipping": </term>
                 <listitem>
                     <para>
                         a string <literal>"on"</literal> or <literal>"off"</literal> defining the
                         property. This field contains the
                         <literal>visible</literal> property (see <link linkend="polyline_properties">polyline properties</link>).
                         <note>
-                            Note that this property is not yet available for
-                            surface entities.
+                            This property is not yet available for surface entities.
                         </note>
                     </para>
                 </listitem>
             </varlistentry>
             <varlistentry>
-                <term>Color or Foreground: </term>
+                <term>"Color" or "Foreground" (polylines only):</term>
                 <listitem>
                     <para>
-                        a string defining a known color (see <link linkend="color_list">color_list</link>) or a
-                        <literal>1</literal>x<literal>3</literal> (or <literal>3</literal>x<literal>1</literal>) RGB
-                        vector defining a color number. Color number is given as
-                        a 3-uple <literal>R</literal>, <literal>G</literal>,
-                        <literal>B</literal> corresponding respectively to red,
-                        green and blue intensity between 0 and 1. This property
-                        is linked to the object's <literal>foreground</literal> property
+                        A color specified by its name (text) among the predefined named
+                        <link linkend="color_list">colors list</link>), or by its
+                        <literal>"#RRGGBB"</literal> hexadecimal code (text), or by its index in the
+                        color map (integer), or by the vector <literal>[r,g,b]</literal> of its
+                        Red-Green-Blue intensities in the [0,1] interval.
+                    </para>
+                    <para>
+                        This property is linked to the object's <literal>foreground</literal> property
                         (see <link linkend="polyline_properties">polyline properties</link>).
-                        <warning>
-                            Color is not available for surfaces objects. The
-                            <literal>Foreground</literal> property exists for
-                            surfaces objects but is linked to the Matlab
-                            <literal>EdgeColor</literal> property (see
-                            <link linkend="surface_properties">surface properties</link>).
-                        </warning>
                     </para>
                 </listitem>
             </varlistentry>
             <varlistentry>
-                <term>EdgeColor or Foreground: </term>
+                <term>"EdgeColor" or "Foreground" (surfaces only): </term>
                 <listitem>
                     <para>
-                        a string defining a known color (see <link linkend="color_list">color_list</link>) or a
-                        <literal>1</literal>x<literal>3</literal> (or <literal>3</literal>x<literal>1</literal>) RGB
-                        vector defining a color number. Color number is given as
-                        a 3-uple <literal>R</literal>, <literal>G</literal>,
-                        <literal>B</literal> corresponding respectively to red,
-                        green and blue intensity between 0 and 1. This property
-                        is linked to the surface <literal>foreground</literal>
-                        property (see <link linkend="surface_properties">surface
-                            properties
-                        </link>
-                        ).
-                        <warning>
-                            For <literal>polyline</literal> objects, the
-                            <literal>Foreground</literal> property
-                            exists with a different meaning (see above) and
-                            <literal>EdgeColor</literal> does not exist at all.
-                        </warning>
+                        A color specified by its name (text) among the predefined named
+                        <link linkend="color_list">colors list</link>), or by its
+                        <literal>"#RRGGBB"</literal> hexadecimal code (text), or by its index in the
+                        color map (integer), or by the vector <literal>[r,g,b]</literal> of its
+                        Red-Green-Blue intensities in the [0,1] interval.
+                    </para>
+                    <para>
+                        This property is linked to the surface <literal>foreground</literal>
+                        property (see <link linkend="surface_properties">surface properties</link>).
                     </para>
                 </listitem>
             </varlistentry>
             <varlistentry>
-                <term>FaceColor: </term>
+                <term>"FaceColor": </term>
                 <listitem>
                     <para>
                         a string with value <literal>'none'</literal>,
                         <literal>'flat'</literal> or <literal>'interp'</literal>
                         specifying the way the facet's color are rendered.
-                        When <literal>'none'</literal> is selected, a mesh of
-                        the surface is drawn; if <literal>'flat'</literal>
-                        (default mode) is set, the <literal>Fac3d</literal>
-                        <literal>color.data</literal> values determine one color
-                        per facet using the color of the first vertex of the
-                        facet. If the value is <literal>'interp'</literal>, an
-                        interpolated shading is done on the surface using
-                        <literal>color.data</literal> to determine a color at each vertex of each facet.
+                        <itemizedlist>
+                            <listitem>
+                                <literal>'none'</literal>: a mesh of the surface is drawn.
+                            </listitem>
+                            <listitem>
+                                <literal>'flat'</literal> (default mode): the <literal>Fac3d</literal>
+                                <literal>color.data</literal> values determine one color
+                                per facet using the color of the first vertex of the facet.
+                            </listitem>
+                            <listitem>
+                                <literal>'interp'</literal>: an interpolated shading is done on
+                                the surface using <literal>color.data</literal> to determine a
+                                color at each vertex of each facet.
+                            </listitem>
+                        </itemizedlist>
                     </para>
                 </listitem>
             </varlistentry>
             <varlistentry>
-                <term>LineStyle: </term>
+                <term>"LineStyle": </term>
                 <listitem>
                     <para>
-                        this property value should be a string defining a line
-                        style. This property is linked to the object's
-                        <literal>line_style</literal> property
-                        (see <link linkend="polyline_properties">polyline
-                            properties
-                        </link>
-                        or
-                        <link linkend="surface_properties">surface
-                            properties
-                        </link>
-                        ).
+                        this property value should be a string defining a line style. This property
+                        is linked to the object's <literal>line_style</literal> property
+                        (see <link linkend="polyline_properties">polyline properties</link> or
+                        <link linkend="surface_properties">surface properties</link>).
                     </para>
                     <para/>
                     <informaltable border="1">
                 </listitem>
             </varlistentry>
             <varlistentry>
-                <term>Marker or MarkStyle: </term>
+                <term>"Marker" or "MarkStyle": </term>
                 <listitem>
                     <para>
                         a string defining the marker type. Note that if you
                         or <link linkend="surface_properties">surface properties</link>).
                     </para>
                     <informaltable border="1">
-                        <tr>
-                            <td>
-                                <literal>Specifier</literal>
-                            </td>
-                            <td>
-                                <literal>Marker Type</literal>
-                            </td>
-                        </tr>
-                        <tr>
-                            <td>
-                                <literal>+</literal>
-                            </td>
-                            <td>Plus sign</td>
-                        </tr>
-                        <tr>
-                            <td>
-                                <literal>o</literal>
-                            </td>
-                            <td>Circle</td>
-                        </tr>
-                        <tr>
-                            <td>
-                                <literal>*</literal>
-                            </td>
-                            <td>Asterisk</td>
-                        </tr>
-                        <tr>
-                            <td>
-                                <literal>.</literal>
-                            </td>
-                            <td>Point</td>
-                        </tr>
-                        <tr>
-                            <td>
-                                <literal>x</literal>
-                            </td>
-                            <td>Cross</td>
-                        </tr>
-                        <tr>
-                            <td>
-                                <literal>'square'</literal> or
-                                <literal>'s'</literal>
-                            </td>
-                            <td>Square</td>
-                        </tr>
-                        <tr>
-                            <td>
-                                <literal>'diamond'</literal> or
-                                <literal>'d'</literal>
-                            </td>
-                            <td>Diamond</td>
-                        </tr>
-                        <tr>
-                            <td>
-                                <literal>^</literal>
-                            </td>
-                            <td>Upward-pointing triangle</td>
-                        </tr>
-                        <tr>
-                            <td>
-                                <literal>v</literal>
-                            </td>
-                            <td>Downward-pointing triangle</td>
-                        </tr>
-                        <tr>
-                            <td>
-                                <literal>&gt;</literal>
-                            </td>
-                            <td>Right-pointing triangle</td>
-                        </tr>
-                        <tr>
-                            <td>
-                                <literal>&lt;</literal>
-                            </td>
-                            <td>Left-pointing triangle</td>
-                        </tr>
-                        <tr>
-                            <td>
-                                <literal>'pentagram'</literal> or
-                                <literal>'p'</literal>
-                            </td>
-                            <td>Five-pointed star (pentagram)</td>
-                        </tr>
-                        <tr>
-                            <td>
-                                <literal>'none'</literal>
-                            </td>
-                            <td>No marker (default)</td>
-                        </tr>
+                        <tr><td><literal>Specifier</literal></td><td><literal>Marker Type</literal></td></tr>
+                        <tr><td><literal>+</literal></td>   <td>Plus sign</td>  </tr>
+                        <tr><td><literal>o</literal></td>   <td>Circle</td>     </tr>
+                        <tr><td><literal>*</literal></td>   <td>Asterisk</td>   </tr>
+                        <tr><td><literal>.</literal></td>   <td>Point</td>      </tr>
+                        <tr><td><literal>x</literal></td>   <td>Cross</td>      </tr>
+                        <tr><td><literal>'square'</literal>
+                            or <literal>'s'</literal></td>  <td>Square</td>     </tr>
+                        <tr><td><literal>'diamond'</literal>
+                            or <literal>'d'</literal></td>  <td>Diamond</td>    </tr>
+                        <tr><td><literal>^</literal></td>   <td>Upward-pointing triangle</td>   </tr>
+                        <tr><td><literal>v</literal></td>   <td>Downward-pointing triangle</td> </tr>
+                        <tr><td><literal>&gt;</literal></td><td>Right-pointing triangle</td>    </tr>
+                        <tr><td><literal>&lt;</literal></td><td>Left-pointing triangle</td>     </tr>
+                        <tr><td><literal>'pentagram'</literal>
+                             or <literal>'p'</literal></td> <td>Five-pointed star (pentagram)</td></tr>
+                        <tr><td><literal>'none'</literal></td><td>No marker (default)</td>      </tr>
                     </informaltable>
                 </listitem>
             </varlistentry>
             <varlistentry>
-                <term>MarkerEdgeColor or MarkForeground: </term>
+                <term>"MarkerEdgeColor" or "MarkForeground": </term>
                 <listitem>
                     <para>
-                        a string defining a known color (see <link
-                        linkend="color_list">color_list</link>) or a
-                        <literal>1</literal>x<literal>3</literal> (or <literal>3</literal>x<literal>1</literal>) RGB
-                        vector defining a color number. Color number is given as a 3-uple
-                        <literal>R</literal>, <literal>G</literal>, <literal>B</literal> corresponding
-                        respectively to red, green and blue intensity between 0 and 1. This
-                        property is linked to the object's <literal>mark_foreground</literal>
+                        A color specified by its name (text) among the predefined named
+                        <link linkend="color_list">colors list</link>), or by its
+                        <literal>"#RRGGBB"</literal> hexadecimal code (text), or by its index in the
+                        color map (integer), or by the vector <literal>[r,g,b]</literal> of its
+                        Red-Green-Blue intensities in the [0,1] interval.
+                    </para>
+                    <para>
+                        This property is linked to the object's <literal>mark_foreground</literal>
                         property (see <link linkend="polyline_properties">polyline properties</link> or
                         <link linkend="surface_properties">surface properties</link>).
                     </para>
                 </listitem>
             </varlistentry>
             <varlistentry>
-                <term>MarkerFaceColor or MarkBackground: </term>
+                <term>"MarkerFaceColor" or "MarkBackground": </term>
                 <listitem>
                     <para>
-                        a string defining a known color (see <link
-                        linkend="color_list">color_list</link>) or a
-                        <literal>1</literal>x<literal>3</literal> (or
-                        <literal>3</literal>x<literal>1</literal>) RGB
-                        vector defining a color number. Color number is given as
-                        a 3-uple <literal>R</literal>, <literal>G</literal>,
-                        <literal>B</literal> corresponding respectively to red,
-                        green and blue intensity between 0 and 1. This
-                        property is linked to the object's <literal>mark_background</literal>
+                        A color specified by its name (text) among the predefined named
+                        <link linkend="color_list">colors list</link>), or by its
+                        <literal>"#RRGGBB"</literal> hexadecimal code (text), or by its index in the
+                        color map (integer), or by the vector <literal>[r,g,b]</literal> of its
+                        Red-Green-Blue intensities in the [0,1] interval.
+                    </para>
+                    <para>
+                        This property is linked to the object's <literal>mark_background</literal>
                         property (see <link linkend="polyline_properties">polyline properties</link>
                         or <link linkend="surface_properties">surface properties</link>).
                     </para>
                 </listitem>
             </varlistentry>
             <varlistentry>
-                <term>MarkerSize or MarkSize: </term>
+                <term>"MarkerSize" or "MarkSize": </term>
                 <listitem>
                     <para>
                         a scalar defining the marker size in <literal>point</literal> unit. This
                 </listitem>
             </varlistentry>
             <varlistentry>
-                <term>Visible: </term>
+                <term>"Visible": </term>
                 <listitem>
                     <para>
                         a string <literal>"on"</literal> or <literal>"off"</literal> defining the
                 </listitem>
             </varlistentry>
             <varlistentry>
-                <term>X data: </term>
+                <term>"X data": </term>
                 <listitem>
                     <para>
                         a real vector or matrix (re-)defining the given data for
                 </listitem>
             </varlistentry>
             <varlistentry>
-                <term>Y data: </term>
+                <term>"Y data": </term>
                 <listitem>
                     <para>
                         a real vector or matrix (re-)defining the given data for
                 </listitem>
             </varlistentry>
             <varlistentry>
-                <term>Z data: </term>
+                <term>"Z data": </term>
                 <listitem>
                     <para>
                         when used with <function>plot</function>, a real vector
 // With the plot command :
 // --------------------
 x=1:10; // Init.
+clf
 plot(x,sin(x),'colo','red','linest','-.','marker','>','markeredg','cyan','markerFace','yellow','markersize',5)
-clf();
 
 // combinations' order in {PropertyName,PropertyValue} does not matter
+clf
 plot(x,sin(x),'marker','p','markerfac','cyan','markersiz',10)
-clf();
 
 // combination of LineSpec and GlobalProperty shows the GlobalProperty predominance
-plot(x,x.*x,'*cya--','color','gr','linestyle','-','marker','sq','markersize',6,'markforegroun','red','markbackgro',[0.2 0.5 0.6])
-clf();
+clf
+plot(x, x.*x, '*cya--', 'color','gr', 'linestyle','-', ..
+    'marker','sq', 'markersize',6, 'markforegroun','red','markbackgro',[0.2 0.5 0.6])
 
 //multiple plots with different LineSpecs and finally some global GlobalProperty
-clf();
+clf
 t=0:%pi/20:2*%pi;
 plot(t,sin(t),'ro-.',t,cos(t),'cya+',t,abs(sin(t)),'--mo','markstyl','diam')
 
@@ -534,7 +445,6 @@ draw_marks("invisible foreground / cyan background")
 // With the surf command :
 // --------------------
 
-
 Z= [   0.0001    0.0013    0.0053   -0.0299   -0.1809   -0.2465   -0.1100   -0.0168   -0.0008   -0.0000
     0.0005    0.0089    0.0259   -0.3673   -1.8670   -2.4736   -1.0866   -0.1602   -0.0067    0.0000
     0.0004    0.0214    0.1739   -0.3147   -4.0919   -6.4101   -2.7589   -0.2779    0.0131    0.0020
@@ -578,4 +488,17 @@ surf(Z,'edgeco','b','marker','d','markersiz',9,'markerfac','k','xdata',-50:-41)
             </member>
         </simplelist>
     </refsection>
+    <refsection role="history">
+        <title>History</title>
+        <revhistory>
+            <revision>
+                <revnumber>6.0.2</revnumber>
+                <revdescription>
+                    The "Foreground", "markForeground", and "markBackground" colors can now be
+                    specified as named colors chosen in the full predefined colors list, or by
+                    their "#RRGGBB" hexadecimal codes, or by their indices in the colormap.
+                </revdescription>
+            </revision>
+        </revhistory>
+    </refsection>
 </refentry>
index a4ef921..e71eea0 100644 (file)
@@ -1,14 +1,8 @@
 <?xml version="1.0" encoding="UTF-8"?>
-
 <!--
-
  * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
-
  * Copyright (C) INRIA - Farid Belahcene
-
  *
-
-
  * Copyright (C) 2012 - 2016 - Scilab Enterprises
  *
  * This file is hereby licensed under the terms of the GNU GPL v2.0,
  * and continues to be available under such terms.
  * For more information, see the COPYING file which you should have received
  * along with this program.
-
  *
-
  -->
-
 <refentry xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:svg="http://www.w3.org/2000/svg" xmlns:mml="http://www.w3.org/1998/Math/MathML" xmlns:db="http://docbook.org/ns/docbook" xmlns:scilab="http://www.scilab.org"  xml:lang="ja" xml:id="mesh">
-
     <refnamediv>
-
         <refname>mesh</refname>
-
         <refpurpose>3次元メッシュプロット</refpurpose>
-
     </refnamediv>
-
     <refsynopsisdiv>
-
         <title>呼び出し手順</title>
-
         <synopsis>mesh(Z)
-
             mesh(X,Y,Z)
-
             mesh(...,&lt;GlobalProperty&gt;)
-
             mesh(...,&lt;color&gt;,&lt;GlobalProperty&gt;)
-
             mesh(&lt;axes_handle&gt;,...)
-
         </synopsis>
-
     </refsynopsisdiv>
-
     <refsection>
-
         <title>引数</title>
-
         <variablelist>
-
             <varlistentry>
-
                 <term>Z</term>
-
                 <listitem>
-
                     <para>曲面の高さを定義する実数行列. このパラメータは省略できません.
-
                         Z データは<literal> m</literal>x<literal>n</literal> 行列です.
-
                     </para>
-
                 </listitem>
-
             </varlistentry>
-
             <varlistentry>
-
                 <term>X,Y</term>
-
                 <listitem>
-
                     <para>実数行列 : 対で設定し,
-
                         これらのデータは新しい標準グリッドを定義します.
-
                         このグリッドの <literal>X</literal> および <literal>Y</literal>要素は
-
                         <literal>Z</literal>の次元と一致している必要があります
-
                         (以下の説明を参照).
-
                     </para>
-
                 </listitem>
-
             </varlistentry>
-
             <varlistentry>
-
                 <term>color</term>
-
                 <listitem>
-
                     <para>
-
                         オプションの実数行列でグリッドの各点<literal>(X(j),Y(i))</literal>
-
                         の色を定義します
-
                         (以下の説明を参照).
-
                     </para>
-
                 </listitem>
-
             </varlistentry>
-
             <varlistentry>
-
                 <term>&lt;GlobalProperty&gt;</term>
-
                 <listitem>
-
                     <para>このオプション引数は一連の命令
-
                         <literal>{PropertyName,PropertyValue}</literal>を表し,
-
                         このプロットで作成させる曲線のグローバルオブジェクトのプロパティを定義します.
-
                         利用可能なプロパティの一覧については,<link linkend="GlobalProperty">GlobalProperty</link>
-
                         を参照ください.
-
                     </para>
-
                 </listitem>
-
             </varlistentry>
-
             <varlistentry>
-
                 <term>&lt;axes_handle&gt;</term>
-
                 <listitem>
-
                     <para>
-
                         このオプションの引数はカレントの軸ではなく,
-
                         <literal>axes_handle</literal>で指定された軸の
-
                         内側にプロットが現れるようにします
-
                         (<link linkend="gca">gca</link>参照).
-
                     </para>
-
                 </listitem>
-
             </varlistentry>
-
         </variablelist>
-
     </refsection>
-
     <refsection>
-
         <title>説明</title>
-
         <para>
-
             <literal>mesh</literal> は
-
             <literal>X</literal> および <literal>Y</literal>座標で定義された矩形グリッド
-
             によりパラメータで定義される曲面を描画します.
-
             (<literal>{X,Y}</literal>が指令されない場合,このグリッドは
-
             <literal>Z</literal>行列の次元により定義されます);
-
             このグリッドの各点において,
-
             Z座標は<literal>Z</literal>行列により指定されます.
-
             <literal>mesh</literal> は,
-
             デフォルトのオプション <literal>color_mode</literal> =
-
             (カレントのカラーマップ内の)白のインデックスおよび
-
             <literal>color_flag</literal> = 0
-
             を指定した<literal>surf</literal>コマンドに基づいています.
-
         </para>
-
         <para>データエントリに関する規定 :</para>
-
         <para>このパラグラフでは,より明確にするために
-
             <literal>GlobalProperty</literal>オプション引数については言及しません.
-
             これは,これらが
-
             (<literal>"Xdata"</literal>, <literal>"Ydata"</literal>および
-
             <literal>"Zdata"</literal> プロパティを除く,
-
             <link linkend="GlobalProperty">GlobalProperty</link>参照)
-
             エントリデータと干渉しないためです.
-
             これらのオプションの引数は全て使用可能と仮定することができます.
-
         </para>
-
         <para>
-
             <literal>Z</literal> のみが指定された場合,
-
             (Z) は,<literal>1:size(Z,2)</literal>をX軸,<literal>1:size(Z,1)</literal>
-
             をY軸として定義されるグリッドに対して行列<literal>Z</literal>をプロットします.
-
         </para>
-
     </refsection>
-
     <refsection>
-
         <title>注意</title>
-
         <para>
-
             透過モードを有効にするには,<literal>color_mode</literal>
-
             オプションを 0に設定する必要があります.
-
         </para>
-
     </refsection>
-
     <refsection>
-
         <title>例</title>
-
         <programlisting role="example"><![CDATA[
-
 [X,Y]=meshgrid(-1:.1:1,-1:.1:1);
-
 Z=X.^2-Y.^2;
-
 xtitle('z=x2-y ^2');
-
 mesh(X,Y,Z);
-
  ]]></programlisting>
-
         <scilab:image>
-
             [X,Y]=meshgrid(-1:.1:1,-1:.1:1);
-
             Z=X.^2-Y.^2;
-
             xtitle('$\huge z=x^2-y^2$');
-
             mesh(X,Y,Z);
-
         </scilab:image>
-
     </refsection>
-
     <refsection role="see also">
-
         <title>参照</title>
-
         <simplelist type="inline">
-
             <member>
-
                 <link linkend="surf">surf</link>
-
             </member>
-
             <member>
-
                 <link linkend="meshgrid">meshgrid</link>
-
             </member>
-
             <member>
-
                 <link linkend="plot2d">plot2d</link>
-
             </member>
-
             <member>
-
                 <link linkend="LineSpec">LineSpec</link>
-
             </member>
-
             <member>
-
                 <link linkend="GlobalProperty">GlobalProperty</link>
-
             </member>
-
         </simplelist>
-
     </refsection>
-
-</refentry>
-
+    <refsection role="history">
+        <title>履歴</title>
+        <revhistory>
+            <revision>
+                <revnumber>6.0.2</revnumber>
+                <revdescription>
+                    The "Foreground", "markForeground", and "markBackground" global properties
+                    colors can now be specified as named colors chosen in the full predefined colors
+                    list, or by their "#RRGGBB" hexadecimal codes, or by their colormap indices.
+                </revdescription>
+            </revision>
+        </revhistory>
+    </refsection>
+</refentry>
\ No newline at end of file
index 00c44f9..7c78809 100644 (file)
@@ -1,14 +1,8 @@
 <?xml version="1.0" encoding="UTF-8"?>
-
 <!--
-
  * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
-
  * Copyright (C) INRIA Fabrice Leray
-
  *
-
-
  * Copyright (C) 2012 - 2016 - Scilab Enterprises
  *
  * This file is hereby licensed under the terms of the GNU GPL v2.0,
  * and continues to be available under such terms.
  * For more information, see the COPYING file which you should have received
  * along with this program.
-
  *
-
  -->
-
-<refentry xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:svg="http://www.w3.org/2000/svg" xmlns:mml="http://www.w3.org/1998/Math/MathML" xmlns:db="http://docbook.org/ns/docbook" xmlns:scilab="http://www.scilab.org"  xml:lang="ja" xml:id="surf">
-
+<refentry xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink"
+        xmlns:svg="http://www.w3.org/2000/svg" xmlns:mml="http://www.w3.org/1998/Math/MathML"
+        xmlns:db="http://docbook.org/ns/docbook" xmlns:scilab="http://www.scilab.org"
+        xml:lang="ja" xml:id="surf">
     <refnamediv>
-
         <refname>surf</refname>
-
         <refpurpose>3次元曲面プロット</refpurpose>
-
     </refnamediv>
-
     <refsynopsisdiv>
-
         <title>呼び出し手順</title>
-
         <synopsis>surf(Z,&lt;GlobalProperty&gt;)
-
             surf(Z,color,&lt;GlobalProperty&gt;)
-
             surf(X,Y,Z,&lt;color&gt;,&lt;GlobalProperty&gt;)
-
             surf(&lt;axes_handle&gt;,...)
-
         </synopsis>
-
     </refsynopsisdiv>
-
     <refsection>
-
         <title>引数</title>
-
         <variablelist>
-
             <varlistentry>
-
                 <term>Z</term>
-
                 <listitem>
-
                     <para>曲面の高さを定義する実数行列.省略することはできません.
-
                         Zデータは<literal> m</literal>x<literal>n</literal>行列です.
-
                     </para>
-
                 </listitem>
-
             </varlistentry>
-
             <varlistentry>
-
                 <term>X,Y</term>
-
                 <listitem>
-
                     <para>実数の行列とベクトル: 常にセットで設定し,これらのデータは新しい標準グリッドを
-
                         定義します.この新しいグリッドの<literal>X</literal> および
-
                         <literal>Y</literal> 要素は<literal>Z</literal>の次元に一致している必要があります
-
                         (下記説明参照).
-
                     </para>
-
                 </listitem>
-
             </varlistentry>
-
             <varlistentry>
-
                 <term>color</term>
-
                 <listitem>
-
                     <para>オプションの実数行列で,グリッドの
-
                         各点<literal>(X(j),Y(i))</literal>に関する色の値を定義します
-
                         (下記説明参照).
-
                     </para>
-
                 </listitem>
-
             </varlistentry>
-
             <varlistentry>
-
                 <term>&lt;GlobalProperty&gt;</term>
-
                 <listitem>
-
                     <para>このオプションの引数は,
-
                         グローバルオブジェクトのプロパティを定義する
-
                         一連の命令<literal>{PropertyName,PropertyValue}</literal>を表し,
-
                         このプロットで作成された全ての曲線に適用されます
-
                         (利用可能なプロパティの完全なリストについては,
-
                         <link linkend="GlobalProperty">GlobalProperty</link>を参照.)
-
                     </para>
-
                 </listitem>
-
             </varlistentry>
-
             <varlistentry>
-
                 <term>&lt;axes_handle&gt;</term>
-
                 <listitem>
-
                     <para>このオプションの引数は,
-
                         カレントの軸 (<link linkend="gca">gca</link>参照)ではなく,
-
                         <literal>axes_handle</literal>により指定された軸の内部へのプロットを
-
                         強制します.
-
                     </para>
-
                 </listitem>
-
             </varlistentry>
-
         </variablelist>
-
     </refsection>
-
     <refsection>
-
         <title>説明</title>
-
         <para>
-
             <literal>surf</literal> は,
-
             <literal>X</literal>  <literal>Y</literal>座標で定義される矩形グリッドを用いて
-
             パラメータ表現の曲面をカラーでプロットします.
-
             (if <literal>{X,Y}</literal>が指定されない場合, このグリッドは
-
             <literal>Z</literal>行列の次元により定義されます); このグリッドの各点において
-
             Z座標は<literal>Z</literal>行列により指定されます(必須のデータのみ).
-
             <literal>surf</literal>はMatlabの構文をより良く扱うために作成されました.
-
             グラフィックの互換性を改善するために, Matlabユーザは
-
             ( <link linkend="plot3d">plot3d</link>ではなく)
-
             <literal>surf</literal> を使用する必要があります.
-
         </para>
-
         <para>データエントリの仕様 :</para>
-
         <para>このパラグラフでは,より明確化するために,
-
             <literal>GlobalProperty</literal>オプション引数について言及しません.
-
             これは,それらがentry dataと干渉しないからです.
-
             (<literal>"Xdata"</literal>, <literal>"Ydata"</literal> および
-
             <literal>"Zdata"</literal> プロパティを除く, <link linkend="GlobalProperty">GlobalProperty</link>参照).
-
             これらのオプションの引数も全て使用可能と仮定されます.
-
         </para>
-
         <para>
-
             <literal>Z</literal>行列のみが指定された場合, surf(Z)は,
-
             <literal>1:size(Z,2)</literal>をx軸,<literal>1:size(Z,1)</literal>をy軸として定義した
-
             グリッドに対して行列<literal>Z</literal>をプロットします.
-
         </para>
-
         <para>
-
             組<literal>{X,Y,Z}</literal>が指定された場合,
-
             <literal>Z</literal>は,大きさ(<literal>Z</literal>)= [<literal>m</literal>x<literal>n</literal>]
-
             の行列とします.
-
             <literal>X</literal>または <literal>Y</literal> 次のようになります :
-
         </para>
-
         <itemizedlist>
-
             <listitem>
-
                 <para>
-
                     a) ベクトル : <literal>X</literal> がベクトルの場合,
-
                     length(<literal>X</literal>)=<literal>n</literal>です.
-
                     <literal>Y</literal>がベクトルの場合,
-
                     length(<literal>Y</literal>)=<literal>m</literal>です.
-
                 </para>
-
                 <para>
-
                     b) 行列 : この場合, size(<literal>X</literal>) (または
-
                     size(<literal>Y</literal>)) は size(<literal>Z</literal>)に等しい必要があります.
-
                 </para>
-
             </listitem>
-
         </itemizedlist>
-
         <para>Colorエントリの仕様  :</para>
-
         <para>前記のように, 曲面は矩形グリッドのサポートにより作成されます.
-
             以下のような2つの独立変数 <literal>i</literal> および
-
             <literal>j</literal>を考えてみましょう:
-
         </para>
-
         <para>
-
             <inlinemediaobject>
-
           &n