contiguous memory for complex arrays in mex
이전 댓글 표시
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?
채택된 답변
추가 답변 (1개)
the cyclist
2011년 12월 13일
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.
카테고리
도움말 센터 및 File Exchange에서 Write C Functions Callable from MATLAB (MEX Files)에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!