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

Home » Public Forums » archive » alternative to execute
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Return to the default flat view Create a new topic Submit Reply
Re: alternative to execute [message #47266 is a reply to message #47205] Wed, 01 February 2006 15:03 Go to previous messageGo to previous message
news.qwest.net is currently offline  news.qwest.net
Messages: 137
Registered: September 2005
Senior Member
"greg michael" <greg.michael@gmail.com> wrote in message
news:1138732984.579226.255440@f14g2000cwb.googlegroups.com.. .
>
> I'm trying to think up a good way to implement a user-defined function
> which would run in the IDL VM. The function might involve any of about
> 300 similar 2-d arrays, each of which is quite expensive to generate.
> So I thought to obtain the function as a string, scan it to see which
> arrays are needed, generate them, and then apply the function with
> 'execute'. But 'execute' is excluded from the VM.
>
> A typical function might look like:
>
> result = b123 / b100 - .9 * b050 / b035
>
> Without execute, I can only think to attempt to write some kind of
> arithmetic interpreter. Would anyone have a suggestion for a way to get
> IDL to do this more directly?
>

From your example equations, it seems that all you want is a calculator
that operates on arbitrary arrays. So, my first impulse would be to
greatly restrict the number of functions.
You don't need to have a function for every possible expression.

How about a function for addition, subtraction, multiplication and division,
each accepting 2 inputs and returning one output.
Of course, you can add some simple functions like sqrt to it easy enough.

Then save the result as a new array, and allow further operations on it.
If you had a "workspace" (like 'memory' on a calculator) where the user
could save their results, then it is really easy to make the full
expression.
Each term in a complex expression becomes one entry in the memory,
then you add them all together to get the final result.


Cheers,
bob
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Re: Speeding up multiple file reading
Next Topic: Speeding up multiple file reading

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

Current Time: Sun Nov 30 10:15:20 PST 2025

Total time taken to generate the page: 0.72172 seconds