Movatterモバイル変換


[0]ホーム

URL:


SciPy

numpy.linalg.tensorsolve

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

Coefficient tensor, of shapeb.shape+Q.Q, a tuple, equalsthe shape of that sub-tensor ofa consisting of the appropriatenumber of its rightmost indices, and must be such thatprod(Q)==prod(b.shape) (in which sensea is said to be‘square’).

b : array_like

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

axes : tuple of ints, optional

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

Returns:

x : ndarray, shape Q

Raises:

LinAlgError

Ifa is singular or not ‘square’ (in the above sense).

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

Previous topic

numpy.linalg.solve

Next topic

numpy.linalg.lstsq

  • © Copyright 2008-2009, The Scipy community.
  • Last updated on Jun 10, 2017.
  • Created usingSphinx 1.5.3.

[8]ページ先頭

©2009-2025 Movatter.jp