[PYTHON MATRIX-SIG] missing (?) feature

David Ascher da@maigret.cog.brown.edu
Sat, 9 Mar 1996 16:05:19 -0500 (EST)


I came accross a feature I'd like to see in the "choose"
command/function (or whatever else it gets called =):

Basically, my problem is that I want to do something like:

	ranf = Ranf.ranf
	age = age + 1
	x = age.greater(MAX_AGE).choose(x, ranf)
	y = age.greater(MAX_AGE).choose(y, ranf)
	age = age.greater(MAX_AGE).choose(age, 0)

so that the x and y values of 'old' coordinates get replaced w/ new
coordinates.  The new coordinates are typically based on random numbers.
With the current implementation I have to do:

	x = age.greater(MAX_AGE).choose(x, random_sample(NUM_DOTS))

which is wasteful since on a given iteration, only a few of the dots are
likely to be "too old".  But a new random_sample() array is generated
each time anyway.

--david

=================
MATRIX-SIG  - SIG on Matrix Math for Python

send messages to: matrix-sig@python.org
administrivia to: matrix-sig-request@python.org
=================