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: Jaroslav Hajek
Subject: Re: Allocating N-dimensional Array in C++
Date: Sun, 7 Mar 2010 05:49:29 +0100

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);

>    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?
>

You can use both, it depends on whether you need the extra methods of
NDArray or not.

-- 
RNDr. Jaroslav Hajek, PhD
computing expert & GNU Octave developer
Aeronautical Research and Test Institute (VZLU)
Prague, Czech Republic
url: www.highegg.matfyz.cz



reply via email to

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