Thanks for putting your time into this. Right now I'm still using 0.3.11,
waiting for 0.4 to be the standard release. Then I'll dig into this and see
if I get it to do what I want without undue aggravation. I had the same
indexing issue with MatLab. Sometimes I miss the brute straightforwardness
of Fortran.

Larry


On Mon, Aug 17, 2015 at 1:16 PM, Matt Bauman <[email protected]> wrote:

> On Monday, August 17, 2015 at 1:03:17 PM UTC-4, Sisyphuss wrote:
>>
>> I read the "interfaces
>> <http://docs.julialang.org/en/latest/manual/interfaces/>" chapter of the
>> documentation today. I learned that, if you define an iterable as a subtype
>> of AbstractArray, with only defining three methods (including `size()`,
>> excluding `start()`), you can iterate on it just like iterate on an normal
>> Array.
>>
>
> Iteration should work just fine in 0.4 if OffsetArray defines its own
> `eachindex` method.
>
> Although more and more for loops are written generically using
> `eachindex`, there are still a lot of methods that use the old linear
> indexing standby:
>
> for i=1:length(A)
>    @inbounds A[i] = …
> end
>
> This is where things get really hairy for OffsetArrays.  That `@inbounds`
> propagates through to the inner array assignment, which will lead to silent
> data corruption and/or segfaults.  That's really why it shouldn't be an
> AbstractArray.
>

Reply via email to