comp.lang.idl-pvwave archive
Messages from Usenet group comp.lang.idl-pvwave, compiled by Paulo Penteado

Home » Public Forums » archive » pass parameters to a function when calling BROYDEN or NEWTON routines
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Switch to threaded view of this topic Create a new topic Submit Reply
pass parameters to a function when calling BROYDEN or NEWTON routines [message #85063] Fri, 28 June 2013 07:12 Go to next message
Tasos is currently offline  Tasos
Messages: 4
Registered: February 2012
Junior Member
Hi there,

following the example in the BROYDEN reference page in IDL, I first determine the non-linear system of equations by creating a function which then is called by the BROYDEN function. The problem I am facing here is that I would like to pass parameters in the first function while calling the BROYDEN function.

For example:

first determine the equations
FUNCTION broydenfunc, X
...
END

then call the broyden function
result = BROYDEN(X, 'broydenfunc')

So my question again is how I can pass parameters to the BROYDENFUNC function when calling the main BROYDEN function? I would like to keep the BROYDENFUNC in a loop where different parameters are passed every time.

Thanks in advance!
T
Re: pass parameters to a function when calling BROYDEN or NEWTON routines [message #85064 is a reply to message #85063] Fri, 28 June 2013 07:22 Go to previous messageGo to next message
Helder Marchetto is currently offline  Helder Marchetto
Messages: 520
Registered: November 2011
Senior Member
On Friday, June 28, 2013 4:12:16 PM UTC+2, tas....@gmail.com wrote:
> Hi there,
>
>
>
> following the example in the BROYDEN reference page in IDL, I first determine the non-linear system of equations by creating a function which then is called by the BROYDEN function. The problem I am facing here is that I would like to pass parameters in the first function while calling the BROYDEN function.
>
>
>
> For example:
>
>
>
> first determine the equations
>
> FUNCTION broydenfunc, X
>
> ...
>
> END
>
>
>
> then call the broyden function
>
> result = BROYDEN(X, 'broydenfunc')
>
>
>
> So my question again is how I can pass parameters to the BROYDENFUNC function when calling the main BROYDEN function? I would like to keep the BROYDENFUNC in a loop where different parameters are passed every time.
>
>
>
> Thanks in advance!
>
> T

With a common block?

FUNCTION broydenfunc, X
COMMON broydenfuncParams, p0, p1
...
END


and then call like this:
COMMON broydenfuncParams, p0, p1 ; this should be at the beginning
for i =0,9 do begin
p0=i
p1=i*2
result = BROYDEN(X, 'broydenfunc')
endfor

Hope it helps,
Helder
Re: pass parameters to a function when calling BROYDEN or NEWTON routines [message #85065 is a reply to message #85063] Fri, 28 June 2013 07:22 Go to previous message
Kenneth Bowman is currently offline  Kenneth Bowman
Messages: 86
Registered: November 2006
Member
On 2013-06-28 14:12:16 +0000, tas.mrgns@gmail.com said:

> Hi there,
>
> following the example in the BROYDEN reference page in IDL, I first
> determine the non-linear system of equations by creating a function
> which then is called by the BROYDEN function. The problem I am facing
> here is that I would like to pass parameters in the first function
> while calling the BROYDEN function.
> For example:
>
> first determine the equations
> FUNCTION broydenfunc, X
> ...
> END
> then call the broyden function
> result = BROYDEN(X, 'broydenfunc')
>
> So my question again is how I can pass parameters to the BROYDENFUNC
> function when calling the main BROYDEN function? I would like to keep
> the BROYDENFUNC in a loop where different parameters are passed every
> time.
>
> Thanks in advance!
> T

The usual way to do this is through a common block.

Ken Bowman
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: endi and endif
Next Topic: EYE property in plot3d

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ] [ PDF ]

Current Time: Wed Oct 08 13:49:42 PDT 2025

Total time taken to generate the page: 0.00494 seconds