kron

sparse.kron(a, b)[source]

Kronecker product of 2 sparse arrays.

Parameters:b (a,) – The arrays over which to compute the Kronecker product.
Returns:res – The kronecker product
Return type:COO
Raises:ValueError – If all arguments are dense or arguments have nonzero fill-values.

Examples

>>> a = eye(3, dtype='i8')
>>> b = np.array([1, 2, 3], dtype='i8')
>>> res = kron(a, b)
>>> res.todense()  # doctest: +SKIP
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)