[Python-ideas] Python-ideas Digest, Vol 88, Issue 199
Colin J. Williams
cjwilliams43 at gmail.com
Mon Mar 24 03:55:16 CET 2014
#4 seems to refer to the Python basic system.
However numpy.array does deal with multi-dimension arrays.
On 23-Mar-2014 9:08 PM, python-ideas-request at python.org wrote:
> ------------------------------ Message: 4 Date: Mon, 24 Mar 2014
> 11:49:43 +1100 From: Steven D'Aprano <steve at pearwood.info> To:
> python-ideas at python.org Subject: Re: [Python-ideas] [RFC] draft PEP:
> Dedicated infix operators for matrix multiplication and matrix power
> Message-ID: <20140324004943.GX16526 at ando> Content-Type: text/plain;
> charset=us-ascii On Sun, Mar 23, 2014 at 11:40:10AM +0100, Sturla
> Molden wrote:
>> On 15/03/14 01:09, Antoine Pitrou wrote:
>>
>>> Really? That should be up to the third-party library implementing the @
>>> operator for its types, not to the language itself: Python _suggests_
>>> an use case for @, it doesn't mandate it (especially as there's no
>>> appropriate data type in the stdlib).
>> array.array is an appropriate type for supporting @ for matrix
>> multiplication.
> No it isn't. The PEP even discusses it:
>
>
> [quote]
> array objects cannot represent multidimensional data at all,
> which makes ``__matmul__`` much less useful. Second,
> providing a quality implementation of matrix multiplication
> is highly non-trivial. Naive nested loop implementations
> are very slow and providing one in CPython would just create
> a trap for users. But the alternative -- providing a modern,
> competitive matrix multiply -- would require that CPython link
> to a BLAS library, which brings a set of new complications.
> In particular, several popular BLAS libraries (including the
> one that ships by default on OS X) currently break the use of
> ``multiprocessing`` [#blas-fork]_. And finally, we'd have to
> add quite a bit beyond ``__matmul__`` before ``memoryview``
> or ``array.array`` would be useful for numeric work -- like
> elementwise versions of the other arithmetic operators, just
> to start.
> [end quote]
>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-ideas/attachments/20140323/61eade49/attachment.html>
More information about the Python-ideas
mailing list