octave-maintainers
[Top][All Lists]
Advanced

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

Re: Array slicing in Octave


From: Jordi Gutiérrez Hermoso
Subject: Re: Array slicing in Octave
Date: Tue, 10 May 2011 23:03:26 -0500

On 6 May 2011 03:20, Hamid 2C <address@hidden> wrote:
> I would like to know how array slicing is implemented in Octave.
> Any comment/suggestion on the direction where I should look at would
> be really appreciated.

The answer isn't simple. The general type in liboctave/ is idx_vector
that is actually a polymorphic type for representing single indices,
range slices, and full colons. So for example for the base Array class
in liboctave/Array.h, the index(...) family of functions are in charge
of this work. You can see the definition for them near
liboctave/Array.cc:703 and near liboctave/Array.cc:1037 (hg changeset
6b2f14af2360).

Note that sparse matrices must naturally have their own indexing and
slicing rules, so its own index(...) functions are implemented near
liboctave/Sparse.cc:1340.

That should be enough to get you started. I think the best way to
really learn this is to run Octave in a debugger and put breakpoints
inside the functions I hinted to above; that way you can really see
what's going on.

HTH,
- Jordi G. H.


reply via email to

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