Solve the tensor equation a x = b for x
It is assumed that all indices of x are summed over in the product, together with the rightmost indices of a, similarly as in tensordot(a, x, axes=len(b.shape)).
Parameters: | a : array_like, shape b.shape+Q
b : array_like, any shape
axes : tuple of integers
|
---|---|
Returns: | x : array, shape Q |
Examples
>>> a = np.eye(2*3*4)
>>> a.shape = (2*3,4, 2,3,4)
>>> b = np.random.randn(2*3,4)
>>> x = np.linalg.tensorsolve(a, b)
>>> x.shape
(2, 3, 4)
>>> np.allclose(np.tensordot(a, x, axes=3), b)
True