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: Carlo de Falco
Subject: Re: Allocating N-dimensional Array in C++
Date: Sat, 6 Mar 2010 20:10:16 +0100


On 6 Mar 2010, at 19:53, Søren Hauberg 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);
   size (0) = 1;
   size (1) = 7;
   size (2) = 3;
   size (3) = 2;

   NDArray A (size);

Try

 dim_vector size; idxa.resize (4);
   size (0) = 1;
   size (1) = 7;
   size (2) = 3;
   size (3) = 2;

   NDArray A (size);


This, however, seems to create a 1x7 array. So, what is the right way of accomplishing this? Also, should I be using 'NDArray' or 'Array<double>'
these days?

Thanks,
Søren


c.


reply via email to

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