[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
RE: Array Initialisation
From: |
Paul Keir |
Subject: |
RE: Array Initialisation |
Date: |
Fri, 30 Apr 2010 14:10:12 +0100 |
Ok, thanks.
-----Original Message-----
From: Jaroslav Hajek [mailto:address@hidden
Sent: 30 April 2010 13:10
To: Paul Keir
Cc: address@hidden
Subject: Re: Array Initialisation
On Thu, Apr 29, 2010 at 10:53 AM, Paul Keir <address@hidden> wrote:
> Hi,
>
>
>
> When using the Octave C++ libs, is it possible to initialise an array with a
> POD array which is already allocated?
>
>
>
> Perhaps something like:
>
>
>
> double data[W*H];
>
> Array2<double> a(data,W,H);
>
>
>
> Or maybe:
>
>
>
> Array2<double> b(W,H);
>
> b.set(data,W*H);
>
>
>
> I guess that might interfere with the reference counting in ArrayRep?
>
>
>
> Many thanks,
>
> Paul
>
If what you mean is to avoid a copy, then no; this is not possible;
yes, the reason is memory management. Copying a raw data to an array
can be done through fortran_vec.
--
RNDr. Jaroslav Hajek, PhD
computing expert & GNU Octave developer
Aeronautical Research and Test Institute (VZLU)
Prague, Czech Republic
url: www.highegg.matfyz.cz
The University of Glasgow, charity number SC004401