[Thread Prev][Thread Next][Index]

forcing multiple evaluation of a function



Hi ferreters,

As part of a Monte Carlo simulation, I've written an external function
which operates on the given data based on some random numbers it
generates.  I want to evaluate the function several times on the SAME
data, but Ferret doesn't recognise that it needs to update the values.
Here's an example:
(The external function is called "omegasort_exc" and it returns two
scalars indexed on the k axis)

If I interactively LIST the result several times, the function gets
re-evaluated:

yes? list omegasort_exc(om,pr)
             OMEGASORT_EXC(OM,PR)
             LATITUDE: 3.8N to 5.7N
 1 / 1: -0.001003
 2 / 2:  0.000016 
yes? list omegasort_exc(om,pr)
             OMEGASORT_EXC(OM,PR)
             LATITUDE: 3.8N to 5.7N
 1 / 1: -0.001054
 2 / 2:  0.000014

(the result changes)

But within a loop:

yes? repeat/l=1:2 list omegasort_exc(om,pr)
             OMEGASORT_EXC(OM,PR)
             LATITUDE: 3.8N to 5.7N
 1 / 1: -0.001067
 2 / 2:  0.000014
             OMEGASORT_EXC(OM,PR)
             LATITUDE: 3.8N to 5.7N
 1 / 1: -0.001067
 2 / 2:  0.000014

(the result does not change)

How can I force Ferret to re-evaluate the function on each pass through
the loop?

Thanks for any help,

Brian Rose




[Thread Prev][Thread Next][Index]

Dept of Commerce / NOAA / OAR / PMEL / TMAP

Contact Us | Privacy Policy | Disclaimer | Accessibility Statement