Javier Martínez-López
<javi.martinez.lo...@gmail.com> wrote:

> That is great, thanks! I do not have the mkl module (it isn't free,
> right?) but with your script the calculation is approx. 10 times
> faster than in R. 

Great! 

By the way, using OpenBLAS will be fast as well. 

On Mac OS X Mavericks it seems Accelerate framework (a part of the OS) is
slightly faster than MKL, but it will conflict with joblib and
multiprocessing (the GCD is not fork safe).

> Is there a way to increase performance using Cython,
> BLAS and LAPACK? Could you possibly show some examples of how to do
> it?

Yes there is! We can make a very cache friendly loop by iterating over
DTRSV instead of using DTRTRS as this example does. That also avoids
temporary variables, and we can multithread the call to DTRSV. 

Basically, DTRSV is a triangular solver that takes one data vector at the
RHS (L x = b), whereas DTRTRS takes multiple data at the RHS (L X = B).
Then after calling DTRTRS we can use DDOT on x to get the squares
Mahalanobis distance. That will be about as fast as it gets. Mind you that
most computations actually needs the squared Mahalanobis distance, so we
can avoid taking the square root too. 

Sturla


------------------------------------------------------------------------------
Flow-based real-time traffic analytics software. Cisco certified tool.
Monitor traffic, SLAs, QoS, Medianet, WAAS etc. with NetFlow Analyzer
Customize your own dashboards, set traffic alerts and generate reports.
Network behavioral analysis & security monitoring. All-in-one tool.
http://pubads.g.doubleclick.net/gampad/clk?id=126839071&iu=/4140/ostg.clktrk
_______________________________________________
Scikit-learn-general mailing list
Scikit-learn-general@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/scikit-learn-general

Reply via email to