tensorinv(a, ind=2)
The result is an inverse for a
relative to the tensordot operation tensordot(a, b, ind)
, i. e., up to floating-point accuracy, tensordot(tensorinv(a), a, ind)
is the "identity" tensor for the tensordot operation.
Tensor to 'invert'. Its shape must be 'square', i. e., prod(a.shape[:ind]) == prod(a.shape[ind:])
.
Number of first indices that are involved in the inverse sum. Must be a positive integer, default is 2.
If a
is singular or not 'square' (in the above sense).
Compute the 'inverse' of an N-dimensional array.
>>> a = np.eye(4*6)
... a.shape = (4, 6, 8, 3)
... ainv = np.linalg.tensorinv(a, ind=2)
... ainv.shape (8, 3, 4, 6)
>>> b = np.random.randn(4, 6)
... np.allclose(np.tensordot(ainv, b), np.linalg.tensorsolve(a, b)) True
>>> a = np.eye(4*6)
... a.shape = (24, 8, 3)
... ainv = np.linalg.tensorinv(a, ind=1)
... ainv.shape (8, 3, 24)
>>> b = np.random.randn(24)See :
... np.allclose(np.tensordot(ainv, b, 1), np.linalg.tensorsolve(a, b)) True
The following pages refer to to this document either explicitly or contain code examples using this.
numpy.linalg.tensorsolve
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