[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Raw data copy into Array
From: |
Paul Kienzle |
Subject: |
Re: Raw data copy into Array |
Date: |
Tue, 18 Mar 2003 07:03:45 -0500 |
User-agent: |
Mozilla/5.0 (Windows; U; Win 9x 4.90; en-US; rv:1.3a) Gecko/20021212 |
Jan Paral wrote:
Hello
i'm doing on isdat(physical data server) API for octave and i have big
problem.
When i get array of data ( double d[] ) i need to copy then into Array
by mempcy(). I don't want to copy them value by value.
Is it possible?
Yes. Preallocate your array using,
Matrix x(m,n);
You can then populate it directly using
double *xp = x.fortran_vec();
memcpy(xp,d,sizeof(*xp)*m*n);
You can usually eliminate the copy
altogether by passing xp to whatever
fills it (e.g., read), but you can't do it
if the library you are using returns you
an array that it allocates.
Paul Kienzle
address@hidden