[Numpy-discussion] Deprecating matrices.

Charles R Harris charlesr.harris at gmail.com
Fri Jan 6 20:52:59 EST 2017


On Fri, Jan 6, 2017 at 6:37 PM, <josef.pktd at gmail.com> wrote:

>
>
>
> On Fri, Jan 6, 2017 at 8:28 PM, Ralf Gommers <ralf.gommers at gmail.com>
> wrote:
>
>>
>>
>> On Sat, Jan 7, 2017 at 2:21 PM, CJ Carey <perimosocordiae at gmail.com>
>> wrote:
>>
>>>
>>> On Fri, Jan 6, 2017 at 6:19 PM, Ralf Gommers <ralf.gommers at gmail.com>
>>> wrote:
>>>
>>>> This sounds like a reasonable idea. Timeline could be something like:
>>>>
>>>> 1. Now: create new package, deprecate np.matrix in docs.
>>>> 2. In say 1.5 years: start issuing visible deprecation warnings in numpy
>>>> 3. After 2020: remove matrix from numpy.
>>>>
>>>> Ralf
>>>>
>>>
>>> I think this sounds reasonable, and reminds me of the deliberate
>>> deprecation process taken for scipy.weave. I guess we'll see how successful
>>> it was when 0.19 is released.
>>>
>>> The major problem I have with removing numpy matrices is the effect on
>>> scipy.sparse, which mostly-consistently mimics numpy.matrix semantics and
>>> often produces numpy.matrix results when densifying. The two are coupled
>>> tightly enough that if numpy matrices go away, all of the existing sparse
>>> matrix classes will have to go at the same time.
>>>
>>> I don't think that would be the end of the world,
>>>
>>
>> Not the end of the world literally, but the impact would be pretty major.
>> I think we're stuck with scipy.sparse, and may at some point will add a new
>> sparse *array* implementation next to it. For scipy we will have to add a
>> dependency on the new npmatrix package or vendor it.
>>
>
> That sounds to me like moving maintenance of numpy.matrix from numpy to
> scipy, if scipy.sparse is one of the main users and still depends on it.
>

What I was thinking was encouraging folks to use `arr.dot(...)` or `@`
instead of `*` for matrix multiplication, keeping `*` for scalar
multiplication. If those operations were defined for matrices, then at some
point sparse could go to arrays and it would not be noticeable except for
the treatment of 1-D arrays -- which admittedly might be a bit tricky.

Chuck
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/numpy-discussion/attachments/20170106/394a9088/attachment.html>


More information about the NumPy-Discussion mailing list