numpy.linalg.tensorsolve(a,b,axes=None)[source]¶Solve the tensor equationax=b for x.
It is assumed that all indices ofx are summed over in the product,together with the rightmost indices ofa, as is done in, for example,tensordot(a,x,axes=b.ndim).
| Parameters: | a : array_like
b : array_like
axes : tuple of ints, optional
|
|---|---|
| Returns: | x : ndarray, shape Q |
| Raises: | LinAlgError
|
See also
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