Bug fixes
==========
+* Bug #6693 fixed - modulo did not accept polynomial inputs. Help page was not updated.
+
* Bug #8824 fixed - taucs_chfact returned a segfault (not the case in mode nwni).
* Bug #10862 fixed - Add a without internet connection installation
<varlistentry>
<term>m</term>
<listitem>
- <para>real vector or matrix </para>
+ <para>real or polynomial vector or matrix </para>
</listitem>
</varlistentry>
</variablelist>
m)
</code>
i.e. remainder of <varname>n</varname> divided by
- <varname>m</varname> (<varname>n</varname> and <varname>m</varname>
- are integers).
+ <varname>m</varname>.
</para>
<para>
<code>i = n - m .* int (n ./ m)</code>. Here the answer may be negative
</para>
</refsection>
<refsection>
+ <title>Remark</title>
+ <para><note>
+ If m and n are vector or matrix type, m and n must have the same dimensions.
+ </note>
+ </para>
+ </refsection>
+ <refsection>
<title>Examples</title>
<programlisting role="example"><![CDATA[
n = [1,2,10,15];
<varlistentry>
<term>m</term>
<listitem>
- <para>entier</para>
+ <para>vecteur ou matrice de rééls ou de polynômes</para>
</listitem>
</varlistentry>
</variablelist>
<para>
<literal>modulo</literal> calcule <literal>i= n (modulo m)</literal>
c'est à dire le reste de <literal>n</literal> divisé par
- <literal>m</literal> (<literal>n</literal> et <literal>m</literal> sont
- entiers).
+ <literal>m</literal>.
</para>
<para>i = n - m .* int (n ./ m). Ici la réponse peut être négative si
<literal>n</literal> et/ou <literal>m</literal> sont négatifs.
</para>
</refsection>
<refsection>
+ <title>Remarque</title>
+ <para>
+ <note>
+ Si m et n sont des vecteurs ou des matrices, ils doivent être de même taille.
+ </note>
+ </para>
+ </refsection>
+ <refsection>
<title>Exemples</title>
<programlisting role="example"><![CDATA[
n = [1,2,10,15];
-// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab\r
-// Copyright (C) INRIA\r
-// Copyright (C) DIGITEO - 2011 - Allan CORNET\r
-// Copyright (C) 2012 - Scilab Enterprises - Adeline CARNIS\r
-// \r
-// This file must be used under the terms of the CeCILL.\r
-// This source file is licensed as described in the file COPYING, which\r
-// you should have received as part of this distribution. The terms\r
-// are also available at\r
-// http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt\r
-\r
-function i = modulo(n, m)\r
- //i=modulo(n,m) returns n modulo m.\r
-\r
- [lhs, rhs] = argn(0);\r
- if rhs <> 2 then\r
- error(msprintf(gettext("%s: Wrong number of input argument(s): %d expected.\n"),"modulo", 2));\r
- end\r
-\r
- if and(typeof(n) <> ["constant", "polynomial"]) | ~isreal(n) then\r
- error(msprintf(gettext("%s: Wrong type for input argument #%d: A real expected.\n"), "modulo", 1));\r
- end\r
-\r
- if typeof(m) <> "constant" | ~isreal(m) then\r
- error(msprintf(gettext("%s: Wrong type for input argument #%d: A real expected.\n"), "modulo", 2));\r
- end\r
-\r
- if size(n,'*')==1 then\r
- i = zeros(m);\r
- k = find(m==0);\r
- i(k) = n - int(n ./ m(k)) .* m(k);\r
- k = find(m~=0);\r
- i(k) = n-int(n./m(k)).*m(k);\r
- elseif size(m,'*')==1 then\r
- i = zeros(n);\r
- if m == 0 then\r
- i = n - int(n ./ m) .* m;\r
- else\r
- i = n-int(n./m).*m;\r
- end\r
- else\r
- if or(size(n) <> size(m)) then \r
- error(msprintf(gettext("%s: Wrong size for input arguments: Same size expected.\n"),"modulo"));\r
- end\r
- i = zeros(n);\r
- k = find(m==0);\r
- i(k) = n(k) - int(n(k) ./ m(k)) .* m(k);\r
- k = find(m~=0);\r
- i(k) = n(k) - int(n(k)./m(k)).*m(k);\r
- end\r
-endfunction\r
-\r
-\r
-\r
-\r
-\r
-\r
+// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
+// Copyright (C) INRIA
+// Copyright (C) DIGITEO - 2011 - Allan CORNET
+// Copyright (C) 2012 - Scilab Enterprises - Adeline CARNIS
+//
+// This file must be used under the terms of the CeCILL.
+// This source file is licensed as described in the file COPYING, which
+// you should have received as part of this distribution. The terms
+// are also available at
+// http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt
+
+function i = modulo(n, m)
+ //i=modulo(n,m) returns n modulo m.
+
+ [lhs, rhs] = argn(0);
+ if rhs <> 2 then
+ error(msprintf(gettext("%s: Wrong number of input argument(s): %d expected.\n"),"modulo", 2));
+ end
+
+ if and(typeof(n) <> ["constant", "polynomial"]) | ~isreal(n) then
+ error(msprintf(gettext("%s: Wrong type for input argument #%d: A real expected.\n"), "modulo", 1));
+ end
+
+ if typeof(m) <> "constant" & typeof(m) <> "polynomial" | ~isreal(m) then
+ error(msprintf(gettext("%s: Wrong type for input argument #%d: A real expected.\n"), "modulo", 2));
+ end
+
+ if typeof(m) =="constant" & typeof(n) =="constant" then
+ if size(n,'*')==1 then
+ i = zeros(m);
+ k = find(m==0);
+ i(k) = n - int(n ./ m(k)) .* m(k);
+ k = find(m~=0);
+ i(k) = n-int(n./m(k)).*m(k);
+ elseif size(m,'*')==1 then
+ i = zeros(n);
+ if m == 0 then
+ i = n - int(n ./ m) .* m;
+ else
+ i = n-int(n./m).*m;
+ end
+ else
+ if or(size(n) <> size(m)) then
+ error(msprintf(gettext("%s: Wrong size for input arguments: Same size expected.\n"),"modulo"));
+ end
+ i = zeros(n);
+ k = find(m==0);
+ i(k) = n(k) - int(n(k) ./ m(k)) .* m(k);
+ k = find(m~=0);
+ i(k) = n(k) - int(n(k)./m(k)).*m(k);
+ end
+ else
+ [i,q]=pdiv(n,m);
+ end
+endfunction
+
+
+
+
+
+
--- /dev/null
+// =============================================================================
+// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
+// Copyright (C) 2013 - Scilab Enterprises - Charlotte HECQUET
+//
+// This file is distributed under the same license as the Scilab package.
+// =============================================================================
+//
+// <-- CLI SHELL MODE -->
+//
+// <-- Non-regression test for bug 6693 -->
+//
+// <-- Bugzilla URL -->
+// http://bugzilla.scilab.org/show_bug.cgi?id=6693
+//
+// <-- Short Description -->
+// modulo does not accept polynomial inputs.
+assert_checkequal(modulo(%z^2,%z),0);
--- /dev/null
+// =============================================================================
+// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
+// Copyright (C) 2013 - Scilab Enterprises - Charlotte HECQUET
+//
+// This file is distributed under the same license as the Scilab package.
+// =============================================================================
+//
+// <-- CLI SHELL MODE -->
+//
+// <-- Non-regression test for bug 6693 -->
+//
+// <-- Bugzilla URL -->
+// http://bugzilla.scilab.org/show_bug.cgi?id=6693
+//
+// <-- Short Description -->
+// modulo does not accept polynomial inputs.
+
+assert_checkequal(modulo(%z^2,%z),0);
assert_checkerror("modulo()", msprintf(_("%s: Wrong number of input argument(s): %d expected.\n"),"modulo", 2));
assert_checkerror("modulo(''a'',1)", msprintf(_("%s: Wrong type for input argument #%d: A real expected.\n"), "modulo", 1));
assert_checkerror("modulo(1,''a'')", msprintf(_("%s: Wrong type for input argument #%d: A real expected.\n"), "modulo", 2));
+assert_checkerror("modulo(%pi+%i,1)", msprintf(_("%s: Wrong type for input argument #%d: A real expected.\n"), "modulo", 1));
+assert_checkerror("modulo(1,1+%i)", msprintf(_("%s: Wrong type for input argument #%d: A real expected.\n"), "modulo", 2));
n=[1,2,10,15];
m=[2,2,3,5];
r = modulo(n,m);
r = modulo(n,m);
computed_r = n - m .* int (n ./ m);
assert_checkequal(r, computed_r);
+assert_checkequal(modulo(%z^2,%z),0);
assert_checkerror("modulo()", msprintf(_("%s: Wrong number of input argument(s): %d expected.\n"),"modulo", 2));
assert_checkerror("modulo(''a'',1)", msprintf(_("%s: Wrong type for input argument #%d: A real expected.\n"), "modulo", 1));
assert_checkerror("modulo(1,''a'')", msprintf(_("%s: Wrong type for input argument #%d: A real expected.\n"), "modulo", 2));
+assert_checkerror("modulo(%pi+%i,1)", msprintf(_("%s: Wrong type for input argument #%d: A real expected.\n"), "modulo", 1));
+assert_checkerror("modulo(1,1+%i)", msprintf(_("%s: Wrong type for input argument #%d: A real expected.\n"), "modulo", 2));
n=[1,2,10,15];
m=[2,2,3,5];
r = modulo(n,m);
computed_r = n - m .* int (n ./ m);
assert_checkequal(r, computed_r);
+
+assert_checkequal(modulo(%z^2,%z),0);