help-octave
[Top][All Lists]
Advanced

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

Re: Allocating N-dimensional Array in C++


From: Søren Hauberg
Subject: Re: Allocating N-dimensional Array in C++
Date: Sun, 07 Mar 2010 10:34:50 -0800

søn, 07 03 2010 kl. 05:49 +0100, skrev Jaroslav Hajek:
> On Sat, Mar 6, 2010 at 7:53 PM, Søren Hauberg <address@hidden> wrote:
> > Hi All
> >
> > I can't seem to figure out how to use 'dim_vector' in C++ (using the
> > development sources). Say, I want to create a 4 dimensional array of
> > size 1x7x3x2, then I would have thought I should do something like
> >
> >    dim_vector size (4, 1);
> 
> This is a direct constructor for 2D dim-vector. Use
> 
> dim_vector size = dim_vector::alloc (4);

Okay, thanks. How do you feel about having an API for creating higher
dimensional dim_vector's that would look something like this

  const octave_idx_type tmp_size [] = {1, 7, 3, 2};
  const dim_vector size (tmp_size, sizeof (tmp_size));

? To me, the current approach seems a bit tedious when working with more
than 3 dimensions.

> > Also, should I be using 'NDArray' or 'Array<double>' these days?
>
> You can use both, it depends on whether you need the extra methods of
> NDArray or not.

Ahh, I see this has all sorts of extra methods, such as doing Fourier
stuff.

Thanks,
Søren



reply via email to

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