[PYTHON MATRIX-SIG] fromFunction...

David Ascher da@maigret.cog.brown.edu
Sun, 11 Aug 1996 17:09:53 -0400 (EDT)

In 1.0a1, fromFunction is absent.  I miss it. =)  Now, the last we
talked about this, there were still some issues that had to be hacked
out, and Konrad pseudo-volunteered, but since then he took a vacation, a
job, moved, and is now somewhat netisolated.  Does anyone else feel up
to the task?  Or Konrad, are you still interested/able?

My requirements are fairly simple.  I want to do things like

	def f(x, y): return sin(x) + cos(y) 	# (1)
	a = fromFunction((200,200), f)

as efficiently as possible.  Maybe there are much better ways than
what I just wrote, but it sure was simple.  If someone can show me
how to do the above without fromFunction, that'd be nice too.  I
do think that the general notion is very useful, and I'd like to see it

One problem with the 0.36 version of fromFunction is that

	def f(x,y): return x			# (2)
	a = fromFunction((200,200), f)

returns something which is of shape (200,1), not (200,200), which is
what I'd expected.

Surprisingly (to the naive user at least),

	def f(x,y): return x + 0*y		# (3)
	a = fromFunction((200,200), f)

returns just what I expected (2) would above.



MATRIX-SIG  - SIG on Matrix Math for Python

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