Path: news.mathworks.com!newsfeed-00.mathworks.com!newsfeed2.dallas1.level3.net!news.level3.com!postnews.google.com!m73g2000hsh.googlegroups.com!not-for-mail
From: Rune Allnor <allnor@tele.ntnu.no>
Newsgroups: comp.soft-sys.matlab
Subject: Re: goto, again
Date: Fri, 27 Jun 2008 04:17:15 -0700 (PDT)
Organization: http://groups.google.com
Lines: 59
Message-ID: <c61a5ba5-9244-43e3-a91e-1fdd50492a81@m73g2000hsh.googlegroups.com>
References: <g3vjsl$asv$1@fred.mathworks.com> <g3vl26$khl$1@fred.mathworks.com> 
NNTP-Posting-Host: 212.17.141.54
Mime-Version: 1.0
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable
X-Trace: posting.google.com 1214565435 11828 127.0.0.1 (27 Jun 2008 11:17:15 GMT)
X-Complaints-To: groups-abuse@google.com
NNTP-Posting-Date: Fri, 27 Jun 2008 11:17:15 +0000 (UTC)
Complaints-To: groups-abuse@google.com
Injection-Info: m73g2000hsh.googlegroups.com; posting-host=212.17.141.54; 
User-Agent: G2/1.0
X-HTTP-UserAgent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; .NET 
Xref: news.mathworks.com comp.soft-sys.matlab:476225


On 27 Jun, 10:28, "Steve Amphlett" <Firstname.Lastn...@Where-I-
Work.com> wrote:

> We have a lot of requests here for converting terse and
> instantly understandable ML code into C, C++ or Fortran. =A0
> They are understandable - many algorithms are prototyped in
> ML, in my view the best enviroment available for this sort
> of thing. =A0C or Fortran code to do what ML can do in one
> line is always going to be a lot bigger, loopy and not
> instantly obvious what problem it has been written to solve.

Not necessarily. If the C or Fortran programs are well
structured, one can write code that looks virtually
indistinguishable from Matlab.

The big difference lies in the craftmanship of the programmer.
Poor programmers write poor code, no matter what language
they work in.

> Why would anyone want to do the reverse? =A0What is the point
> in taking a Fortran solution to a problem and cloning it in
> ML code?

The obvious reason is maintainability and portability.
I can do what I want as long as I have matlab and C++
available. I don't have any particular desire to start
messing with one of the gazillions of fortran standards
that are around; whatever fortran code one happens to
come across is certain *not* to conform to any of them.

Of course, once one does the reverese engineering one
should make the main effort to get an algorithm pseudocode,
so that one understands its purpose, and then implement
it later in whatever language one likes.

>=A0Why not just write a line of ML to solve the
> problem?

That would just repeat the problem. At some point one hits
the ceiling of what matlab is useful for (and that point
happens a lot sooner than most matlab users like), and one
has to port from matlab to something else.

If a program or routine is worth the while, then it is
inevitable that some time down the line somebody want
a C, C++, or Java or whatever version, and one needs to
convert from matlab.

That's just how things go.

Far better then, to have a pseudocode type of description
of the algorithm and implement it from scratch in the
target language.

>=A0The ultimate irony is that it's very likely that
> ML will use a highly optimised Fortran library itself,
> possibly the exact same code.

Rune