contiguous memory for complex arrays in mex
Afficher commentaires plus anciens
Is it possible to allocate a complex array in a mex file and have the real and imaginary parts be contiguous with each other? I'm working with very large matrices and need to conserve memory and would like to not have to make a copy of the input matrices to get them into FORTRAN format. If the memory were contiguous, I could just rearrange the data into interleaved real and imaginary. I've already been able to pass in a real valued array from matlab and have LAPACK treat it as a complex (it just assumes the real and imaginary are interleaved), but this isn't exactly an elegant solution since I still have to write the data to a file and read it back into complex form. At that point it becomes useless to use MATLAB at all and I might as well just write a standalone program in C or FORTRAN. Any ideas if this can be done or am I out of luck?
Réponse acceptée
Plus de réponses (1)
the cyclist
le 13 Déc 2011
This page has info that looks like it might be helpful for what you are trying to do:
http://www.mathworks.com/help/techdoc/matlab_external/br_2m24-1.html#f32627
In particular, it mentions the fort2mat() and mat2fort() functions.
1 commentaire
Steve
le 13 Déc 2011
Catégories
En savoir plus sur Write C Functions Callable from MATLAB (MEX Files) dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!