enabled DSYR on feeble machines

i.e. where numpy is compiled without proper blas linkage
This commit is contained in:
James Hensman 2013-05-19 19:16:25 +01:00
parent 3c12f85a28
commit 58b206a245

View file

@ -236,7 +236,7 @@ def tdot(*args, **kwargs):
else:
return tdot_numpy(*args,**kwargs)
def DSYR(A,x,alpha=1.):
def DSYR_blas(A,x,alpha=1.):
"""
Performs a symmetric rank-1 update operation:
A <- A + alpha * np.dot(x,x.T)
@ -258,6 +258,26 @@ def DSYR(A,x,alpha=1.):
x_, byref(INCX), A_, byref(LDA))
symmetrify(A,upper=True)
def DSYR_numpy(A,x,alpha=1.):
"""
Performs a symmetric rank-1 update operation:
A <- A + alpha * np.dot(x,x.T)
Arguments
---------
:param A: Symmetric NxN np.array
:param x: Nx1 np.array
:param alpha: scalar
"""
A += alpha*np.dot(x[:,None],x[None,:])
def DSYR(*args, **kwargs):
if _blas_available:
return DSYR_blas(*args,**kwargs)
else:
return DSYR_numpy(*args,**kwargs)
def symmetrify(A,upper=False):
"""
Take the square matrix A and make it symmetrical by copting elements from the lower half to the upper