Scilab Home page | Wiki | Bug tracker | Forge | Mailing list archives | ATOMS | File exchange
Please login or create an account
Change language to: English - Français - 日本語 - Русский
Ajuda do Scilab >> Funções Elementares > Matrix operations > kron .\. ./.

kron .\. ./.

Kronecker left and right divisions

Syntax

X = A .\. B // while B = A .*. X
X = B ./. A // while B = X .*. A

Arguments

X
Array of decimal or complex numbers, of size (x1,x2,..).
A
Array of decimal or complex numbers, of size (a1,a2,..), with any number of dimensions.
B
Array of decimal or complex numbers, of size (a1*x1, a2*x2,..), with any number of dimensions.

Description

B ./. A computes and provides the array X such that B = X .*. A.

A .\. B computes and provides the array X such that B = A .*. X.

In both cases, each X coefficient is constrained by length(A) proportional equations. The divisions are so performed in a least-square way minimizing norm(A.*.X - B, 2) or norm(X.*.A - B, 2).

Examples

Simple example with low and crossed dimensions:

A = 0:3
B = [1 10 100]'
P = A .*. B
--> 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.

Still with some low dimensions, and with noisy data:

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
--> 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

With hypermatrices:

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
 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.

See Also

  • kron — Produto de Kronecker. Weighted array replication
  • slash — (/) divisão esquerda-direita e feedback ("resposta")
  • backslash — (\) divisão matricial direita-esquerda
  • star — (*) operador de multiplicação

History

VersionDescription
6.1.0

.\. and ./. actually implemented, for decimal and complex numbers.

Scilab Enterprises
Copyright (c) 2011-2017 (Scilab Enterprises)
Copyright (c) 1989-2012 (INRIA)
Copyright (c) 1989-2007 (ENPC)
with contributors
Last updated:
Tue Feb 25 08:52:28 CET 2020