[Numpy-discussion] convert strides/shape/offset into nd index?
Tue Dec 1 10:06:41 CST 2009
> Not to be a downer, but this problem is technically NP-complete. The
> so-called "knapsack problem" is to find a subset of a collection of
> numbers that adds up to the specified number, and it is NP-complete.
> Unfortunately, it is exactly what you need to do to find the indices
> to a particular memory location in an array of shape (2,2,...,2).
Ha ha, right -- that is the knapsack problem isn't it.
Oh well... I'll just require fortran- or C-style strided arrays, for
which case it is easy to unravel offsets into indices.
More information about the NumPy-Discussion