[pypy-issue] [issue918] implement numpy.matrix in micronumpy

Peter tracker at bugs.pypy.org
Sun Oct 23 00:19:34 CEST 2011

New submission from Peter <p.j.a.cock at googlemail.com>:

Following should work on any version of bumpy, here using 1.5.1 on Python 2.6 on 
Mac OS X,

>>> import numpy
>>> m = numpy.matrix([[1,0],[0,1]])
>>> m
matrix([[1, 0],
        [0, 1]])

Fails on pypy 1.6,

$ pypy
Python 2.7.1 (dcae7aed462b, Aug 17 2011, 09:46:15)
[PyPy 1.6.0 with GCC 4.0.1] on darwin
Type "help", "copyright", "credits" or "license" for more information.
And now for something completely different: ``it's not a hack, it's a
>>>> import numpy
>>>> m = numpy.matrix([[1,0],[0,1]])
Traceback (most recent call last):
  File "<console>", line 1, in <module>
AttributeError: 'module' object has no attribute 'matrix'

The matrix class is generally similar to a 2 dimensional array in numpy except 
that the * operator does matrix multiplication rather than element wise 
operation. This is particularly useful in teaching classes, even if many serious 
bumpy users prefer to avoid the matrix class and work with raw arrays and the dot 

messages: 3373
nosy: pypy-issue
priority: bug
release: 1.6
status: unread
title: implement numpy.matrix in micronumpy

PyPy bug tracker <tracker at bugs.pypy.org>

More information about the pypy-issue mailing list