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: Mon, 8 Mar 2010 07:17:41 +0100

On Mon, Mar 8, 2010 at 12:08 AM, Søren Hauberg <address@hidden> wrote:
> søn, 07 03 2010 kl. 21:43 +0100, skrev Jaroslav Hajek:
>> On Sun, Mar 7, 2010 at 7:34 PM, Søren Hauberg <address@hidden> wrote:
>> > 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.
>> >
>>
>> You can do the above trick only with constant sizes anyway, so it
>> doesn't seem much useful to me.
>
> You mean the 'sizeof' trick, right?
>
>> But the constructor could be potentially useful, so why not. It should
>> be trivial, if you want to do it.
>
> How about the attached changeset? With this, I can do
>
>    octave_idx_type tmp_size [] = {4, 5, 6, 7};
>    const dim_vector size (tmp_size, 4);
>    Array<double> A (size, 0);
>
> I was a bit confused about the use of the 'explicit' keyword in the
> other constructors. I thought this keyword only made a difference for
> constructors with one input argument, but I see it is used with all
> constructors.
>
> Søren
>

Seems OK to me.


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