1 |
|
2 |
|
3 | # Function kron
|
4 |
|
5 | Calculates the kronecker product of 2 matrices or vectors.
|
6 |
|
7 | NOTE: If a one dimensional vector / matrix is given, it will be
|
8 | wrapped so its two dimensions.
|
9 | See the examples.
|
10 |
|
11 |
|
12 | ## Syntax
|
13 |
|
14 | ```js
|
15 | math.kron(x, y)
|
16 | ```
|
17 |
|
18 | ### Parameters
|
19 |
|
20 | Parameter | Type | Description
|
21 | --------- | ---- | -----------
|
22 | `x` | Array | Matrix | First vector
|
23 | `y` | Array | Matrix | Second vector
|
24 |
|
25 | ### Returns
|
26 |
|
27 | Type | Description
|
28 | ---- | -----------
|
29 | Array | Matrix | Returns the kronecker product of `x` and `y`
|
30 |
|
31 |
|
32 | ## Examples
|
33 |
|
34 | ```js
|
35 | math.kron([[1, 0], [0, 1]], [[1, 2], [3, 4]])
|
36 | // returns [ [ 1, 2, 0, 0 ], [ 3, 4, 0, 0 ], [ 0, 0, 1, 2 ], [ 0, 0, 3, 4 ] ]
|
37 |
|
38 | math.kron([1,1], [2,3,4])
|
39 | // returns [ [ 2, 3, 4, 2, 3, 4 ] ]
|
40 | ```
|
41 |
|
42 |
|
43 | ## See also
|
44 |
|
45 | [multiply](multiply.md),
|
46 | [dot](dot.md),
|
47 | [cross](cross.md)
|