On Tue, May 22, 2012 at 3:47 PM, Massimo DiPierro
<[email protected]> wrote:
> Thank you. I will look into numexpr.
>
> Anyway, I do not need arbitrary expressions. If there were something like
>
> numpy.add_scaled(a,scale,b)
>
> with support for scale in int, float, complex, this would be sufficient for 
> me.

BLAS has the xAXPY functions, which will do this for float and complex.

import numpy as np
from scipy.linalg import fblas

def add_scaled_inplace(a, scale, b):
    if np.issubdtype(a.dtype, complex):
        fblas.zaxpy(b, a, a=scale)
    else:
        fblas.daxpy(b, a, a=scale)

-- 
Robert Kern
_______________________________________________
NumPy-Discussion mailing list
[email protected]
http://mail.scipy.org/mailman/listinfo/numpy-discussion

Reply via email to