bundles / scipy 1.17.1 / scipy / sparse / _construct / permute_dims
function
scipy.sparse._construct:permute_dims
source: /scipy/sparse/_construct.py :131
Signature
def permute_dims ( A , axes = None , copy = False ) Summary
Permute the axes of the sparse array A to the order axes.
Parameters
A: sparse arrayaxes: tuple or list of ints, optionalIf specified, it must be a tuple or list which contains a permutation of
[0, 1, ..., N-1]whereNisA.ndim. The ith axis of the returned array will correspond to the axis numberedaxes[i]of the input. If not specified, defaults torange(A.ndim)[::-1], which reverses the order of the axes.copy: bool, optional (default: False)Whether to return the permutation as a copy. If False, an in-place permutation is provided if possible depending on format.
Returns
out: sparse array in COO formatA copy of
Awith permuted axes.
Raises
: ValueErrorIf provided a non-integer or out of range
[-N, N-1]axis, whereNisA.ndim.
Examples
from scipy.sparse import coo_array, permute_dims A = coo_array([[[1, 2, 3], [2, 0, 0]]]) A.shape permute_dims(A, axes=(1, 2, 0)).shape✓
Aliases
-
scipy.sparse.permute_dims