[Numpy-discussion] Matlab is a tool for doing numerical computations with matrices and vectors.

Colin J. Williams cjw at sympatico.ca
Mon Feb 21 10:22:05 CST 2005


Travis Oliphant wrote:

>
>> The Numeric/numarray focus is on multidimensional arrays.
>>
>> Some years ago, Huaiyu Zhu made a number of postings advocating the 
>> introduction of a Python-based system permitting the usual matrix 
>> operations. It seems that the culmination of these 
>
>
>> efforts was Matpy (http://matpy.sourceforge.net/), which is not 
>> currently active.
>
>
>
> I remember his work. I really liked many of his suggestions, though it 
> took him a while to recognize that a Matrix class has been distributed 
> with Numeric from very early on. 

numpy.pdf dated 03-07-18 has

    "For those users, the Matrix class provides a more intuitive
    interface. We defer discussion of the Matrix class until later."


Page 51 of that document has:

    "Subclassing
    Subclassing Numeric arrays is not possible due to a limitation of
    Python. The approach taken in the Masked
    Array facility (“Masked Arrays” on page 97) is one answer.
    UserArray.py, described below, can be subclassed,
    but this is often unsatisfactory unless you put in a similar effort
    to that in MA."

On the same page there is:

    "Matrix.py
    The Matrix.py python module defines a class Matrix which is a
    subclass of UserArray. The only differences
    between Matrix instances and UserArray instances is that the *
    operator on Matrix performs a
    matrix multiplication, as opposed to element-wise multiplication,
    and that the power operator ** is disallowed
    for Matrix instances."

In view of the above, I can understand why Huaiyu Zhu took a while. His 
proposal was much more ambitious.

Yes, I know that the power operator is implemented and that there is a 
random matrix but I hope that some attention is given to the 
functionality PyMatrix. I recognize that the implementation has some 
weakneses.

> Yes, it needed work, and a few of his ideas were picked up on and 
> included in Numeric's Matrix object.

I suggest that this overstates what was picked up.

> I would like to see a standard Matrix class (along with the 
> record-array class) also be included with the universal array.

Good, on both scores. I hope that the PEP will set out these ideas.

Colin W.





More information about the Numpy-discussion mailing list