For Programmers: Free Programming Magazines  


Home > Archive > Fortran > February 2007 > Matlab -> Fortran









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author Matlab -> Fortran
Gib Bogle

2007-02-27, 7:09 pm

Is there a program to convert Matlab code to Fortran?

Thanks
Gib
Paul van Delst

2007-02-27, 7:09 pm

Gib Bogle wrote:
> Is there a program to convert Matlab code to Fortran?


Back at my uni in sandgroper territory it used to be called "Programming in Fortran 251".

:o)


cheers,

paulv

--
Paul van Delst Ride lots.
CIMSS @ NOAA/NCEP/EMC Eddy Merckx
Beliavsky

2007-02-27, 7:09 pm

On Feb 27, 5:55 pm, Gib Bogle <g.bo...@auckland.no.spam.ac.nz> wrote:
> Is there a program to convert Matlab code to Fortran?
>
> Thanks
> Gib


Yes, there is matlab2fmex https://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 at
http://www.owlnet.rice.edu/%7Emech5...docs/tables.pdf

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

ben

2007-02-27, 10:08 pm

On Feb 27, 6:30 pm, "Beliavsky" <beliav...@aol.com> wrote:
> On Feb 27, 5:55 pm, Gib Bogle <g.bo...@auckland.no.spam.ac.nz> wrote:
>
>
>
> 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.

Beliavsky

2007-02-27, 10:08 pm

On Feb 27, 8:52 pm, "ben" <laser...@gmail.com> wrote:

<snip>

> 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.


May I ask which numerical library are you talking about? LAPACK?

Tom Micevski

2007-02-28, 8:07 am

Paul van Delst wrote:
> Back at my uni in sandgroper territory


was that wa or sa? (i can't remember --- since they "rebranded" the
sheffield shield to the stupid milk cup, you don't hear those old names
anymore on the sports report.)
Dr Ivan D. Reid

2007-02-28, 8:07 am

On Wed, 28 Feb 2007 22:44:34 +1100, Tom Micevski <none@none.au>
wrote in <45e56b24$0$1146$61c65585@un-2park-reader-01.sydn.pipenetworks.com.au>:
> Paul van Delst wrote:
[color=darkred]
> was that wa or sa? (i can't remember --- since they "rebranded" the
> sheffield shield to the stupid milk cup, you don't hear those old names
> anymore on the sports report.)


SA were croweaters, nicht wahr?

--
Ivan Reid, School of Engineering & Design, _____________ CMS Collaboration,
Brunel University. Ivan.Reid@[brunel.ac.uk|cern.ch] Room 40-1-B12, CERN
KotPT -- "for stupidity above and beyond the call of duty".
ben

2007-02-28, 7:07 pm

On Feb 27, 9:01 pm, "Beliavsky" <beliav...@aol.com> wrote:
> On Feb 27, 8:52 pm, "ben" <laser...@gmail.com> wrote:
>
> <snip>
>
>
> May I ask which numerical library are you talking about? LAPACK?


NAG is very easy to use, but it is not free. The cern library is also
good and free. If you prefer those PACKs, you need to download and
test those functions. It is not that easy in my opinion. For example,
LAPACK heavily depends on BLAS, but compiling BLAS from goto's blas or
using atlas needs some knowledge and experience.

Paul van Delst

2007-02-28, 7:07 pm

Dr Ivan D. Reid wrote:
> On Wed, 28 Feb 2007 22:44:34 +1100, Tom Micevski <none@none.au>
> wrote in <45e56b24$0$1146$61c65585@un-2park-reader-01.sydn.pipenetworks.com.au>:
>
>
> SA were croweaters, nicht wahr?


yep. still are. :o)


--
Paul van Delst Ride lots.
CIMSS @ NOAA/NCEP/EMC Eddy Merckx
Tom Micevski

2007-02-28, 7:07 pm

Paul van Delst wrote:
> Dr Ivan D. Reid wrote:

so they are (i was trying to remember the other names last night, but
couldn't).
[color=darkred]
> yep. still are. :o)
>

Gib Bogle

2007-02-28, 7:07 pm

Beliavsky wrote:

> On Feb 27, 5:55 pm, Gib Bogle <g.bo...@auckland.no.spam.ac.nz> wrote:
>
>
>
> Yes, there is matlab2fmex https://sourceforge.net/projects/matlab2fmex/
> . I think it requires Matlab to run.


Thanks, I've passed this info on to the student concerned.
------------ And now a word from our sponsor ----------------------
For a quality mail server, try SurgeMail, easy to install,
fast, efficient and reliable. Run a million users on a standard
PC running NT or Unix without running out of power, use the best!
---- See http://netwinsite.com/sponsor/sponsor_surgemail.htm ----
Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com