splinebox.multivariate.

tensor_product#

splinebox.multivariate.tensor_product(arrays)#

Compute the tensor product of a list of arrays.

Parameters:
arrayslist of numpy arrays

The arrays to combine. Each array must be one or two dimensional. One-dimensional arrays are treated as column vectors; two-dimensional arrays are used as-is, allowing each factor to have an arbitrary codomain dimension.

Returns:
numpy array

The tensor product of the input arrays.

Examples

>>> import numpy as np
>>> import splinebox
>>> a = np.array([1.0, 2.0])
>>> b = np.array([3.0, 4.0])
>>> splinebox.multivariate.tensor_product([a, b])
array([[[3.],
        [4.]],

       [[6.],
        [8.]]])