Movatterモバイル変換


[0]ホーム

URL:


SciPy

numpy.unravel_index

numpy.unravel_index(indices,dims,order='C')

Converts a flat index or array of flat indices into a tupleof coordinate arrays.

Parameters:
indices:array_like

An integer array whose elements are indices into the flattenedversion of an array of dimensionsdims. Before version 1.6.0,this function accepted just one index value.

dims:tuple of ints

The shape of the array to use for unravelingindices.

order:{‘C’, ‘F’}, optional

Determines whether the indices should be viewed as indexing inrow-major (C-style) or column-major (Fortran-style) order.

New in version 1.6.0.

Returns:
unraveled_coords:tuple of ndarray

Each array in the tuple has the same shape as theindicesarray.

Examples

>>>np.unravel_index([22,41,37],(7,6))(array([3, 6, 6]), array([4, 5, 1]))>>>np.unravel_index([31,41,13],(7,6),order='F')(array([3, 6, 6]), array([4, 5, 1]))
>>>np.unravel_index(1621,(6,7,8,9))(3, 1, 4, 1)

Previous topic

numpy.ravel_multi_index

Next topic

numpy.diag_indices

Quick search

  • © Copyright 2008-2018, The SciPy community.
  • Last updated on Jul 24, 2018.
  • Created usingSphinx 1.6.6.

[8]ページ先頭

©2009-2025 Movatter.jp