UNPKG

921 BMarkdownView Raw
1<!-- Note: This file is automatically generated from source code comments. Changes made in this file will be overridden. -->
2
3# Function kron
4
5Calculates the kronecker product of 2 matrices or vectors.
6
7NOTE: If a one dimensional vector / matrix is given, it will be
8wrapped so its two dimensions.
9See the examples.
10
11
12## Syntax
13
14```js
15math.kron(x, y)
16```
17
18### Parameters
19
20Parameter | Type | Description
21--------- | ---- | -----------
22`x` | Array &#124; Matrix | First vector
23`y` | Array &#124; Matrix | Second vector
24
25### Returns
26
27Type | Description
28---- | -----------
29Array &#124; Matrix | Returns the kronecker product of `x` and `y`
30
31
32## Examples
33
34```js
35math.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
38math.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)