[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: More efficient MEX or MEX-like interface
From: |
John W. Eaton |
Subject: |
Re: More efficient MEX or MEX-like interface |
Date: |
Tue, 14 Oct 2008 14:29:07 -0400 |
On 30-Sep-2008, Jaroslav Hajek wrote:
| I guess the main reason why Mathowrks chose this was the absence of
| complex type from C in the past.
It's always been possible to use an array of structs, so lack of a
built-in complex type was probably not it.
I think the original Fortran version of Matlab used separate arrays
for real and imaginary parts. Perhaps that was because prior to
Fortran 77 (I think) did not have a complex type. EISPACK also used
separate arrays, though LINPACK did not.
But anyway, there is another advantage, and that is that it doesn't
require any copying of data to convert a real object to a complex
object. You just allocate another array for the imaginary part, but
you don't have to copy the real data into an interleaved storage
scheme.
jwe