MCPcopy Index your code
hub / github.com/python/cpython / getindex

Function getindex

Lib/test/test_buffer.py:341–346  ·  view source on GitHub ↗

Convert multi-dimensional index to the position in the flat list.

(ndim, ind, strides)

Source from the content-addressed store, hash-verified

339 return product(*iterables)
340
341def getindex(ndim, ind, strides):
342 """Convert multi-dimensional index to the position in the flat list."""
343 ret = 0
344 for i in range(ndim):
345 ret += strides[i] * ind[i]
346 return ret
347
348def transpose(src, shape):
349 """Transpose flat item list that is regarded as a multi-dimensional

Callers 1

transposeFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…