MCPcopy Index your code
hub / github.com/RustPython/RustPython / getindex

Function getindex

Lib/test/test_buffer.py:329–334  ·  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

327 return product(*iterables)
328
329def getindex(ndim, ind, strides):
330 """Convert multi-dimensional index to the position in the flat list."""
331 ret = 0
332 for i in range(ndim):
333 ret += strides[i] * ind[i]
334 return ret
335
336def transpose(src, shape):
337 """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