Scilab Website | Contribute with GitLab | Mailing list archives | ATOMS toolboxes
Scilab Online Help
2023.0.0 - Português


kron .*.

Produto de Kronecker. Weighted array replication

Seqüência de Chamamento

P = kron(A, B)
P = A .*. B

Arguments

A, B

Arrays of size (a1, a2, ..) and (b1, b2, ..), with any number of dimensions. If A or B is sparse, the other one can't be an hypermatrix.

Supported encodings and types: boolean, integer, real, complex, polynomial, rational, sparse boolean, sparse real, sparse complex.

P

Array of A and B data type, and of size (a1*b1, a2*b2, ..). If A or B is sparse, P is sparse.

Descrição

kron(A,B) ou A.*.B retorna o produto tensorial de Kronecker entre duas matrizes ou hypermatrizes A e B. A matriz resultante tem a seguinte forma de blocos:

           [ A(1,1).B  ..  A(1,n).B ] \n A .✶. B = |   ⋮        ⋮     ⋮      | \n           [ A(m,1).B  ..  A(m,n).B ]

Se A é uma matriz m x n e B é uma hypermatriz p x q x r , então A.*.B é uma hypermatriz (m*p) x (n*q) x (1*r) .

Exemplos

A = [1 3 ; 2 4]
B = [1 10 100]
kron(A, B)
A .*. B
B .*. A
--> 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.

With sparse matrices:

P = [-1 0 1 10] .*. sparse([0 1 2])
full(P)
--> 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.

With complex numbers:

A = [-1 1 ; -%i %i]
A .*. A
--> 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.

Com hypermatrizes :

b = matrix(1:24, [4 3 2]);

// row .*. hypermat
a = 1:2, b
a.*.b

// hypermat .*. row
b,a
b .*. a

// column .*. hypermat
a = [1;2], b
a.*.b

// matrix .*. hypermat
a = [-1 -2; 2 1], b
a.*.b

// hypermat .*. hypermat
a = matrix([-1,-2, 1 2], [1 2 2]), b
a.*.b

Ver também

  • kron .\. ./. — Kronecker left and right divisions
  • star — (*) operador de multiplicação
  • prod — produto
  • cumprod — produto cumulativo
  • repmat — Replicate and tile an array

Histórico

VersionDescription
5.5.1 Extensão ao hypermatrizes.
6.1.1 Extension to boolean and sparse boolean arrays.
Report an issue
<< cumsum Matrix operations kron .\. ./. >>

Copyright (c) 2022-2023 (Dassault Systèmes)
Copyright (c) 2017-2022 (ESI Group)
Copyright (c) 2011-2017 (Scilab Enterprises)
Copyright (c) 1989-2012 (INRIA)
Copyright (c) 1989-2007 (ENPC)
with contributors
Last updated:
Mon Mar 27 09:49:52 GMT 2023