For once I think that Matlab has the better names.

On Tue, Dec 16, 2014 at 4:12 PM, Isaiah Norton <[email protected]>
wrote:

> I think the equivalents are ind2sub and sub2ind
>
> On Tue, Dec 16, 2014 at 3:57 PM, Christoph Ortner <
> [email protected]> wrote:
>>
>> Does Julia have an analogue of Python's   `numpy.unravel_index`  and  `
>> numpy.ravel_multi_index
>> <http://docs.scipy.org/doc/numpy/reference/generated/numpy.ravel_multi_index.html>`
>>   ; see
>>
>> http://docs.scipy.org/doc/numpy/reference/generated/numpy.unravel_index.html
>>
>> Probably easy to write, but if there is an existing efficient
>> implementation then I'd like to use it.
>>
>> My application is that I have an array A,  of which I do not know the
>> dimensionality beforehand. Hence I loop
>>
>> for n = 1:length(A)
>>      . . .
>> end
>>
>> but can still access the multi-index corresponding to n inside the loop.
>>
>> Thank you,
>>      Christoph
>>
>>
>>

Reply via email to