comp.lang.ada
 help / color / mirror / Atom feed
From: Colin Paul Gloster <Colin_Paul_Gloster@ACM.org>
Subject: Re: Help with translation: Fortran77 => Ada95
Date: Wed, 04 Jul 2001 19:17:12 +0200
Date: 2001-07-04T19:17:12+02:00	[thread overview]
Message-ID: <3B434F98.49B5EDF4@ACM.org> (raw)
In-Reply-To: 9hun38$t0m$1@ulysses.noc.ntua.gr

Sorry, I am tired and am not going to look through all of that now nor
really think of it in terms of the mathematical problem domain which could
produce a more elegant solution...especially the latter since it may just be
neater to forget about porting the FORTRAN and just write a function
which does as required.

However I have a suggestion, bearing in mind abhorrance of goto. Depending
on how mistaken I am, in F77 the continue keyword on line 110  is part of the
looping construct of do on line 105. I.e. m starts at one and each time it is
incremented it is incremented by the value of n (so m is not necessarily just
increased by one each time) and the loop is to be run one hundred and ten times
with continue signalling each next iteration.

-- more FORTRAN 77
-- Look for a small subdiagonal element.
--
  105   do 110 m=l,n
          if(m.eq.n) goto 120
          if(abs(e(m)).le.eps*(abs(zero(m))+abs(zero(m+1)))) goto 120
  110   continue
  120   p=zero(l)
-- more FORTRAN 77

So in your Ada95 version you could try something like (tidy this up
in to proper compilable Ada when you have decided what you will go for)
-- more F77 to be ported
MAX_LOOP_ITERATIONS := 110;
loop_iterations_so_far := 1; -- or 0, you may change this in your translating
m := 1;
while loop_iterations_so_far <= MAX_LOOP_ITERATIONS  and  m /= n  and (
abs(e(m)) <= eps*(abs(zero(m))+abs(zero(m+1))) ) loop
               m := m + n;
end loop;
-- more F77 to be ported

Bye,
Colin Paul Gloster




  parent reply	other threads:[~2001-07-04 17:17 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2001-07-04  9:19 Help with translation: Fortran77 => Ada95 N&J
2001-07-04 17:04 ` Warren W. Gay VE3WWG
2001-07-04 17:17 ` Colin Paul Gloster [this message]
2001-07-04 17:55 ` Jeffrey Carter
2001-07-05  1:33   ` Gary Scott
2001-07-05  6:03     ` tmoran
2001-07-06  1:35       ` Gary Scott
2001-07-05 17:36     ` Jeffrey Carter
2001-07-06  1:14       ` Gary Scott
2001-07-04 19:51 ` [SOLVED] " N&J
2001-07-04 23:25 ` GianLuigi Piacentini
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox