kron
Kronecker product of 2 sparse arrays.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
a
|
SparseArray, scipy.sparse.spmatrix, or np.ndarray
|
The arrays over which to compute the Kronecker product. |
required |
b
|
SparseArray, scipy.sparse.spmatrix, or np.ndarray
|
The arrays over which to compute the Kronecker product. |
required |
Returns:
| Name | Type | Description |
|---|---|---|
res |
COO
|
The kronecker product |
Raises:
| Type | Description |
|---|---|
ValueError
|
If all arguments are dense or arguments have nonzero fill-values. |
Examples:
>>> from sparse import eye
>>> a = eye(3, dtype="i8")
>>> b = np.array([1, 2, 3], dtype="i8")
>>> res = kron(a, b)
>>> res.todense()
array([[1, 2, 3, 0, 0, 0, 0, 0, 0],
[0, 0, 0, 1, 2, 3, 0, 0, 0],
[0, 0, 0, 0, 0, 0, 1, 2, 3]], dtype=int64)
Source code in sparse/numba_backend/_coo/common.py
67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 | |