help-octave
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Efficiently iterating over Nd array in oct file


From: Søren Hauberg
Subject: Re: Efficiently iterating over Nd array in oct file
Date: Tue, 26 Apr 2011 09:47:40 +0200

man, 25 04 2011 kl. 18:13 -0500, skrev Jordi Gutiérrez Hermoso:
> 2011/4/25 Søren Hauberg <address@hidden>:
> > man, 25 04 2011 kl. 09:24 -0500, skrev Jordi Gutiérrez Hermoso:
> >> I'm agonising over an implementation detail of bwlabeln. I need to
> >> iterate over each voxel of boolNDArray *and* consider each voxel's
> >> neighbours. If I use a linear index and just iterate up to
> >> boolNDArray::nelem(), I would have to call ind2sub for each pixel in
> >> order to consider its neighbours, and I'm trying to avoid that call. I
> >> was hoping for something like Array<idx_vector>::next() if such a
> >> function existed or to impement it myself. Any other suggestions?
> >
> > I never found a good way of doing it :-( You can see what we did in
> > 'convn' -- I think it is similar to your needs.
> 
> Thanks, Søren. I guess you mean the gymnastics around
> liboctave/oct-convn.cc:85 ?

Indeed I do. I did the first (brain-dead) implementation and Jaroslav
made it quite a bit faster using the "gymnastics" (they're a bit hard to
read, but I remember them being quite a bit faster than the
straight-forward implementation.

Søren



reply via email to

[Prev in Thread] Current Thread [Next in Thread]