- Improved layout: detailled indices for 2D arrays, simplified symbols, etc.
- The content of implicitlist objects, and information for Scilab functions and libraries of functions are now displayed.
* `nchoosek` is introduced, to compute the binomial coefficients.
+* The left .\. and right ./. Kronecker divisions are now implemented, for arrays of decimal or complex numbers.
Help pages:
-----------
* [#9529](https://bugzilla.scilab.org/9529): `assert_checkequal(list(1,,3), list(1,,3))` yielded an error.
* [#9673](https://bugzilla.scilab.org/9673): Priority of colon `:` operator was too low
* [#10078](https://bugzilla.scilab.org/10078): `isinf` was not reliable for polynomials.
+* [#10092](https://bugzilla.scilab.org/10092): The left and right Kronecker divisions were not actually implemented nor documented.
* [#10353](https://bugzilla.scilab.org/10353): Documentation: The referential for the uicontrol.position property was not provided. Moreover, `gca().axes_bounds` refered to `fig.figure_size` instead of `fig.axes_size`.
* [#10553](https://bugzilla.scilab.org/10553): After calling `colorbar`, retrieving the handle of the new color bar was not trivial.
* [#10723](https://bugzilla.scilab.org/10723): `subplot`'s action was unclearly described in its help page. Page improved.
// DOUBLE ./. DOUBLE
types::InternalType *GenericKronrdivide(types::InternalType *_pLeftOperand, types::InternalType *_pRightOperand)
{
- types::Double *pResult = NULL;
- types::GenericType::ScilabType TypeL = _pLeftOperand->getType();
- types::GenericType::ScilabType TypeR = _pRightOperand->getType();
-
- if (TypeL == types::GenericType::ScilabDouble && TypeR == types::GenericType::ScilabDouble)
- {
- types::Double *pL = _pLeftOperand->getAs<types::Double>();
- types::Double *pR = _pRightOperand->getAs<types::Double>();
-
- int iErr = KroneckerRDivideDoubleByDouble(pL, pR, &pResult);
- if (iErr == 1)
- {
- throw ast::InternalError(_W("Division by zero...\n"));
- }
- else if (iErr == 2)
- {
- throw ast::InternalError(_W("Bad value in the left or right operand.\n"));
- }
- else if (iErr == 3)
- {
- throw ast::InternalError(_W("Bad size for left or right operand.\n"));
- }
-
- return pResult;
- }
-
// Default case : Return NULL will Call Overloading.
return NULL;
}
-int KroneckerRDivideDoubleByDouble(types::Double* _pDouble1, types::Double* _pDouble2, types::Double** _pDoubleOut)
-{
- int iErr = 0;
- types::Double* clone = _pDouble2->clone()->getAs<types::Double>();
-
- if (_pDouble2->isComplex())
- {
- iErr = conv_img_input(clone->getReal(), clone->getImg(), clone->getSize());
- }
- else
- {
- iErr = conv_real_input(clone->get(), clone->getSize());
- }
-
- if (iErr)
- {
- delete clone;
- return iErr;
- }
-
- iErr = KroneckerMultiplyDoubleByDouble(_pDouble1, clone, _pDoubleOut);
- delete clone;
-
- return iErr;
-}
// DOUBLE .\. DOUBLE
types::InternalType *GenericKronldivide(types::InternalType *_pLeftOperand, types::InternalType *_pRightOperand)
{
- types::Double *pResult = NULL;
- types::GenericType::ScilabType TypeL = _pLeftOperand->getType();
- types::GenericType::ScilabType TypeR = _pRightOperand->getType();
-
- if (TypeL == types::GenericType::ScilabDouble && TypeR == types::GenericType::ScilabDouble)
- {
- types::Double *pL = _pLeftOperand->getAs<types::Double>();
- types::Double *pR = _pRightOperand->getAs<types::Double>();
-
- int iErr = KroneckerLDivideDoubleByDouble(pL, pR, &pResult);
- if (iErr == 1)
- {
- throw ast::InternalError(_W("Division by zero...\n"));
- }
- else if (iErr == 2)
- {
- throw ast::InternalError(_W("Bad value in the left operand.\n"));
- }
-
- return pResult;
- }
-
// Default case : Return NULL will Call Overloading.
return NULL;
}
-
-int KroneckerLDivideDoubleByDouble(types::Double* _pDouble1, types::Double* _pDouble2, types::Double** _pDoubleOut)
-{
- int iErr = 0;
- types::Double* clone = _pDouble1->clone()->getAs<types::Double>();
- if (_pDouble1->isComplex())
- {
- iErr = conv_img_input(clone->getReal(), clone->getImg(), clone->getSize());
- }
- else
- {
- iErr = conv_real_input(clone->get(), clone->getSize());
- }
-
- if (iErr)
- {
- delete clone;
- return iErr;
- }
-
- iErr = KroneckerMultiplyDoubleByDouble(clone, _pDouble2, _pDoubleOut);
- delete clone;
-
- return iErr;
-}
-
--- /dev/null
+// ============================================================================
+// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
+//
+// Copyright (C) 2019 - Samuel GOUGEON
+//
+// This file is distributed under the same license as the Scilab package.
+// ============================================================================
+
+// <-- CLI SHELL MODE -->
+// <-- NO CHECK REF -->
+//
+// ---------------------------------------------
+// <-- Unit test for ./. and .\. operators -->
+// ---------------------------------------------
+
+rtol = 10*%eps;
+objects = list(rand(1,1), rand(1,3), rand(4,1), rand(1,1,5), rand(2,3), rand(3,4,2));
+n = length(objects);
+
+// With arrays without zeros
+// =========================
+for i = 1:n
+ o = objects(i);
+ for j = 1:n
+ o2 = objects(j);
+ b = o .*. o2;
+ assert_checkalmostequal(b ./. o2, o, rtol)
+ assert_checkalmostequal(o .\. b, o2, rtol)
+ end
+end
+
+// With a null array
+// =================
+z = list(zeros(1,1), zeros(1,3), zeros(4,1), zeros(1,1,5), zeros(2,3), zeros(3,4,2));
+for i = 1:n
+ o = objects(i);
+ for j = 1:n
+ o2 = z(j);
+ b = o .*. o2;
+ //assert_checkalmostequal(b ./. o2, o, rtol) // => Nan | not managed
+ assert_checkalmostequal(o .\. b, o2, rtol)
+
+ b = o2 .*. o;
+ assert_checkalmostequal(b ./. o, o2, rtol)
+ //assert_checkalmostequal(o2 .\. b, o, rtol) // => Nan | not managed
+ end
+end
+
+// With arrays with zeros
+// ======================
+withZeros = list(1, 0:3, [2 0 1]', cat(3,3,0,2,0), [2 3 0 ; 1 0 2], ..
+ matrix([0,3,1,2,0,2,3,0,3,3,3,2,3,1,0,0,3,3,1,0,3,3,0,0], [3,4,2]));
+for i = 1:n
+ o = objects(i);
+ for j = 1:n
+ // Without zeros .*. with zeros
+ // ............................
+ o2 = withZeros(j);
+ b = o .*. o2;
+ assert_checkalmostequal(b ./. o2, o, rtol)
+ assert_checkalmostequal(o .\. b, o2, rtol)
+
+ b = o2 .*. o;
+ assert_checkalmostequal(b ./. o, o2, rtol)
+ assert_checkalmostequal(o2 .\. b, o, rtol)
+
+ // With zeros .*. with zeros
+ // .........................
+ o = withZeros(i);
+ b = o .*. o2;
+ assert_checkalmostequal(b ./. o2, o, rtol)
+ assert_checkalmostequal(o .\. b, o2, rtol)
+
+ b = o2 .*. o;
+ assert_checkalmostequal(b ./. o, o2, rtol)
+ assert_checkalmostequal(o2 .\. b, o, rtol)
+ end
+end
</refnamediv>
<refsynopsisdiv>
<title>Syntax</title>
- <synopsis>X=A\B</synopsis>
+ <synopsis>X = A \ B</synopsis>
</refsynopsisdiv>
<refsection>
<title>Description</title>
<link linkend="pinv">pinv</link>
</member>
<member>
- <link linkend="percent">percent</link>
+ <link linkend="linsolve">linsolve</link>
</member>
<member>
- <link linkend="ieee">ieee</link>
+ <link linkend="umfpack">umfpack</link>
</member>
<member>
- <link linkend="linsolve">linsolve</link>
+ <link linkend="krondivide">kron .\.</link>
</member>
<member>
- <link linkend="umfpack">umfpack</link>
+ <link linkend="overloading">overloading</link>
</member>
</simplelist>
</refsection>
<?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
+ * Copyright (C) 2019 - Samuel GOUGEON
+ *
+ * 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="slash">
<refnamediv>
<refname>slash</refname>
- <refpurpose>(/) right division and feed back</refpurpose>
+ <refpurpose>(/) right divisions. System's feed back. Comments</refpurpose>
</refnamediv>
+ <refsynopsisdiv>
+ <title>Syntax</title>
+ <synopsis><![CDATA[
+ X = A / B // while A = X * B
+ X = A ./ B // while A = X .* B
+ X = A ./. B // while A = X .*. B
+ S = G /. K
+ // on-row comment
+ /* block of multilines comments */
+ ]]></synopsis>
+ </refsynopsisdiv>
<refsection>
<title>Description</title>
<para>
x = a / B
x*B-a // close to zero
-a = 4 / 2; // Should be 2
-a = 2 ./ [2,4]; // 1. 0.5
+a = 4 / 2; // Should be 2
+a = 2 ./ [2,4]; // [1. 0.5]
+ ]]></programlisting>
+ <para>
+ Kronecker right division :
+ </para>
+ <programlisting role="example"><![CDATA[
+A = [1 100 ; 10 1000], B = [1 2 4],
+P = A .*. B
+P ./. B
+ ]]></programlisting>
+ <screen><![CDATA[
+--> A = [1 100 ; 10 1000], B = [1 2 4],
+ A =
+ 1. 100.
+ 10. 1000.
+
+ B =
+ 1. 2. 4.
+
+--> P = A .*. B
+ P =
+ 1. 2. 4. 100. 200. 400.
+ 10. 20. 40. 1000. 2000. 4000.
+--> P ./. B
+ ans =
+ 1. 100.
+ 10. 1000.
+]]></screen>
+ <para/>
+ <programlisting role="example"><![CDATA[
// Comments are good. They help to understand code
+a = 1; // Comment after some heading instructions
/* Even long, that is to say on many lines,
comments are useful */
]]></programlisting>
<link linkend="backslash">backslash</link>
</member>
<member>
+ <link linkend="krondivide">kron ./.</link>
+ </member>
+ <member>
<link linkend="comments">comments</link>
</member>
+ <member>
+ <link linkend="overloading">overloading</link>
+ </member>
</simplelist>
</refsection>
<refsection>
<?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" scilab:needs-examples="no" xml:id="symbols">
+<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" scilab:needs-examples="no" xml:id="symbols">
<refnamediv>
<refname>symbols</refname>
<refpurpose>scilab operator names </refpurpose>
</tr>
<tr>
<td>
- <literal>/, ./, /., ./.</literal>
+ <literal>.\., ./.</literal>
+ </td>
+ <td>
+ <link linkend="krondivide">krondivide</link>
+ </td>
+ </tr>
+ <tr>
+ <td>
+ <literal>/, ./, /.</literal>
</td>
<td>
<link linkend="slash">slash</link>
</tr>
<tr>
<td>
- <literal>\,.\ ,\., .\.</literal>
+ <literal>\, .\ ,\.</literal>
</td>
<td>
<link linkend="backslash">backslash</link>
<member>
<link linkend="overloading">overloading</link>
</member>
+ <member>
+ <link linkend="names">names</link>
+ </member>
+ <member>
+ <link linkend="getscilabkeywords">getscilabkeywords</link>
+ </member>
</simplelist>
</refsection>
</refentry>
</refnamediv>
<refsynopsisdiv>
<title>Séquence d'appel</title>
- <synopsis>x=A\b</synopsis>
+ <synopsis>X = A \ B</synopsis>
</refsynopsisdiv>
<refsection>
<title>Description</title>
<link linkend="pinv">pinv</link>
</member>
<member>
- <link linkend="percent">percent</link>
+ <link linkend="linsolve">linsolve</link>
</member>
<member>
- <link linkend="ieee">ieee</link>
+ <link linkend="umfpack">umfpack</link>
</member>
<member>
- <link linkend="linsolve">linsolve</link>
+ <link linkend="krondivide">kron .\.</link>
</member>
<member>
- <link linkend="umfpack">umfpack</link>
+ <link linkend="overloading">overloading</link>
</member>
</simplelist>
</refsection>
<?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
+ * Copyright (C) 2019 - Samuel GOUGEON
+ *
+ * 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"
<refname>slash (/)</refname>
<refpurpose>division à droite et feedback </refpurpose>
</refnamediv>
+ <refsynopsisdiv>
+ <title>Syntax</title>
+ <synopsis>
+ X = A / B // while A = X * B
+ X = A ./ B // while A = X .* B
+ X = A ./. B // while A = X .*. B
+ S = G /. K
+ // on-row comment
+ /* block of multilines comments */
+ </synopsis>
+ </refsynopsisdiv>
<refsection>
<title>Description</title>
<para>
</para>
</refsection>
<refsection>
- <title>Examples</title>
+ <title>Exemples</title>
<programlisting role="example"><![CDATA[
-a = [3., -24., 30.];
+a = [3.,-24.,30.];
B = [
9. -36. 30.
-36. 192. -180.
30. -180. 180.
];
x = a / B
-x*B - a // proche de zéro
+x*B-a // proche de zéro
-a = 4 / 2; // Doit renvoyer 2
-a = 2 ./ [2,4]; // 1. 0.5
+a = 4 / 2; // valeur 2 attendue
+a = 2 ./ [2,4]; // [1. 0.5]
+ ]]></programlisting>
+ <para>
+ Division tensorielle de Kronecker à droite :
+ </para>
+ <programlisting role="example"><![CDATA[
+A = [1 100 ; 10 1000], B = [1 2 4],
+P = A .*. B
+P ./. B
+ ]]></programlisting>
+ <screen><![CDATA[
+--> A = [1 100 ; 10 1000], B = [1 2 4],
+ A =
+ 1. 100.
+ 10. 1000.
+
+ B =
+ 1. 2. 4.
+--> P = A .*. B
+ P =
+ 1. 2. 4. 100. 200. 400.
+ 10. 20. 40. 1000. 2000. 4000.
+
+--> P ./. B
+ ans =
+ 1. 100.
+ 10. 1000.
+]]></screen>
+ <para/>
+ <programlisting role="example"><![CDATA[
// Un commentaire aide à comprendre le code.
-/* Même longs, c'est à die sur plusieurs lignes,
+a = 1; // Commentaire en queue de ligne
+/* Même longs, sur plusieurs lignes,
les commentaires sont utiles. */
]]></programlisting>
</refsection>
<link linkend="backslash">backslash</link>
</member>
<member>
+ <link linkend="krondivide">kron ./.</link>
+ </member>
+ <member>
<link linkend="comments">comments</link>
</member>
<member>
- <link linkend="ieee">ieee</link>
+ <link linkend="overloading">overloading</link>
</member>
</simplelist>
</refsection>
<?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="symbols">
+<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="symbols">
<refnamediv>
<refname>symbols</refname>
<refpurpose>opérateurs de Scilab </refpurpose>
</td>
</tr>
<tr>
- <td>/, ./, /., ./.</td>
+ <td>
+ <literal>.\., ./.</literal>
+ </td>
+ <td>
+ <link linkend="krondivide">krondivide</link>
+ </td>
+ </tr>
+ <tr>
+ <td>/, ./, /.</td>
<td>
<link linkend="slash">slash</link>
</td>
</td>
</tr>
<tr>
- <td>\, .\, \., .\.</td>
+ <td>\, .\, \.</td>
<td>
<link linkend="backslash">backslash</link>
</td>
<member>
<link linkend="overloading">overloading</link>
</member>
+ <member>
+ <link linkend="names">names</link>
+ </member>
+ <member>
+ <link linkend="getscilabkeywords">getscilabkeywords</link>
+ </member>
</simplelist>
</refsection>
</refentry>
<?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="backslash">
-
<refnamediv>
-
<refname>backslash</refname>
-
<refpurpose>(\) 左行列除算.</refpurpose>
-
</refnamediv>
-
<refsynopsisdiv>
-
<title>呼び出し手順</title>
-
- <synopsis>X=A\B</synopsis>
-
+ <synopsis>X = A \ B</synopsis>
</refsynopsisdiv>
-
<refsection>
-
<title>説明</title>
-
<para>
-
バックスラッシュは左行列除算を定義します.
-
<literal>X=A\B</literal> は <literal>A*X=B</literal>の解です.
-
</para>
-
<para>
-
<literal>A</literal> が正方で非特異の場合,
-
<literal>X=A\B</literal> は <literal>X=inv(A)*B</literal>
-
と等価です.しかし,計算はより正確で浮動小数点演算の負荷は小さくなります.
-
すなわち,線形システムの方程式<code>A*X=B</code>の解を計算する際には,
-
バックスラッシュ演算子を使用するべきであり,<function>inv</function>関数の
-
使用は避けるべきです.
-
</para>
-
<para>
-
<literal>A</literal>が正方の場合, 解<literal>X</literal>は
-
LU分解または線形最小二乗ソルバのどちらかにより計算できます.
-
<literal>A</literal>の条件数が<code>1/(10*%eps)</code>よりも小さい場合
-
(つまり,<literal>A</literal>の条件が良い場合),ピボット選択付きLU分解が使用されます.
-
そうでない場合(<literal>A</literal>の条件が悪い場合),
-
<literal>X</literal> は<literal>A</literal>の完全直交分解を用いて
-
<literal>||A*X-B||</literal>を最小化する最小ノルム解となります
-
(すなわち,<literal>X</literal>は線形最小二乗問題の解です).
-
</para>
-
<para>
-
<literal>A</literal> が正方でない場合, <literal>X</literal> は最小二乗解となります.
-
すなわち, <code>norm(A*X-B)</code> は,最小値 (ユークリッドノルム)となります.
-
<literal>A</literal> が列フルランクの場合,最小二乗解, <literal>X=A\B</literal>, は
-
唯一の解 (<literal>norm(A*X-B)</literal>を最小化する唯一の
-
<literal>X</literal>が存在)となります.
-
<literal>A</literal> が列フルランクでない場合, 最小二乗解は唯一ではなくなり,
-
<literal>X=A\B</literal>は一般に最小ノルム解ではなくなります
-
(最小ノルム解は <literal>X=pinv(A)*B</literal>です).
-
</para>
-
<para>
-
<literal>A.\B</literal> は<literal>(i,j)</literal> エントリが
-
<literal>A(i,j)\B(i,j)</literal>となる行列となります.
-
<literal>A.\B</literal> は
-
<literal>A*ones(B).\B</literal> (または <literal>A.\(B*ones(A))</literal>
-
と等価になります.
-
</para>
-
<para>
-
<literal>A\.B</literal> は定義されていない演算子です.
-
この演算子は, <literal>*</literal> または <literal>/</literal> のように
-
新しい演算子を定義する際に使用できます
-
(<link linkend="overloading">オーバーロード</link>参照).
-
</para>
-
</refsection>
-
<refsection>
-
<title>例</title>
-
<programlisting role="example"><![CDATA[
A=[
9. -36. 30.
// 複数の線形ソルバのベンチマーク
-[A,descr,ref,mtype] = ReadHBSparse(SCI+..
- "/modules/umfpack/demos/bcsstk24.rsa");
-
+[A,descr,ref,mtype] = ReadHBSparse(SCI+"/modules/umfpack/demos/bcsstk24.rsa");
b = zeros(size(A,1),1);
tic();
res = A\b;
mprintf('\ntime with backslash: %.3f\n',toc());
]]></programlisting>
-
</refsection>
-
<refsection role="see also">
-
<title>参照</title>
-
<simplelist type="inline">
-
<member>
-
<link linkend="slash">slash</link>
-
</member>
-
<member>
-
<link linkend="inv">inv</link>
-
</member>
-
<member>
-
<link linkend="pinv">pinv</link>
-
</member>
-
<member>
-
- <link linkend="percent">percent</link>
-
+ <link linkend="linsolve">linsolve</link>
</member>
-
<member>
-
- <link linkend="ieee">ieee</link>
-
+ <link linkend="umfpack">umfpack</link>
</member>
-
<member>
-
- <link linkend="linsolve">linsolve</link>
-
+ <link linkend="krondivide">kron .\.</link>
</member>
-
<member>
-
- <link linkend="umfpack">umfpack</link>
-
+ <link linkend="overloading">overloading</link>
</member>
-
</simplelist>
-
</refsection>
-
<refsection>
-
<title>履歴</title>
-
<revhistory>
-
<revision>
-
<revnumber>5.5.0</revnumber>
-
<revremark>バックスラッシュの条件数の閾値が増加しました.</revremark>
-
</revision>
-
</revhistory>
-
</refsection>
-
-</refentry>
-
-
-
+</refentry>
\ No newline at end of file
<?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
+ * Copyright (C) 2019 - Samuel GOUGEON
+ *
+ * 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"
<refname>slash</refname>
<refpurpose>(/) 右除算およびフィードバック</refpurpose>
</refnamediv>
+ <refsynopsisdiv>
+ <title>Syntax</title>
+ <synopsis>
+ X = A / B // while A = X * B
+ X = A ./ B // while A = X .* B
+ X = A ./. B // while A = X .*. B
+ S = G /. K
+ // on-row comment
+ /* block of multilines comments */
+ </synopsis>
+ </refsynopsisdiv>
<refsection>
<title>説明</title>
<para>
<refsection>
<title>例</title>
<programlisting role="example"><![CDATA[
-a=[3.,-24.,30.];
-B=[
+a = [3.,-24.,30.];
+B = [
9. -36. 30.
-36. 192. -180.
30. -180. 180.
];
-x=a/B
-x*B-a // ゼロに近い
+x = a / B
+x*B-a // ゼロに近い
-a=4 / 2; // 2となります
-a=2 ./ [2,4]; // 1. 0.5
+a = 4 / 2; // 2となります
+a = 2 ./ [2,4]; // [1. 0.5]
+ ]]></programlisting>
+ <para>
+ Kronecker right division :
+ </para>
+ <programlisting role="example"><![CDATA[
+A = [1 100 ; 10 1000], B = [1 2 4],
+P = A .*. B
+P ./. B
+ ]]></programlisting>
+ <screen><![CDATA[
+--> A = [1 100 ; 10 1000], B = [1 2 4],
+ A =
+ 1. 100.
+ 10. 1000.
+
+ B =
+ 1. 2. 4.
+
+--> P = A .*. B
+ P =
+ 1. 2. 4. 100. 200. 400.
+ 10. 20. 40. 1000. 2000. 4000.
+
+--> P ./. B
+ ans =
+ 1. 100.
+ 10. 1000.
+]]></screen>
+ <para/>
+ <programlisting role="example"><![CDATA[
// コメントは有用です. コードを理解しやすくします.
+a = 1; // Comment after some heading instructions
/* Even long, that is to say on many lines,
comments are useful */
]]></programlisting>
<link linkend="backslash">backslash</link>
</member>
<member>
+ <link linkend="krondivide">kron ./.</link>
+ </member>
+ <member>
<link linkend="comments">comments</link>
</member>
+ <member>
+ <link linkend="overloading">overloading</link>
+ </member>
</simplelist>
</refsection>
<refsection>
<?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="symbols">
+<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="symbols">
<refnamediv>
<refname>symbols</refname>
<refpurpose>scilab 演算子の名前 </refpurpose>
</td>
</tr>
<tr>
- <td>/, ./, /., ./.</td>
+ <td>
+ <literal>.\., ./.</literal>
+ </td>
+ <td>
+ <link linkend="krondivide">krondivide</link>
+ </td>
+ </tr>
+ <tr>
+ <td>/, ./, /.</td>
<td>
<link linkend="slash">slash</link>
</td>
</td>
</tr>
<tr>
- <td>\, .\, \., .\.</td>
+ <td>\, .\, \.</td>
<td>
<link linkend="backslash">backslash</link>
</td>
<member>
<link linkend="overloading">overloading</link>
</member>
+ <member>
+ <link linkend="names">names</link>
+ </member>
+ <member>
+ <link linkend="getscilabkeywords">getscilabkeywords</link>
+ </member>
</simplelist>
</refsection>
</refentry>
</refnamediv>
<refsynopsisdiv>
<title>Seqüência de Chamamento</title>
- <synopsis>x=A\b</synopsis>
+ <synopsis>X = A \ B</synopsis>
</refsynopsisdiv>
<refsection>
<title>Descrição</title>
<link linkend="pinv">pinv</link>
</member>
<member>
- <link linkend="percent">percent</link>
+ <link linkend="linsolve">linsolve</link>
</member>
<member>
- <link linkend="ieee">ieee</link>
+ <link linkend="umfpack">umfpack</link>
</member>
<member>
- <link linkend="linsolve">linsolve</link>
+ <link linkend="krondivide">kron .\.</link>
</member>
<member>
- <link linkend="umfpack">umfpack</link>
+ <link linkend="overloading">overloading</link>
</member>
</simplelist>
</refsection>
<?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
+ * Copyright (C) 2019 - Samuel GOUGEON
+ *
+ * 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"
("resposta")
</refpurpose>
</refnamediv>
+ <refsynopsisdiv>
+ <title>Syntax</title>
+ <synopsis>
+ X = A / B // while A = X * B
+ X = A ./ B // while A = X .* B
+ X = A ./. B // while A = X .*. B
+ S = G /. K
+ // on-row comment
+ /* block of multilines comments */
+ </synopsis>
+ </refsynopsisdiv>
<refsection>
<title>Descrição</title>
<para>
-36. 192. -180.
30. -180. 180.
];
-x = a/B
-x*B-a // proche de zéro
+x = a / B
+x*B-a // close to zero
-a = 4 / 2; // Doit renvoyer 2
-a = 2 ./ [2,4]; // 1. 0.5
+a = 4 / 2; // Should be 2
+a = 2 ./ [2,4]; // [1. 0.5]
+ ]]></programlisting>
+ <para>
+ Kronecker right division :
+ </para>
+ <programlisting role="example"><![CDATA[
+A = [1 100 ; 10 1000], B = [1 2 4],
+P = A .*. B
+P ./. B
+ ]]></programlisting>
+ <screen><![CDATA[
+--> A = [1 100 ; 10 1000], B = [1 2 4],
+ A =
+ 1. 100.
+ 10. 1000.
+
+ B =
+ 1. 2. 4.
+
+--> P = A .*. B
+ P =
+ 1. 2. 4. 100. 200. 400.
+ 10. 20. 40. 1000. 2000. 4000.
-// Un commentaire aide à comprendre le code.
+--> P ./. B
+ ans =
+ 1. 100.
+ 10. 1000.
+]]></screen>
+ <para/>
+ <programlisting role="example"><![CDATA[
+// Comments are good. They help to understand code
+a = 1; // Comment after some heading instructions
/* Even long, that is to say on many lines,
comments are useful */
]]></programlisting>
<link linkend="inv">inv</link>
</member>
<member>
- <link linkend="percent">percent</link>
+ <link linkend="backslash">backslash</link>
</member>
<member>
- <link linkend="backslash">backslash</link>
+ <link linkend="krondivide">kron ./.</link>
+ </member>
+ <member>
+ <link linkend="comments">comments</link>
</member>
<member>
- <link linkend="ieee">ieee</link>
+ <link linkend="overloading">overloading</link>
</member>
</simplelist>
</refsection>
<?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="symbols" 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="symbols" xml:lang="pt">
<refnamediv>
<refname>symbols</refname>
<refpurpose>nomes dos operadores Scilab</refpurpose>
</td>
</tr>
<tr>
- <td> /, ./, /., ./.</td>
+ <td>
+ <literal>.\., ./.</literal>
+ </td>
+ <td>
+ <link linkend="krondivide">krondivide</link>
+ </td>
+ </tr>
+ <tr>
+ <td> /, ./, /.</td>
<td>
<link linkend="slash">slash</link> (barra)
</td>
</td>
</tr>
<tr>
- <td> \, .\, \., .\. </td>
+ <td> \, .\, \.</td>
<td>
<link linkend="backslash">backslash</link> (barra invertida)
</td>
<member>
<link linkend="overloading">overloading</link>
</member>
+ <member>
+ <link linkend="names">names</link>
+ </member>
+ <member>
+ <link linkend="getscilabkeywords">getscilabkeywords</link>
+ </member>
</simplelist>
</refsection>
</refentry>
</refnamediv>
<refsynopsisdiv>
<title>Синтаксис</title>
- <synopsis>X=A\B</synopsis>
+ <synopsis>X = A \ B</synopsis>
</refsynopsisdiv>
<refsection>
<title>Описание</title>
<title>Смотрите также</title>
<simplelist type="inline">
<member>
- <link linkend="slash">слэш</link>
+ <link linkend="slash">slash</link>
</member>
<member>
<link linkend="inv">inv</link>
<link linkend="pinv">pinv</link>
</member>
<member>
- <link linkend="percent">процент</link>
+ <link linkend="linsolve">linsolve</link>
</member>
<member>
- <link linkend="ieee">ieee</link>
+ <link linkend="umfpack">umfpack</link>
</member>
<member>
- <link linkend="linsolve">linsolve</link>
+ <link linkend="krondivide">kron .\.</link>
</member>
<member>
- <link linkend="umfpack">umfpack</link>
+ <link linkend="overloading">overloading</link>
</member>
</simplelist>
</refsection>
<?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
+ * Copyright (C) 2019 - Samuel GOUGEON
+ *
+ * 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"
<refname>слэш (косая черта)</refname>
<refpurpose>(/) правое деление и обратная связь</refpurpose>
</refnamediv>
+ <refsynopsisdiv>
+ <title>Syntax</title>
+ <synopsis>
+ X = A / B // при этом A = X * B
+ X = A ./ B // при этом A = X .* B
+ X = A ./. B // при этом A = X .*. B
+ S = G /. K
+ // комментарий в строке
+ /* блок многострочных комментариев */
+ </synopsis>
+ </refsynopsisdiv>
<refsection>
<title>Описание</title>
<para>
<literal>//</literal>, игнорируются интерпретатором.
</para>
<para>
- It is the same with <literal>/*</literal> which start to comment a block of code and with
- <literal>*/</literal> which end to comment this block.
- </para>
+ Это то же самое, что <literal>/*</literal>, с которого начинается комментирование блока кода, и
+ <literal>*/</literal>, которым заканчивается комментирование этого блока.
+ </para>
</refsection>
<refsection>
<title>Примеры</title>
-36. 192. -180.
30. -180. 180.
];
-x = a/B
+x = a / B
x*B-a // близко к нулю
-a = 4 / 2; // Должно быть 2
-a = 2 ./ [2,4]; // 1. 0.5
+a = 4 / 2; // Должно быть 2
+a = 2 ./ [2,4]; // [1. 0.5]
+ ]]></programlisting>
+ <para>
+ Kronecker right division :
+ </para>
+ <programlisting role="example"><![CDATA[
+A = [1 100 ; 10 1000], B = [1 2 4],
+P = A .*. B
+P ./. B
+ ]]></programlisting>
+ <screen><![CDATA[
+--> A = [1 100 ; 10 1000], B = [1 2 4],
+ A =
+ 1. 100.
+ 10. 1000.
+
+ B =
+ 1. 2. 4.
+--> P = A .*. B
+ P =
+ 1. 2. 4. 100. 200. 400.
+ 10. 20. 40. 1000. 2000. 4000.
+
+--> P ./. B
+ ans =
+ 1. 100.
+ 10. 1000.
+]]></screen>
+ <para/>
+ <programlisting role="example"><![CDATA[
// Комментарии - это хорошо. Они помогают понять код
-/* Even long, that is to say on many lines,
-comments are useful */
+a = 1; // Комментарий после некоторых инструкций в начале строки
+/* Даже длинные, то есть на множестве строк,
+комментарии полезны */
]]></programlisting>
</refsection>
<refsection role="see also">
<link linkend="inv">inv</link>
</member>
<member>
- <link linkend="backslash">обратный слэш</link>
+ <link linkend="backslash">backslash</link>
+ </member>
+ <member>
+ <link linkend="krondivide">kron ./.</link>
</member>
<member>
<link linkend="comments">комментарии</link>
</member>
+ <member>
+ <link linkend="overloading">перегрузка</link>
+ </member>
</simplelist>
</refsection>
<refsection>
<revision>
<revnumber>6.0.0</revnumber>
<revremark>
- 1./B means now 1 ./ B, no longer 1. / B
+ 1./B теперь означает 1 ./ B, больше не интерпретируется как 1. / B
</revremark>
</revision>
</revhistory>
<?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="symbols">
+<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="symbols">
<refnamediv>
<refname>символы</refname>
<refpurpose>названия операторов Scilab'a</refpurpose>
</td>
</tr>
<tr>
- <td> /, ./, /., ./.</td>
+ <td>
+ <literal>.\., ./.</literal>
+ </td>
+ <td>
+ <link linkend="krondivide">krondivide</link>
+ </td>
+ </tr>
+ <tr>
+ <td> /, ./, /.</td>
<td>
<link linkend="slash">slash</link>
</td>
</td>
</tr>
<tr>
- <td> \, .\, \., .\. </td>
+ <td> \, .\, \.</td>
<td>
<link linkend="backslash">backslash</link>
</td>
<member>
<link linkend="overloading">overloading</link>
</member>
+ <member>
+ <link linkend="names">names</link>
+ </member>
+ <member>
+ <link linkend="getscilabkeywords">getscilabkeywords</link>
+ </member>
</simplelist>
</refsection>
</refentry>
<!--
* Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
* Copyright (C) 2008 - INRIA
- * Copyright (C) 2014 - Samuel Gougeon : extension to hypermatrices
- *
* Copyright (C) 2012 - 2016 - Scilab Enterprises
+ * Copyright (C) 2014, 2019 - Samuel GOUGEON
*
* 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.
* 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="kron" 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="kron" xml:lang="en">
<refnamediv>
- <refname>kron</refname>
- <refpurpose>Kronecker product (.*.)</refpurpose>
+ <refname>kron .*.</refname>
+ <refpurpose>Kronecker tensorial product. Weighted array replication</refpurpose>
</refnamediv>
<refsynopsisdiv>
<title>Syntax</title>
- <synopsis>kron(A,B)
- A.*.B
+ <synopsis>
+ P = kron(A, B)
+ P = A .*. B
</synopsis>
</refsynopsisdiv>
<refsection>
<title>Arguments</title>
<variablelist>
<varlistentry>
- <term>A</term>
+ <term>A, B</term>
<listitem>
- <para>a matrix or hypermatrix.</para>
+ <para>
+ Arrays of size (a1, a2, ..) and (b1, b2, ..), with any number of dimensions.
+ If <varname>A</varname> or <varname>B</varname> is sparse, the other one
+ can't be an hypermatrix.
+ </para>
+ <para>
+ Supported encodings and types: integer, real, complex, polynomial, rational,
+ sparse.
+ </para>
</listitem>
</varlistentry>
<varlistentry>
- <term>B</term>
+ <term>P</term>
<listitem>
- <para>a matrix or hypermatrix.</para>
+ <para>
+ Array of <varname>A</varname> and <varname>B</varname> data type,
+ and of size (a1*b1, a2*b2, ..).
+ If <varname>A</varname> or <varname>B</varname> is sparse,
+ <varname>P</varname> is sparse.
+ </para>
</listitem>
</varlistentry>
</variablelist>
<refsection>
<title>Description</title>
<para>
- <literal>kron(A,B)</literal> or <literal>A.*.B</literal> returns the
+ <literal>kron(A,B)</literal> or <literal>A .*. B</literal> returns the
Kronecker tensor product of two matrices or hypermatrices<literal>A</literal> and
<literal>B</literal>. The resulting matrix has the following block
form:
+ <latex style="display" alt="
+ [ A(1,1).B .. A(1,n).B ] \n
+A .✶. B = | ⋮ ⋮ ⋮ | \n
+ [ A(m,1).B .. A(m,n).B ]">
+ A \; .*.\; B = \begin{pmatrix}
+ A_{1,1}\cdot B & \cdots & A_{1,n}\cdot B \\
+ \vdots & & \vdots \\
+ A_{m,1}\cdot B & \cdots & A_{m,n}\cdot B
+ \end{pmatrix}
+ </latex>
</para>
- <informalequation>
- <mediaobject>
- <imageobject>
- <imagedata fileref="../../mml/kron_equation_1.mml"/>
- </imageobject>
- </mediaobject>
- </informalequation>
<para>
If <literal>A</literal> is a <literal>m x n</literal> matrix and
<literal>B</literal> a <literal>p x q x r</literal> hypermatrix then
<literal>A.*.B</literal> is a <literal>(m*p) x (n*q) x (1*r)</literal>
hypermatrix.
</para>
- <para>
- <literal>A</literal> and <literal>B</literal> can be sparse
- matrices, although the Kronecker product is not defined between a sparse matrix and
- a hypermatrix.
- </para>
</refsection>
<refsection>
<title>Examples</title>
<programlisting role="example"><![CDATA[
-A = [1,2;3,4];
-kron(A,A)
-A.*.A
-sparse(A).*.sparse(A)
-A(1,1) = %i;
-kron(A,A)
+A = [1 3 ; 2 4]
+B = [1 10 100]
+kron(A, B)
+A .*. B
+B .*. A
+ ]]></programlisting>
+ <screen><![CDATA[
+--> A = [1 3 ; 2 4]
+ A =
+ 1. 3.
+ 2. 4.
+
+--> B = [1 10 100]
+ B =
+ 1. 10. 100.
+
+--> kron(A, B)
+ ans =
+ 1. 10. 100. 3. 30. 300.
+ 2. 20. 200. 4. 40. 400.
+
+--> A .*. B
+ ans =
+ 1. 10. 100. 3. 30. 300.
+ 2. 20. 200. 4. 40. 400.
+
+--> B .*. A
+ ans =
+ 1. 3. 10. 30. 100. 300.
+ 2. 4. 20. 40. 200. 400.
+]]></screen>
+ <para>With sparse matrices:</para>
+ <programlisting role="example"><![CDATA[
+P = [-1 0 1 10] .*. sparse([0 1 2])
+full(P)
+ ]]></programlisting>
+ <screen><![CDATA[
+--> P = [-1 0 1 10] .*. sparse([0 1 2])
+ P =
+( 1, 12) sparse matrix
+( 1, 2) -1.
+( 1, 3) -2.
+( 1, 8) 1.
+( 1, 9) 2.
+( 1, 11) 10.
+( 1, 12) 20.
-// With hypermatrices
-// ------------------
+--> full(P)
+ ans =
+ 0. -1. -2. 0. 0. 0. 0. 1. 2. 0. 10. 20.
+]]></screen>
+ <para>With complex numbers:</para>
+ <programlisting role="example"><![CDATA[
+A = [-1 1 ; -%i %i]
+A .*. A
+ ]]></programlisting>
+ <screen><![CDATA[
+--> A = [-1 1 ; -%i %i]
+ A =
+ -1. 1.
+ -i i
+
+--> A .*. A
+ ans =
+ 1. -1. -1. 1.
+ i -i -i i
+ i -i -i i
+ -1. 1. 1. -1.
+]]></screen>
+ <para>
+ With hypermatrices:
+ </para>
+ <programlisting role="example"><![CDATA[
b = matrix(1:24, [4 3 2]);
// row .*. hypermat
a.*.b
]]></programlisting>
</refsection>
+ <refsection role="see also">
+ <title>See Also</title>
+ <simplelist type="inline">
+ <member>
+ <link linkend="krondivide">kron .\. ./.</link>
+ </member>
+ <member>
+ <link linkend="star">star</link>
+ </member>
+ <member>
+ <link linkend="prod">prod</link>
+ </member>
+ <member>
+ <link linkend="cumprod">cumprod</link>
+ </member>
+ <member>
+ <link linkend="repmat">repmat</link>
+ </member>
+ </simplelist>
+ </refsection>
<refsection>
<title>History</title>
<revhistory>
</revision>
</revhistory>
</refsection>
-
</refentry>
--- /dev/null
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
+ *
+ * Copyright (C) 2019 - Samuel Gougeon
+ *
+ * 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="krondivide" xml:lang="en">
+ <refnamediv>
+ <refname>kron .\. ./.</refname>
+ <refpurpose>Kronecker left and right divisions</refpurpose>
+ </refnamediv>
+ <refsynopsisdiv>
+ <title>Syntax</title>
+ <synopsis>
+ X = A .\. B // while B = A .*. X
+ X = B ./. A // while B = X .*. A
+ </synopsis>
+ </refsynopsisdiv>
+ <refsection>
+ <title>Arguments</title>
+ <variablelist>
+ <varlistentry>
+ <term>X</term>
+ <listitem>
+ Array of decimal or complex numbers, of size (x1,x2,..).
+ </listitem>
+ </varlistentry>
+ <varlistentry>
+ <term>A</term>
+ <listitem>
+ Array of decimal or complex numbers, of size (a1,a2,..), with any number
+ of dimensions.
+ </listitem>
+ </varlistentry>
+ <varlistentry>
+ <term>B</term>
+ <listitem>
+ Array of decimal or complex numbers, of size (a1*x1, a2*x2,..), with any number
+ of dimensions.
+ </listitem>
+ </varlistentry>
+ </variablelist>
+ </refsection>
+ <refsection>
+ <title>Description</title>
+ <para>
+ <emphasis role="bold">B ./. A</emphasis> computes and provides the array
+ <varname>X</varname> such that <literal>B = X .*. A</literal>.
+ </para>
+ <para>
+ <emphasis role="bold">A .\. B</emphasis> computes and provides the array
+ <varname>X</varname> such that <literal>B = A .*. X</literal>.
+ </para>
+ <para>
+ In both cases, each <varname>X</varname> coefficient is constrained by length(A)
+ proportional equations. The divisions are so performed in a least-square way
+ minimizing <literal>norm(A.*.X - B, 2)</literal> or <literal>norm(X.*.A - B, 2)</literal>.
+ </para>
+ </refsection>
+ <refsection>
+ <title>Examples</title>
+ <para>
+ Simple example with low and crossed dimensions:
+ </para>
+ <programlisting role="example"><![CDATA[
+A = 0:3
+B = [1 10 100]'
+P = A .*. B
+ ]]></programlisting>
+ <screen><![CDATA[
+--> A = 0:3
+ A =
+ 0. 1. 2. 3.
+
+--> B = [1 10 100]'
+ B =
+ 1.
+ 10.
+ 100.
+
+--> P = A .*. B
+ P =
+ 0. 1. 2. 3.
+ 0. 10. 20. 30.
+ 0. 100. 200. 300.
+
+--> P ./. B
+ ans =
+ 0. 1. 2. 3.
+
+--> A .\. P
+ ans =
+ 1.
+ 10.
+ 100.
+]]></screen>
+ <para>
+ Still with some low dimensions, and with noisy data:
+ </para>
+ <programlisting role="example"><![CDATA[
+A = 1:3
+B = 0:4
+P = A .*. B
+P ./. B
+A .\. P
+
+// Let's add some additive noise, and process noisy data:
+P = P + grand(P, "unf", -0.3, 0.3)
+P ./. B
+A .\. P
+ ]]></programlisting>
+ <screen><![CDATA[
+--> A = 1:3
+ A =
+ 1. 2. 3.
+
+--> B = 0:4
+ B =
+ 0. 1. 2. 3. 4.
+
+--> P = A .*. B
+ P =
+ 0. 1. 2. 3. 4. 0. 2. 4. 6. 8. 0. 3. 6. 9. 12.
+
+--> P ./. B
+ ans =
+ 1. 2. 3.
+
+--> A .\. P
+ ans =
+ 0. 1. 2. 3. 4.
+
+
+--> // Let's add some additive noise, and process noisy data:
+--> P = P + grand(P, "unf", -0.3, 0.3)
+ P =
+ column 1 to 8
+ -0.2793324 1.0981633 1.9632466 2.775538 3.9289351 -0.1738746 2.1593101 3.7307299
+
+ column 9 to 15
+ 6.1771199 7.7218648 -0.1878764 2.9452387 5.9938586 8.9747935 11.967352
+
+--> P ./. B
+ ans =
+ 0.9689004 1.9679863 2.9908914
+
+--> A .\. P
+ ans =
+ -0.0850508 1.0180357 1.9575916 3.0038685 3.9481943
+]]></screen>
+ <para>
+ With hypermatrices:
+ </para>
+ <programlisting role="example"><![CDATA[
+M = [-9.4 -7. 8.6 -2.3
+ 0.1 -3. -0.4 -0.7
+ -6.9 -5.3 3.6 -6.6 ];
+H = cat(3,-2,3)
+P = M .*. H
+P ./. H
+M .\. P
+ ]]></programlisting>
+ <screen><![CDATA[
+ M =
+ -9.4 -7. 8.6 -2.3
+ 0.1 -3. -0.4 -0.7
+ -6.9 -5.3 3.6 -6.6
+
+--> H = cat(3,-2,3)
+ H =
+(:,:,1)
+ -2.
+(:,:,2)
+ 3.
+
+--> P = M .*. H
+ P =
+(:,:,1)
+ 18.8 14. -17.2 4.6
+ -0.2 6. 0.8 1.4
+ 13.8 10.6 -7.2 13.2
+
+(:,:,2)
+ -28.2 -21. 25.8 -6.9
+ 0.3 -9. -1.2 -2.1
+ -20.7 -15.9 10.8 -19.8
+
+--> P ./. H
+ ans =
+ -9.4 -7. 8.6 -2.3
+ 0.1 -3. -0.4 -0.7
+ -6.9 -5.3 3.6 -6.6
+
+--> M .\. P
+ ans =
+(:,:,1)
+ -2.
+
+(:,:,2)
+ 3.
+]]></screen>
+ </refsection>
+ <refsection role="see also">
+ <title>See Also</title>
+ <simplelist type="inline">
+ <member>
+ <link linkend="kron">kron</link>
+ </member>
+ <member>
+ <link linkend="slash">slash</link>
+ </member>
+ <member>
+ <link linkend="backslash">backslash</link>
+ </member>
+ <member>
+ <link linkend="star">star</link>
+ </member>
+ </simplelist>
+ </refsection>
+ <refsection>
+ <title>History</title>
+ <revhistory>
+ <revision>
+ <revnumber>6.1.0</revnumber>
+ <revdescription>
+ <para>.\. and ./. actually implemented, for decimal and complex numbers.</para>
+ </revdescription>
+ </revision>
+ </revhistory>
+ </refsection>
+
+</refentry>
<?xml version="1.0" encoding="UTF-8"?>
<!--
* Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
- * Copyright (C)
- * Copyright (C) 2014 - Samuel Gougeon : extension to hypermatrices
- *
+ * Copyright (C) 2008 - INRIA
* Copyright (C) 2012 - 2016 - Scilab Enterprises
+ * Copyright (C) 2014, 2019 - Samuel GOUGEON
*
* 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.
* 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="kron" xml:lang="fr">
+<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="kron" xml:lang="fr">
<refnamediv>
- <refname>kron</refname>
- <refpurpose>produit de kronecker (.*.)</refpurpose>
+ <refname>kron .*.</refname>
+ <refpurpose>produit tensoriel de Kronecker. Réplication pondérée d'un tableau</refpurpose>
</refnamediv>
<refsynopsisdiv>
<title>Séquence d'appel</title>
- <synopsis>kron(A, B)
- A.*.B
+ <synopsis>
+ P = kron(A, B)
+ P = A .*. B
</synopsis>
</refsynopsisdiv>
<refsection>
- <title>Paramètres</title>
+ <title>Arguments</title>
<variablelist>
<varlistentry>
- <term>A</term>
+ <term>A, B</term>
<listitem>
- <para>matrice ou hypermatrice.</para>
+ <para>
+ Tableaux de tailles respectives (a1, a2, ..) et (b1, b2, ..), de
+ dimensionnalités quelconques.
+ Si <varname>A</varname> ou <varname>B</varname> est creuse, l'autre
+ ne peut pas être une hypermatrice.
+ </para>
+ <para>
+ Encodages et types admis : nombres entiers, nombres ou polynômes ou
+ fractions rationnelles réels ou complexes, matrices creuses.
+ </para>
</listitem>
</varlistentry>
<varlistentry>
- <term>B</term>
+ <term>P</term>
<listitem>
- <para>matrice ou hypermatrice</para>
+ <para>
+ Tableau de nombres du type de <varname>A</varname> et <varname>B</varname>,
+ et de taille (a1*b1, a2*b2, ..).
+ Si <varname>A</varname> ou <varname>B</varname> est creuse,
+ <varname>P</varname> est également creuse.
+ </para>
</listitem>
</varlistentry>
</variablelist>
<literal>kron(A,B)</literal> ou <literal>A.*.B</literal> calcule et fournit le produit
tensoriel de Kronecker de deux matrices ou hypermatrices <literal>A</literal>
et <literal>B</literal>. La matrice résultante a la forme suivante :
+ <latex style="display" alt="
+ [ A(1,1).B .. A(1,n).B ] \n
+A .✶. B = | ⋮ ⋮ ⋮ | \n
+ [ A(m,1).B .. A(m,n).B ]">
+ A \; .*.\; B = \begin{pmatrix}
+ A_{1,1}\cdot B & \cdots & A_{1,n}\cdot B \\
+ \vdots & & \vdots \\
+ A_{m,1}\cdot B & \cdots & A_{m,n}\cdot B
+ \end{pmatrix}
+ </latex>
</para>
- <informalequation>
- <mediaobject>
- <imageobject>
- <imagedata fileref="../../mml/kron_equation_1.mml"/>
- </imageobject>
- </mediaobject>
- </informalequation>
<para>
Si <literal>A</literal> est une matrice <literal>m x n</literal> et
<literal>B</literal> une hypermatrice <literal>p x q x r</literal>, alors
<literal>A.*.B</literal> est une hypermatrice <literal>(m*p) x (n*q) x (1*r)</literal>.
</para>
- <para>
- <literal>A</literal> et <literal>B</literal> peuvent être des matrices creuses. Cependant le produit de Kronecker n'est pas défini entre une matrice creuse et une hypermatrice.
- </para>
</refsection>
<refsection>
<title>Exemples</title>
<programlisting role="example"><![CDATA[
-A = [1,2;3,4];
-kron(A,A)
-A.*.A
-sparse(A).*.sparse(A)
-A(1,1) = %i;
-kron(A,A)
+A = [1 3 ; 2 4]
+B = [1 10 100]
+kron(A, B)
+A .*. B
+B .*. A
+ ]]></programlisting>
+ <screen><![CDATA[
+--> A = [1 3 ; 2 4]
+ A =
+ 1. 3.
+ 2. 4.
+
+--> B = [1 10 100]
+ B =
+ 1. 10. 100.
+
+--> kron(A, B)
+ ans =
+ 1. 10. 100. 3. 30. 300.
+ 2. 20. 200. 4. 40. 400.
+
+--> A .*. B
+ ans =
+ 1. 10. 100. 3. 30. 300.
+ 2. 20. 200. 4. 40. 400.
+
+--> B .*. A
+ ans =
+ 1. 3. 10. 30. 100. 300.
+ 2. 4. 20. 40. 200. 400.
+]]></screen>
+ <para>Avec des matrices creuses :</para>
+ <programlisting role="example"><![CDATA[
+P = [-1 0 1 10] .*. sparse([0 1 2])
+full(P)
+ ]]></programlisting>
+ <screen><![CDATA[
+--> P = [-1 0 1 10] .*. sparse([0 1 2])
+ P =
+( 1, 12) sparse matrix
+( 1, 2) -1.
+( 1, 3) -2.
+( 1, 8) 1.
+( 1, 9) 2.
+( 1, 11) 10.
+( 1, 12) 20.
+
+--> full(P)
+ ans =
+ 0. -1. -2. 0. 0. 0. 0. 1. 2. 0. 10. 20.
+]]></screen>
+ <para>Avec des nombres complexes :</para>
+ <programlisting role="example"><![CDATA[
+A = [-1 1 ; -%i %i]
+A .*. A
+ ]]></programlisting>
+ <screen><![CDATA[
+--> A = [-1 1 ; -%i %i]
+ A =
+ -1. 1.
+ -i i
-// avec des hypermatrices
-// ----------------------
+--> A .*. A
+ ans =
+ 1. -1. -1. 1.
+ i -i -i i
+ i -i -i i
+ -1. 1. 1. -1.
+]]></screen>
+ <para>
+ Avec des hypermatrices :
+ </para>
+ <programlisting role="example"><![CDATA[
b = matrix(1:24, [4 3 2]);
// row .*. hypermat
-clc
a = 1:2, b
a.*.b
// hypermat .*. row
-clc
b,a
b .*. a
// column .*. hypermat
-clc
a = [1;2], b
a.*.b
// matrix .*. hypermat
-clc
a = [-1 -2; 2 1], b
a.*.b
// hypermat .*. hypermat
-clc
a = matrix([-1,-2, 1 2], [1 2 2]), b
a.*.b
]]></programlisting>
</refsection>
+ <refsection role="see also">
+ <title>Voir aussi</title>
+ <simplelist type="inline">
+ <member>
+ <link linkend="krondivide">kron .\. ./.</link>
+ </member>
+ <member>
+ <link linkend="star">star</link>
+ </member>
+ <member>
+ <link linkend="prod">prod</link>
+ </member>
+ <member>
+ <link linkend="cumprod">cumprod</link>
+ </member>
+ <member>
+ <link linkend="repmat">repmat</link>
+ </member>
+ </simplelist>
+ </refsection>
<refsection>
<title>Historique</title>
<revhistory>
<!--
* Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
* Copyright (C) 2008 - INRIA
- * Copyright (C) 2014 - Samuel Gougeon : extension to hypermatrices
- *
* Copyright (C) 2012 - 2016 - Scilab Enterprises
+ * Copyright (C) 2014, 2019 - Samuel GOUGEON
*
* 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.
* 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="kron" 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="kron" xml:lang="ja">
<refnamediv>
- <refname>kron</refname>
- <refpurpose>クロネッカー積 (.*.)</refpurpose>
+ <refname>kron .*.</refname>
+ <refpurpose>クロネッカー積. Weighted array replication</refpurpose>
</refnamediv>
<refsynopsisdiv>
<title>呼び出し手順</title>
- <synopsis>kron(A,B)
- A.*.B
+ <synopsis>
+ P = kron(A, B)
+ P = A .*. B
</synopsis>
</refsynopsisdiv>
<refsection>
+ <title>Arguments</title>
+ <variablelist>
+ <varlistentry>
+ <term>A, B</term>
+ <listitem>
+ <para>
+ Arrays of size (a1, a2, ..) and (b1, b2, ..), with any number of dimensions.
+ If <varname>A</varname> or <varname>B</varname> is sparse, the other one
+ can't be an hypermatrix.
+ </para>
+ <para>
+ Supported encodings and types: integer, real, complex, polynomial, rational,
+ sparse.
+ </para>
+ </listitem>
+ </varlistentry>
+ <varlistentry>
+ <term>P</term>
+ <listitem>
+ <para>
+ Array of <varname>A</varname> and <varname>B</varname> data type,
+ and of size (a1*b1, a2*b2, ..).
+ If <varname>A</varname> or <varname>B</varname> is sparse,
+ <varname>P</varname> is sparse.
+ </para>
+ </listitem>
+ </varlistentry>
+ </variablelist>
+ </refsection>
+ <refsection>
<title>説明</title>
<para>
<literal>kron(A,B)</literal> または <literal>A.*.B</literal> は
2つの行列<literal>A</literal> および
<literal>B</literal>のクロネッカーテンソル積を返します.
結果の行列は以下のようなブロック形式となります:
+ <latex style="display" alt="
+ [ A(1,1).B .. A(1,n).B ] \n
+A .✶. B = | ⋮ ⋮ ⋮ | \n
+ [ A(m,1).B .. A(m,n).B ]">
+ A \; .*.\; B = \begin{pmatrix}
+ A_{1,1}\cdot B & \cdots & A_{1,n}\cdot B \\
+ \vdots & & \vdots \\
+ A_{m,1}\cdot B & \cdots & A_{m,n}\cdot B
+ \end{pmatrix}
+ </latex>
</para>
- <informalequation>
- <mediaobject>
- <imageobject>
- <imagedata fileref="../../mml/kron_equation_1.mml"/>
- </imageobject>
- </mediaobject>
- </informalequation>
<para>
<literal>A</literal>が <literal>m x n</literal> 行列で
<literal>B</literal> が <literal>p x q</literal> 行列の場合,
<literal>A.*.B</literal> は <literal>(m*p) x (n*q)</literal>
行列となります.
</para>
- <para>
- <literal>A</literal> および <literal>B</literal> は疎行列とすることも
- できます.
- </para>
</refsection>
<refsection>
<title>例</title>
<programlisting role="example"><![CDATA[
-A = [1,2;3,4];
-kron(A,A)
-A.*.A
-sparse(A).*.sparse(A)
-A(1,1) = %i;
-kron(A,A)
+A = [1 3 ; 2 4]
+B = [1 10 100]
+kron(A, B)
+A .*. B
+B .*. A
+ ]]></programlisting>
+ <screen><![CDATA[
+--> A = [1 3 ; 2 4]
+ A =
+ 1. 3.
+ 2. 4.
+
+--> B = [1 10 100]
+ B =
+ 1. 10. 100.
+
+--> kron(A, B)
+ ans =
+ 1. 10. 100. 3. 30. 300.
+ 2. 20. 200. 4. 40. 400.
+
+--> A .*. B
+ ans =
+ 1. 10. 100. 3. 30. 300.
+ 2. 20. 200. 4. 40. 400.
+
+--> B .*. A
+ ans =
+ 1. 3. 10. 30. 100. 300.
+ 2. 4. 20. 40. 200. 400.
+]]></screen>
+ <para>With sparse matrices:</para>
+ <programlisting role="example"><![CDATA[
+P = [-1 0 1 10] .*. sparse([0 1 2])
+full(P)
+ ]]></programlisting>
+ <screen><![CDATA[
+--> P = [-1 0 1 10] .*. sparse([0 1 2])
+ P =
+( 1, 12) sparse matrix
+( 1, 2) -1.
+( 1, 3) -2.
+( 1, 8) 1.
+( 1, 9) 2.
+( 1, 11) 10.
+( 1, 12) 20.
+
+--> full(P)
+ ans =
+ 0. -1. -2. 0. 0. 0. 0. 1. 2. 0. 10. 20.
+]]></screen>
+ <para>With complex numbers:</para>
+ <programlisting role="example"><![CDATA[
+A = [-1 1 ; -%i %i]
+A .*. A
+ ]]></programlisting>
+ <screen><![CDATA[
+--> A = [-1 1 ; -%i %i]
+ A =
+ -1. 1.
+ -i i
-// With hypermatrices
-// ------------------
+--> A .*. A
+ ans =
+ 1. -1. -1. 1.
+ i -i -i i
+ i -i -i i
+ -1. 1. 1. -1.
+]]></screen>
+ <para>
+ With hypermatrices:
+ </para>
+ <programlisting role="example"><![CDATA[
b = matrix(1:24, [4 3 2]);
// row .*. hypermat
-clc
a = 1:2, b
a.*.b
// hypermat .*. row
-clc
b,a
b .*. a
// column .*. hypermat
-clc
a = [1;2], b
a.*.b
// matrix .*. hypermat
-clc
a = [-1 -2; 2 1], b
a.*.b
// hypermat .*. hypermat
-clc
a = matrix([-1,-2, 1 2], [1 2 2]), b
a.*.b
]]></programlisting>
</refsection>
+ <refsection role="see also">
+ <title>参照</title>
+ <simplelist type="inline">
+ <member>
+ <link linkend="krondivide">kron .\. ./.</link>
+ </member>
+ <member>
+ <link linkend="star">star</link>
+ </member>
+ <member>
+ <link linkend="prod">prod</link>
+ </member>
+ <member>
+ <link linkend="cumprod">cumprod</link>
+ </member>
+ <member>
+ <link linkend="repmat">repmat</link>
+ </member>
+ </simplelist>
+ </refsection>
<refsection>
<title>履歴</title>
<revhistory>
+++ /dev/null
-<?xml version="1.0" encoding="UTF-8"?>
-<!DOCTYPE math:math PUBLIC "-//OpenOffice.org//DTD Modified W3C MathML 1.01//EN" "math.dtd">
-<math:math xmlns:math="http://www.w3.org/1998/Math/MathML">
- <math:semantics>
- <math:mrow>
- <math:mi>A</math:mi>
- <math:mrow>
- <math:mn>.</math:mn>
- <math:mo math:stretchy="false">∗</math:mo>
- <math:mn>.</math:mn>
- </math:mrow>
- <math:mrow>
- <math:mi>B</math:mi>
- <math:mo math:stretchy="false">=</math:mo>
- <math:mfenced math:open="[" math:close="]">
- <math:mtable>
- <math:mtr>
- <math:mtd>
- <math:mrow>
- <math:mi>A</math:mi>
- <math:mrow>
- <math:mrow>
- <math:mo math:stretchy="false">(</math:mo>
- <math:mn>1,1</math:mn>
- <math:mo math:stretchy="false">)</math:mo>
- </math:mrow>
- <math:mo math:stretchy="false">⋅</math:mo>
- <math:mi>B</math:mi>
- </math:mrow>
- </math:mrow>
- </math:mtd>
- <math:mtd>
- <math:mo math:stretchy="false">⋯</math:mo>
- </math:mtd>
- <math:mtd>
- <math:mrow>
- <math:mi>A</math:mi>
- <math:mrow>
- <math:mrow>
- <math:mo math:stretchy="false">(</math:mo>
- <math:mrow>
- <math:mn>1,</math:mn>
- <math:mi>n</math:mi>
- </math:mrow>
- <math:mo math:stretchy="false">)</math:mo>
- </math:mrow>
- <math:mo math:stretchy="false">⋅</math:mo>
- <math:mi>B</math:mi>
- </math:mrow>
- </math:mrow>
- </math:mtd>
- </math:mtr>
- <math:mtr>
- <math:mtd>
- <math:mo math:stretchy="false">⋮</math:mo>
- </math:mtd>
- <math:mtd>
- <math:mtext> </math:mtext>
- </math:mtd>
- <math:mtd>
- <math:mo math:stretchy="false">⋮</math:mo>
- </math:mtd>
- </math:mtr>
- <math:mtr>
- <math:mtd>
- <math:mrow>
- <math:mi>A</math:mi>
- <math:mrow>
- <math:mrow>
- <math:mo math:stretchy="false">(</math:mo>
- <math:mrow>
- <math:mi>m</math:mi>
- <math:mn>,1</math:mn>
- </math:mrow>
- <math:mo math:stretchy="false">)</math:mo>
- </math:mrow>
- <math:mo math:stretchy="false">⋅</math:mo>
- <math:mi>B</math:mi>
- </math:mrow>
- </math:mrow>
- </math:mtd>
- <math:mtd>
- <math:mo math:stretchy="false">⋯</math:mo>
- </math:mtd>
- <math:mtd>
- <math:mrow>
- <math:mi>A</math:mi>
- <math:mrow>
- <math:mrow>
- <math:mo math:stretchy="false">(</math:mo>
- <math:mrow>
- <math:mi>m</math:mi>
- <math:mi>,</math:mi>
- <math:mi>n</math:mi>
- </math:mrow>
- <math:mo math:stretchy="false">)</math:mo>
- </math:mrow>
- <math:mo math:stretchy="false">⋅</math:mo>
- <math:mi>B</math:mi>
- </math:mrow>
- </math:mrow>
- </math:mtd>
- </math:mtr>
- </math:mtable>
- </math:mfenced>
- </math:mrow>
- </math:mrow>
- <math:annotation math:encoding="StarMath 5.0">A .*. B =
-left [
-matrix {
-A(1,1) cdot B # dotsaxis # A(1,n) cdot B ##
-dotsvert # " " # dotsvert ##
-A(m,1) cdot B # dotsaxis # A(m,n) cdot B
-} right ] </math:annotation>
- </math:semantics>
-</math:math>
\ No newline at end of file
<!--
* Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
* Copyright (C) 2008 - INRIA
- * Copyright (C) 2014 - Samuel Gougeon : extension to hypermatrices
- *
* Copyright (C) 2012 - 2016 - Scilab Enterprises
+ * Copyright (C) 2014, 2019 - Samuel GOUGEON
*
* 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.
* 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="kron" 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: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="kron" xml:lang="pt">
<refnamediv>
- <refname>kron</refname>
- <refpurpose>produto de Kronecker (.*.) </refpurpose>
+ <refname>kron .*.</refname>
+ <refpurpose>Produto de Kronecker. Weighted array replication</refpurpose>
</refnamediv>
<refsynopsisdiv>
<title>Seqüência de Chamamento</title>
- <synopsis>kron(A,B)
- A.*.B
+ <synopsis>
+ P = kron(A, B)
+ P = A .*. B
</synopsis>
</refsynopsisdiv>
<refsection>
+ <title>Arguments</title>
+ <variablelist>
+ <varlistentry>
+ <term>A, B</term>
+ <listitem>
+ <para>
+ Arrays of size (a1, a2, ..) and (b1, b2, ..), with any number of dimensions.
+ If <varname>A</varname> or <varname>B</varname> is sparse, the other one
+ can't be an hypermatrix.
+ </para>
+ <para>
+ Supported encodings and types: integer, real, complex, polynomial, rational,
+ sparse.
+ </para>
+ </listitem>
+ </varlistentry>
+ <varlistentry>
+ <term>P</term>
+ <listitem>
+ <para>
+ Array of <varname>A</varname> and <varname>B</varname> data type,
+ and of size (a1*b1, a2*b2, ..).
+ If <varname>A</varname> or <varname>B</varname> is sparse,
+ <varname>P</varname> is sparse.
+ </para>
+ </listitem>
+ </varlistentry>
+ </variablelist>
+ </refsection>
+ <refsection>
<title>Descrição</title>
<para>
<literal>kron(A,B)</literal> ou <literal>A.*.B</literal> retorna o
produto tensorial de Kronecker entre duas matrizes ou hypermatrizes <literal>A</literal> e
<literal>B</literal>. A matriz resultante tem a seguinte forma de blocos:
+ <latex style="display" alt="
+ [ A(1,1).B .. A(1,n).B ] \n
+A .✶. B = | ⋮ ⋮ ⋮ | \n
+ [ A(m,1).B .. A(m,n).B ]">
+ A \; .*.\; B = \begin{pmatrix}
+ A_{1,1}\cdot B & \cdots & A_{1,n}\cdot B \\
+ \vdots & & \vdots \\
+ A_{m,1}\cdot B & \cdots & A_{m,n}\cdot B
+ \end{pmatrix}
+ </latex>
</para>
- <informalequation>
- <mediaobject>
- <imageobject>
- <imagedata fileref="../../mml/kron_equation_1.mml"/>
- </imageobject>
- </mediaobject>
- </informalequation>
<para>
Se <literal>A</literal> é uma matriz <literal>m x n</literal> e
<literal>B</literal> é uma hypermatriz <literal>p x q x r</literal> , então
</literal>
.
</para>
- <para>
- <literal>A</literal> e <literal>B</literal> podem ser matrizes esparsas, mas o produto de Kronecker não é definida entre uma matriz e uma hipermatriz.
- </para>
</refsection>
<refsection>
<title>Exemplos</title>
<programlisting role="example"><![CDATA[
-A = [1,2;3,4];
-kron(A,A)
-A.*.A
-sparse(A).*.sparse(A)
-A(1,1) = %i;
-kron(A,A)
+A = [1 3 ; 2 4]
+B = [1 10 100]
+kron(A, B)
+A .*. B
+B .*. A
+ ]]></programlisting>
+ <screen><![CDATA[
+--> A = [1 3 ; 2 4]
+ A =
+ 1. 3.
+ 2. 4.
+
+--> B = [1 10 100]
+ B =
+ 1. 10. 100.
+
+--> kron(A, B)
+ ans =
+ 1. 10. 100. 3. 30. 300.
+ 2. 20. 200. 4. 40. 400.
+
+--> A .*. B
+ ans =
+ 1. 10. 100. 3. 30. 300.
+ 2. 20. 200. 4. 40. 400.
+
+--> B .*. A
+ ans =
+ 1. 3. 10. 30. 100. 300.
+ 2. 4. 20. 40. 200. 400.
+]]></screen>
+ <para>With sparse matrices:</para>
+ <programlisting role="example"><![CDATA[
+P = [-1 0 1 10] .*. sparse([0 1 2])
+full(P)
+ ]]></programlisting>
+ <screen><![CDATA[
+--> P = [-1 0 1 10] .*. sparse([0 1 2])
+ P =
+( 1, 12) sparse matrix
+( 1, 2) -1.
+( 1, 3) -2.
+( 1, 8) 1.
+( 1, 9) 2.
+( 1, 11) 10.
+( 1, 12) 20.
+
+--> full(P)
+ ans =
+ 0. -1. -2. 0. 0. 0. 0. 1. 2. 0. 10. 20.
+]]></screen>
+ <para>With complex numbers:</para>
+ <programlisting role="example"><![CDATA[
+A = [-1 1 ; -%i %i]
+A .*. A
+ ]]></programlisting>
+ <screen><![CDATA[
+--> A = [-1 1 ; -%i %i]
+ A =
+ -1. 1.
+ -i i
-// com hypermatrizes
-// -----------------
+--> A .*. A
+ ans =
+ 1. -1. -1. 1.
+ i -i -i i
+ i -i -i i
+ -1. 1. 1. -1.
+]]></screen>
+ <para>
+ Com hypermatrizes :
+ </para>
+ <programlisting role="example"><![CDATA[
b = matrix(1:24, [4 3 2]);
// row .*. hypermat
-clc
a = 1:2, b
a.*.b
// hypermat .*. row
-clc
b,a
b .*. a
// column .*. hypermat
-clc
a = [1;2], b
a.*.b
// matrix .*. hypermat
-clc
a = [-1 -2; 2 1], b
a.*.b
// hypermat .*. hypermat
-clc
a = matrix([-1,-2, 1 2], [1 2 2]), b
a.*.b
]]></programlisting>
</refsection>
+ <refsection role="see also">
+ <title>Ver também</title>
+ <simplelist type="inline">
+ <member>
+ <link linkend="krondivide">kron .\. ./.</link>
+ </member>
+ <member>
+ <link linkend="star">star</link>
+ </member>
+ <member>
+ <link linkend="prod">prod</link>
+ </member>
+ <member>
+ <link linkend="cumprod">cumprod</link>
+ </member>
+ <member>
+ <link linkend="repmat">repmat</link>
+ </member>
+ </simplelist>
+ </refsection>
<refsection>
<title>Histórico</title>
<revhistory>
<!--
* Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
* Copyright (C) 2008 - INRIA
- * Copyright (C) 2014 - Samuel Gougeon : extension to hypermatrices
- *
* Copyright (C) 2012 - 2016 - Scilab Enterprises
+ * Copyright (C) 2014, 2019 - Samuel GOUGEON
*
* 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.
* 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="kron" 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="kron" xml:lang="ru">
<refnamediv>
- <refname>kron</refname>
- <refpurpose>произведение Кронекера (.*.)</refpurpose>
+ <refname>kron .*.</refname>
+ <refpurpose>произведение Кронекера. Взвешенное повторение массива</refpurpose>
</refnamediv>
<refsynopsisdiv>
<title>Синтаксис</title>
<synopsis>
- kron(A,B)
- A.*.B
+ P = kron(A, B)
+ P = A .*. B
</synopsis>
</refsynopsisdiv>
<refsection>
+ <title>Arguments</title>
+ <variablelist>
+ <varlistentry>
+ <term>A, B</term>
+ <listitem>
+ <para>
+ Массивы размером <literal>(a1, a2, ..)</literal> и <literal>(b1, b2, ..)</literal>
+ с любым числом размерности. Если <varname>A</varname> или <varname>B</varname>
+ являются разрежёнными, то другоо массив не может быть гиперматрицей.
+ </para>
+ <para>
+ Поддерживаемые кодируемые целые и типы: integer, real, complex, polynomial, rational,
+ sparse.
+ </para>
+ </listitem>
+ </varlistentry>
+ <varlistentry>
+ <term>P</term>
+ <listitem>
+ <para>
+ Массив с типом данных <varname>A</varname> и <varname>B</varname>, и
+ размером <literal>(a1*b1, a2*b2, ..)</literal>. Если <varname>A</varname> или
+ <varname>B</varname> разрежённый массив, то <varname>P</varname> будет разрежённым.
+ </para>
+ </listitem>
+ </varlistentry>
+ </variablelist>
+ </refsection>
+ <refsection>
<title>Описание</title>
<para>
<literal>kron(A,B)</literal> или <literal>A.*.B</literal> возвращает результат
Кронекеровского тензорного произведения двух матриц или гиперматрицам <literal>A</literal> и
<literal>B</literal>. Матрица результата имеет следующую блочную форму:
+ <latex style="display" alt="
+ [ A(1,1).B .. A(1,n).B ] \n
+A .✶. B = | ⋮ ⋮ ⋮ | \n
+ [ A(m,1).B .. A(m,n).B ]">
+ A \; .*.\; B = \begin{pmatrix}
+ A_{1,1}\cdot B & \cdots & A_{1,n}\cdot B \\
+ \vdots & & \vdots \\
+ A_{m,1}\cdot B & \cdots & A_{m,n}\cdot B
+ \end{pmatrix}
+ </latex>
</para>
- <informalequation>
- <mediaobject>
- <imageobject>
- <imagedata fileref="../../mml/kron_equation_1.mml"/>
- </imageobject>
- </mediaobject>
- </informalequation>
<para>
Если матрица <literal>A</literal> имеет размер <literal>m x n</literal>, а матрица
- <literal>B</literal> имеет размер <literal>p x q</literal>, то результат
- <literal>A.*.B</literal> является матрицей размером <literal>(m*p) x (n*q)</literal>.
- </para>
- <para>
- <literal>A</literal> и <literal>B</literal> могут быть разрежёнными матрицами.
+ <literal>B</literal> имеет размер <literal>p x q x r</literal>, то результат
+ <literal>A .*. B</literal> является матрицей размером <literal>(m*p) x (n*q) x (1xr)</literal>.
</para>
</refsection>
<refsection>
<title>Примеры</title>
<programlisting role="example"><![CDATA[
-A = [1,2;3,4];
-kron(A,A)
-A.*.A
-sparse(A).*.sparse(A)
-A(1,1) = %i;
-kron(A,A)
+A = [1 3 ; 2 4]
+B = [1 10 100]
+kron(A, B)
+A .*. B
+B .*. A
+ ]]></programlisting>
+ <screen><![CDATA[
+--> A = [1 3 ; 2 4]
+ A =
+ 1. 3.
+ 2. 4.
+
+--> B = [1 10 100]
+ B =
+ 1. 10. 100.
+
+--> kron(A, B)
+ ans =
+ 1. 10. 100. 3. 30. 300.
+ 2. 20. 200. 4. 40. 400.
+
+--> A .*. B
+ ans =
+ 1. 10. 100. 3. 30. 300.
+ 2. 20. 200. 4. 40. 400.
+
+--> B .*. A
+ ans =
+ 1. 3. 10. 30. 100. 300.
+ 2. 4. 20. 40. 200. 400.
+]]></screen>
+ <para>С разрежёнными матрицами:</para>
+ <programlisting role="example"><![CDATA[
+P = [-1 0 1 10] .*. sparse([0 1 2])
+full(P)
+ ]]></programlisting>
+ <screen><![CDATA[
+--> P = [-1 0 1 10] .*. sparse([0 1 2])
+ P =
+( 1, 12) sparse matrix
+( 1, 2) -1.
+( 1, 3) -2.
+( 1, 8) 1.
+( 1, 9) 2.
+( 1, 11) 10.
+( 1, 12) 20.
+
+--> full(P)
+ ans =
+ 0. -1. -2. 0. 0. 0. 0. 1. 2. 0. 10. 20.
+]]></screen>
+ <para>С комплексными числами:</para>
+ <programlisting role="example"><![CDATA[
+A = [-1 1 ; -%i %i]
+A .*. A
+ ]]></programlisting>
+ <screen><![CDATA[
+--> A = [-1 1 ; -%i %i]
+ A =
+ -1. 1.
+ -i i
-// with hypermatrices
-// ------------------
+--> A .*. A
+ ans =
+ 1. -1. -1. 1.
+ i -i -i i
+ i -i -i i
+ -1. 1. 1. -1.
+]]></screen>
+ <para>
+ С гиперматрицами:
+ </para>
+ <programlisting role="example"><![CDATA[
b = matrix(1:24, [4 3 2]);
-// row .*. hypermat
-clc
+// строка .*. гиперматрица
a = 1:2, b
a.*.b
-// hypermat .*. row
-clc
+// гиперматрица .*. строка
b,a
b .*. a
-// column .*. hypermat
-clc
+// столбец .*. гиперматрица
a = [1;2], b
a.*.b
-// matrix .*. hypermat
-clc
+// матрица .*. гиперматрица
a = [-1 -2; 2 1], b
a.*.b
-// hypermat .*. hypermat
-clc
+// гиперматрица .*. гиперматрица
a = matrix([-1,-2, 1 2], [1 2 2]), b
a.*.b
]]></programlisting>
</refsection>
+ <refsection role="see also">
+ <title>Смотрите также</title>
+ <simplelist type="inline">
+ <member>
+ <link linkend="krondivide">kron .\. ./.</link>
+ </member>
+ <member>
+ <link linkend="star">star</link>
+ </member>
+ <member>
+ <link linkend="prod">prod</link>
+ </member>
+ <member>
+ <link linkend="cumprod">cumprod</link>
+ </member>
+ <member>
+ <link linkend="repmat">repmat</link>
+ </member>
+ </simplelist>
+ </refsection>
<refsection>
<title>История</title>
<revhistory>
<revision>
<revnumber>5.5.1</revnumber>
<revdescription>
- <para>Распространение с целью гиперматрицам</para>
+ <para>Расширение до гиперматриц</para>
</revdescription>
</revision>
</revhistory>
--- /dev/null
+// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
+//
+// Copyright (C) 2019 - Samuel GOUGEON
+//
+// 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.
+
+function x = %s_y_s(b, a)
+ // x = b ./. a such that b = x .*. a
+ // a, b: arrays of any sizes, including hypermatrices
+
+ // size(a) = (p, q, ..)
+ // size(x) = (m, n, ..)
+ // size(b) = (m*p, n*q, ..)
+
+ // Extended size of a:
+ sa = [size(a) ones(1, ndims(b)-ndims(a))]; // [p, q,..]
+
+ // Size of x
+ sx = size(b) ./ sa;
+ if or(sx <> int(sx)) then
+ msg = _("%s: Arguments #%d and #%d: Incompatible sizes.\n")
+ error(msprintf(msg, "./. :", 1, 2))
+ end
+ // for ones(Sx(:)):
+ Sx = list(); for s = sx, Sx($+1) = s, end
+
+ // Reordering b components to allow a matricial processing:
+ ia = matrix(1:prod(sa), sa);
+ tmp = ones(Sx(:)) .*. ia;
+ [tmp, k] = gsort(tmp,"g","i");
+ b = matrix(b(k), prod(sx), prod(sa))
+
+ // Least square Processing
+ x = b / a(:).'
+
+ // Reshaping the raw result
+ x = matrix(x, sx)
+endfunction
--- /dev/null
+// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
+//
+// Copyright (C) 2019 - Samuel GOUGEON
+//
+// 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.
+
+function x = %s_z_s(a, b)
+ // x = a .\. b such that b = a .*. x
+ // a, b: arrays of any sizes, including hypermatrices
+
+ // size(a) = (p, q, ..)
+ // size(x) = (m, n, ..)
+ // size(b) = (m*p, n*q, ..)
+
+ // Extended size of a:
+ sa = [size(a) ones(1, ndims(b)-ndims(a))]; // [p, q,..]
+
+ // Size of x
+ sx = size(b) ./ sa;
+ if or(sx <> int(sx)) then
+ msg = _("%s: Arguments #%d and #%d: Incompatible sizes.\n")
+ error(msprintf(msg, ".\. :", 1, 2))
+ end
+ // for ones(Sa(:)):
+ Sa = list(); for s = sa, Sa($+1) = s, end
+
+ // Reordering b components to allow a matricial processing:
+ ix = matrix(1:prod(sx), sx);
+ tmp = ones(Sa(:)) .*. ix;
+ [tmp, k] = gsort(tmp,"g","i");
+ b = matrix(b(k), prod(sa), prod(sx))
+
+ // Least square Processing
+ x = a(:) \ b
+
+ // Reshaping the raw result
+ x = matrix(x, sx)
+endfunction
</ul>
</li>
<li><code>nchoosek</code> is introduced, to compute the binomial coefficients.</li>
+ <li>The left .\. and right ./. Kronecker divisions are now implemented, for arrays of decimal or complex numbers.</li>
</ul>
<h2 class="title">Help pages</h2>
<ul>
_LaTeX_karmarkar.xml_4.png=2379757f440c07ab9aeffe1b508f75b6
_LaTeX_karmarkar.xml_5.png=a35a1551eae946884ef2780daf3217c9
_LaTeX_karmarkar.xml_6.png=d7299efdc04def35c6a385007dd15a94
+_LaTeX_kron.xml_1.png=b753c208628aee40d785c9913ff96b32
_LaTeX_lattn.xml_1.png=7ba64bdfad2c53fb336f12443f4926c6
_LaTeX_lattn.xml_2.png=9b7ed107c9acb432bc04c8505b9d96ce
_LaTeX_lattp.xml_1.png=7ba64bdfad2c53fb336f12443f4926c6
mrfit_1.png=d8d3736f01fc8fc707c53508cddd575f
nanreglin_1.png=a2189dd0a4084c54b9c1e05b45db555b
nanreglin_2.png=5a3c75b736030778ba4a1717051810cb
-nchoosek_1.png=f8a2e760e24aee2eef300957c9b5a0ab
+nchoosek_1.png=1f8c615fef042cb5f754a00ef9d8a7bd
nchoosek_2.png=d59cb2852e6e414d9d14967de0ac3f2b
nchoosek_3.png=f05fd5b52c25f76208d91dc4ca10af2f
ndgrid_1.png=881b8c6e4e1ccf21fce8004766f2df8d