From: f97stdi@dd.chalmers.se (Staffan Dittmer)
Subject: math: passing function to function
Date: 30 Apr 2001 11:12:22 GMT
Date: 2001-04-30T11:12:22+00:00 [thread overview]
Message-ID: <9cjham$lu4$1@eol.dd.chalmers.se> (raw)
I'm trying to implement a root finder using the Brent method
but find myself getting stuck.
I cannot figure out how to pass a function
- the function to solve - as a parameter
to the solver.
I've tried using access to subprogram types to make something like
function solver(fun: access to function to solve; ...) return long_float;
which usually compiles ok, but exits raising
constraint error as soon as the code gets more involved than the
rudimentary examples given in the RM.
I would very much appreciate it if someone could point me to
some mathematical Ada source code where things like the above
are bound to be used.
The latest line of thought is that it might be possible to
make a generic construction like
generic
function fun(X:float) return float renames function_to_solve;
function solver(...) return float is
begin
......
but I have no greater hopes for this being even remotely possible.
Any other ideas?
/ Staffan Dittmer
next reply other threads:[~2001-04-30 11:12 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2001-04-30 11:12 Staffan Dittmer [this message]
2001-04-30 12:10 ` math: passing function to function Jacob Sparre Andersen
2001-04-30 12:57 ` Marc A. Criley
2001-04-30 13:51 ` Staffan Dittmer
2001-04-30 14:38 ` Ted Dennison
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox