On 6/27/06, Keith Goodman <[EMAIL PROTECTED]> wrote: > On 6/27/06, Travis Oliphant <[EMAIL PROTECTED]> wrote: > > > The numpy.dual library exists so you can use the SciPy calls if the > > person has SciPy installed or the NumPy ones otherwise. It exists > > precisely for the purpose of seamlessly taking advantage of > > algorithms/interfaces that exist in NumPy but are improved in SciPy. > > That sounds very interesting. It would make a great addition to the > scipy performance page: > > http://scipy.org/PerformanceTips > > So if I need any of the following functions I should import them from > scipy or from numpy.dual? And all of them are faster? > > fft > ifft > fftn > ifftn > fft2 > ifft2 > norm > inv > svd > solve > det > eig > eigvals > eigh > eigvalsh > lstsq > pinv > cholesky > > http://svn.scipy.org/svn/numpy/trunk/numpy/dual.py >
Scipy computes the inverse of a matrix faster than numpy (except if the dimensions of x are small). But scipy is slower than numpy for eigh (I only checked for symmetric positive definite matrices): from numpy import asmatrix, randn from numpy.linalg import eigh as Neigh from scipy.linalg import eigh as Seigh import time def test(N): x = asmatrix(randn(N,2*N)) x = x * x.T t0 = time.time() eigval, eigvec = Neigh(x) t1 = time.time() t2 = time.time() eigval, eigvec = Seigh(x) t3 = time.time() print 'NumPy:', t1-t0, 'seconds' print 'SciPy:', t3-t2, 'seconds' >> dual.test(10) NumPy: 0.000217914581299 seconds SciPy: 0.000226020812988 seconds >> dual.test(100) NumPy: 0.0123109817505 seconds SciPy: 0.0321230888367 seconds >> dual.test(200) NumPy: 0.0793058872223 seconds SciPy: 0.082535982132 seconds >> dual.test(500) NumPy: 0.59161400795 seconds SciPy: 1.41600894928 seconds Using Tomcat but need to do more? Need to support web services, security? Get stuff done quickly with pre-integrated technology to make your job easier Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642 _______________________________________________ Numpy-discussion mailing list Numpy-discussion@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/numpy-discussion