simple-squiggle

A restricted subset of Squiggle
Log | Files | Refs | README

kron.md (973B)


      1 <!-- Note: This file is automatically generated from source code comments. Changes made in this file will be overridden. -->
      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 &#124; Matrix | First vector
     23 `y` | Array &#124; Matrix | Second vector
     24 
     25 ### Returns
     26 
     27 Type | Description
     28 ---- | -----------
     29 Array &#124; Matrix | Returns the kronecker product of `x` and `y`
     30 
     31 
     32 ### Throws
     33 
     34 Type | Description
     35 ---- | -----------
     36 
     37 
     38 ## Examples
     39 
     40 ```js
     41 math.kron([[1, 0], [0, 1]], [[1, 2], [3, 4]])
     42 // returns [ [ 1, 2, 0, 0 ], [ 3, 4, 0, 0 ], [ 0, 0, 1, 2 ], [ 0, 0, 3, 4 ] ]
     43 
     44 math.kron([1,1], [2,3,4])
     45 // returns [ [ 2, 3, 4, 2, 3, 4 ] ]
     46 ```
     47 
     48 
     49 ## See also
     50 
     51 [multiply](multiply.md),
     52 [dot](dot.md),
     53 [cross](cross.md)