1 <?xml version="1.0" encoding="UTF-8"?>
3 * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
4 * Copyright (C) 2008 - INRIA
5 * Copyright (C) 2012 - 2016 - Scilab Enterprises
6 * Copyright (C) 2014, 2019 - Samuel GOUGEON
8 * This file is hereby licensed under the terms of the GNU GPL v2.0,
9 * pursuant to article 5.3.4 of the CeCILL v.2.1.
10 * This file was originally licensed under the terms of the CeCILL v2.1,
11 * and continues to be available under such terms.
12 * For more information, see the COPYING file which you should have received
13 * along with this program.
16 <refentry xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink"
17 xmlns:svg="http://www.w3.org/2000/svg" xmlns:ns5="http://www.w3.org/1999/xhtml"
18 xmlns:mml="http://www.w3.org/1998/Math/MathML" xmlns:db="http://docbook.org/ns/docbook"
19 xmlns:scilab="http://www.scilab.org" xml:id="kron" xml:lang="en">
21 <refname>kron .*.</refname>
22 <refpurpose>Kronecker tensorial product. Weighted array replication</refpurpose>
32 <title>Arguments</title>
38 Arrays of size (a1, a2, ..) and (b1, b2, ..), with any number of dimensions.
39 If <varname>A</varname> or <varname>B</varname> is sparse, the other one
40 can't be an hypermatrix.
43 Supported encodings and types: integer, real, complex, polynomial, rational,
52 Array of <varname>A</varname> and <varname>B</varname> data type,
53 and of size (a1*b1, a2*b2, ..).
54 If <varname>A</varname> or <varname>B</varname> is sparse,
55 <varname>P</varname> is sparse.
62 <title>Description</title>
64 <literal>kron(A,B)</literal> or <literal>A .*. B</literal> returns the
65 Kronecker tensor product of two matrices or hypermatrices<literal>A</literal> and
66 <literal>B</literal>. The resulting matrix has the following block
68 <latex style="display" alt="
69 [ A(1,1).B .. A(1,n).B ] \n
70 A .✶. B = | ⋮ ⋮ ⋮ | \n
71 [ A(m,1).B .. A(m,n).B ]">
72 A \; .*.\; B = \begin{pmatrix}
73 A_{1,1}\cdot B & \cdots & A_{1,n}\cdot B \\
74 \vdots & & \vdots \\
75 A_{m,1}\cdot B & \cdots & A_{m,n}\cdot B
80 If <literal>A</literal> is a <literal>m x n</literal> matrix and
81 <literal>B</literal> a <literal>p x q x r</literal> hypermatrix then
82 <literal>A.*.B</literal> is a <literal>(m*p) x (n*q) x (1*r)</literal>
87 <title>Examples</title>
88 <programlisting role="example"><![CDATA[
107 1. 10. 100. 3. 30. 300.
108 2. 20. 200. 4. 40. 400.
112 1. 10. 100. 3. 30. 300.
113 2. 20. 200. 4. 40. 400.
117 1. 3. 10. 30. 100. 300.
118 2. 4. 20. 40. 200. 400.
120 <para>With sparse matrices:</para>
121 <programlisting role="example"><![CDATA[
122 P = [-1 0 1 10] .*. sparse([0 1 2])
126 --> P = [-1 0 1 10] .*. sparse([0 1 2])
128 ( 1, 12) sparse matrix
138 0. -1. -2. 0. 0. 0. 0. 1. 2. 0. 10. 20.
140 <para>With complex numbers:</para>
141 <programlisting role="example"><![CDATA[
146 --> A = [-1 1 ; -%i %i]
161 <programlisting role="example"><![CDATA[
162 b = matrix(1:24, [4 3 2]);
172 // column .*. hypermat
176 // matrix .*. hypermat
180 // hypermat .*. hypermat
181 a = matrix([-1,-2, 1 2], [1 2 2]), b
185 <refsection role="see also">
186 <title>See Also</title>
187 <simplelist type="inline">
189 <link linkend="krondivide">kron .\. ./.</link>
192 <link linkend="star">star</link>
195 <link linkend="prod">prod</link>
198 <link linkend="cumprod">cumprod</link>
201 <link linkend="repmat">repmat</link>
206 <title>History</title>
209 <revnumber>5.5.1</revnumber>
211 <para>Extension to hypermatrices</para>