First of all, I am new to this area of using Fortran and Matlab together, so please bear with me if I did not see the very obvious.
Here is my problem:
I have a Fortran 90 code which will calculate 2 large complex matrices A
and B
. I write these matrices onto a file, read it in MATLAB
and do some manipulations (solve for eigenvalues to be specific). The problem with this method is that it takes very long time to write and read data even in binary format. In some cases, the write and read operations are longer than actually solving the eigenvalue problem.
So, is there anyway I can directly pass the matrices generated by my Fortran 90 code to MATLAB without having to write and read?
I have read about call system
in Fortran but it doesn't seem to pass any arguments.
mex
file to call directly; since this puts both parts of the code into the Matlab memory space you don't have the time-consuming file reading and writing to contend with. If that doesn't appeal, don't discard the idea of using Matlab for calculating eigenvalues -- most of Matlab's core computational routines are implemented in compiled code, often using the same libraries (eg BLAS, MKL) that you'd call from Fortran and the speed differences are negligible when, that is, Matlab isn't faster. – High Performance Markexecute_command_line
, which is part of the Fortran 2008 standard and should considered in new code for future portability. gcc.gnu.org/onlinedocs/gfortran/… – jlokimlin