[Numpy-discussion] inplace dot products
Robert Kern
robert.kern@gmail....
Fri Feb 20 09:52:03 CST 2009
On Fri, Feb 20, 2009 at 05:18, David Warde-Farley <dwf@cs.toronto.edu> wrote:
> Hi Olivier,
>
> There was this idea posted on the Scipy-user list a while back:
>
> http://projects.scipy.org/pipermail/scipy-user/2008-August/017954.html
>
> but it doesn't look like he got anywhere with it, or even got a
> response.
>
> I just tried it and I observe the same behaviour. A quick look at the
> SciPy sources tells me there is something fishy.
>
> subroutine
> <
> tchar=s,d,c,z>gemm(m,n,k,alpha,a,b,beta,c,trans_a,trans_b,lda,ka,ldb,kb)
> ! c = gemm(alpha,a,b,beta=0,c=0,trans_a=0,trans_b=0,overwrite_c=0)
> ! Calculate C <- alpha * op(A) * op(B) + beta * C
>
> I don't read Fortran very well, but it seems to me as though the
> Fortran prototype doesn't match the python prototype.
What do you mean? Based on the rest of the argument information in
that block, f2py creates the Python prototype. For example, all of the
m,n,k,lda,ka,ldb,kb dimensions are found from the input arrays
themselves, optional arguments are given defaults, etc.
> I'll poke around a little more, but in summary: there's no numpy-
> sanctioned way to specify an output array for a dot(), AFAIK. This is
> a bit of an annoyance, I agree, though I seem to remember Robert Kern
> offering a fairly compelling argument why it's hard. I just don't know
I believe I was only talking about why it would be hard to use a
higher-precision accumulator.
--
Robert Kern
"I have come to believe that the whole world is an enigma, a harmless
enigma that is made terrible by our own mad attempt to interpret it as
though it had an underlying truth."
-- Umberto Eco
More information about the Numpy-discussion
mailing list