Re: Matlab -> Fortran



On Feb 27, 6:30 pm, "Beliavsky" <beliav...@xxxxxxx> wrote:
On Feb 27, 5:55 pm, Gib Bogle <g.bo...@xxxxxxxxxxxxxxxxxxxxxx> wrote:

Is there a program to convert Matlab code to Fortran?

Thanks
Gib

Yes, there is matlab2fmexhttps://sourceforge.net/projects/matlab2fmex/
. I think it requires Matlab to run.

Your question is asked occasionally on comp.soft-sys.matlab, where
NZTideman wrote as follows:

"I've transferred a lot of Fortran programs to Matlab (and also the
reverse).
The best way I've found is to do it by hand, translating line by line
in an editor, changing "do" to "for" and "end do" to "end", etc.
If your Fortran is 90/95, it's pretty easy because the vector
operations translate directly, but if you have Fortran IV, with
goto's
and computed goto's, then it's very difficult to do it by hand. I've
usually found that in that case, it's better to start over in Matlab."

If you go the manual route you may find useful the "language tables"
of John Akin athttp://www.owlnet.rice.edu/%7Emech517/F90_docs/tables.pdf

which shows the equivalent constructs in C++ Fortran 90, Fortran 77,
and Matlab.

I also do-it-by-hand occationally, but always translate matlab to
fortran. When the numerical library is properly installed, it is not
very hard in most cases to translate from matlab to fortran.

There is an interesting project called Falcon (http://
www.csrd.uiuc.edu/falcon/falcon.html).

" It uses MATLAB as the source language and generates Fortran 90 plus
directives for parallelization, MATLAB, and pC++ as target
languages."

However, the page has not been updated since Feb 2, 1996. I could not
find the source code or binary online.

.



Relevant Pages

  • Re: MATLAB <-> FORTRAN
    ... When you do A\b it just calls the basic solvers Matlab knows, ... in some cases Gauss Elimination. ... In this case you can find a Gauss Solver, ... I've bitten the bullet and converted to Fortran ...
    (comp.soft-sys.matlab)
  • Re: Matlab Vectorisation Speed - How is it done in c++?
    ... Beating the performance of vectorized Matlab code is very ... Matlab makes calls to optimized C and Fortran libraries ... Use optimization level 3 on numerical code and level 2 on non- ...
    (comp.soft-sys.matlab)
  • Re: exploring a fortran(?) library
    ... Well, matlab language is column-major, ... They use column-major as I stated. ... > - atlas and lapack are available in C or fortran, ... > the original language, and column-major. ...
    (comp.lang.fortran)
  • Re: Calling MATLAB from Fortran
    ... Fortran saves the data which Matlab m-file needs and then Matlab would read them as input from the file and after calculation save then in a file for Fortran. ... returns mxArray * ...
    (comp.soft-sys.matlab)
  • Re: [OT?] Matlab usage, when, where, why?
    ... >> programming language after that. ... > While you were definitely at the tail end of its heydey in '95, Fortran ... > poor formatting. ... Once matlab was available on all three platforms, late 96, I ditched ...
    (comp.soft-sys.matlab)