<html>
<head>
<meta content="text/html; charset=ISO-8859-1"
http-equiv="Content-Type">
</head>
<body text="#FFFFFF" bgcolor="#330033">
<font size="+1">#4 seems to refer to the Python basic system.<br>
<br>
However numpy.array does deal with multi-dimension arrays.<br>
</font>
<div class="moz-cite-prefix">On 23-Mar-2014 9:08 PM,
<a class="moz-txt-link-abbreviated" href="mailto:python-ideas-request@python.org">python-ideas-request@python.org</a> wrote:<br>
</div>
<blockquote
cite="mid:mailman.43259.1395623316.18129.python-ideas@python.org"
type="cite">------------------------------
Message: 4
Date: Mon, 24 Mar 2014 11:49:43 +1100
From: Steven D'Aprano <a class="moz-txt-link-rfc2396E" href="mailto:steve@pearwood.info"><steve@pearwood.info></a>
To: <a class="moz-txt-link-abbreviated" href="mailto:python-ideas@python.org">python-ideas@python.org</a>
Subject: Re: [Python-ideas] [RFC] draft PEP: Dedicated infix
operators for matrix multiplication and matrix power
Message-ID: <20140324004943.GX16526@ando>
Content-Type: text/plain; charset=us-ascii
On Sun, Mar 23, 2014 at 11:40:10AM +0100, Sturla Molden wrote:
<blockquote type="cite">
<pre wrap="">On 15/03/14 01:09, Antoine Pitrou wrote:
</pre>
<blockquote type="cite">
<pre wrap="">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).
</pre>
</blockquote>
<pre wrap="">
array.array is an appropriate type for supporting @ for matrix
multiplication.
</pre>
</blockquote>
<pre wrap="">
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]
</pre>
</blockquote>
<br>
</body>
</html>