numpy 1.22.4 Pypi GitHub Homepage
Other Docs
ParametersRaisesReturnsBackRef
tensorsolve(a, b, axes=None)

It is assumed that all indices of x are summed over in the product, together with the rightmost indices of a, as is done in, for example, tensordot(a, x, axes=b.ndim) .

Parameters

a : array_like

Coefficient tensor, of shape b.shape + Q . :None:None:`Q`, a tuple, equals the shape of that sub-tensor of a consisting of the appropriate number of its rightmost indices, and must be such that prod(Q) == prod(b.shape) (in which sense a is said to be 'square').

b : array_like

Right-hand tensor, which can be of any shape.

axes : tuple of ints, optional

Axes in a to reorder to the right, before inversion. If None (default), no reordering is done.

Raises

LinAlgError

If a is singular or not 'square' (in the above sense).

Returns

x : ndarray, shape Q

Solve the tensor equation a x = b for x.

See Also

numpy.einsum
numpy.tensordot
tensorinv

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
See :

Back References

The following pages refer to to this document either explicitly or contain code examples using this.

numpy.linalg.tensorinv

Local connectivity graph

Hover to see nodes names; edges to Self not shown, Caped at 50 nodes.

Using a canvas is more power efficient and can get hundred of nodes ; but does not allow hyperlinks; , arrows or text (beyond on hover)

SVG is more flexible but power hungry; and does not scale well to 50 + nodes.

All aboves nodes referred to, (or are referred from) current nodes; Edges from Self to other have been omitted (or all nodes would be connected to the central node "self" which is not useful). Nodes are colored by the library they belong to, and scaled with the number of references pointing them


GitHub : /numpy/linalg/linalg.py#238
type: <class 'function'>
Commit: