[Numpy-discussion] array of matrices
Gael Varoquaux
gael.varoquaux at normalesup.org
Wed Apr 8 03:56:12 EDT 2009
On Wed, Apr 01, 2009 at 01:40:54AM +0000, Hans-Andreas Engel wrote:
> By the way, matrix multiplication is one of the testcases for the generalized
> ufuncs in numpy 1.3 -- this makes playing around with it easy:
> In [1]: N = 10; a = randn(N, 4, 4); b = randn(N, 4, 4)
> In [2]: import numpy.core.umath_tests
> In [3]: (numpy.core.umath_tests.matrix_multiply(a, b) == [dot(ai, bi) for (ai,
> bi) in zip(a, b)]).all()
> Out[3]: True
Hey Hans-Andreas,
I am jumping on your message to stress that generalized ufunc realy need
a bit more documentation. I have been trying to push a few collegues to
use them, but I am getting not traction, because they are unsure of what
generalized ufuncs do.
I wasn't aware of the example you mentioned. It certainly is useful.
Maybe it would be useful to add it as an example to the generalized-ufunc
documnetation embryo
(http://docs.scipy.org/numpy/docs/numpy-docs/reference/generalized_ufuncs.rst),
with a discussion of the example. If you, or anyone else who knows
generalized ufuncs, register on the above webpage, I can give rights to
edit the page, so that you can improve the docs.
Cheers,
Gaël
More information about the NumPy-Discussion
mailing list