QLA library = significant MatLab speed increase...

Discussion in 'Automated Trading' started by Syprik, Apr 13, 2010.

  1. Syprik

    Syprik

    For MatLab users, this currently free beta is IMO worth checking out:

    QLA - Quick Linear Algebra library.

    http://massiveanalytics.com/

    Info document:
    http://www.accelereyes.com/content/qla_files/qla_doc.pdf

    Ran realistic intra-day matrices of SP500, about 36% speed savings. Will be especially helpful for those running large linear regressions/least sq's etc. Anything with spectral concentration of data, for that matter. Speedup vs data loss (accuracy) seems well-balanced using default error tolerance, but just started tinkering, so no definitive conclusions yet.

    As of this release, looks like representation via dense matrix only. Sparse in upcoming release?

    Simple to install/use.

    An example svd I ran:

    >> clear all
    n=150;
    m=1500;
    mat=zeros(m,m);
    for i=1:n
    mat(i,: )=[1:m]*i;
    end
    u=zeros(m,m);
    s=zeros(m,m);
    v=zeros(m,m);
    tic;
    for i=1:n
    [u,s,v] = svd(mat);
    end
    normal_time = toc/n;
    u=zeros(m,1);
    s=zeros(m,1);
    v=zeros(m,m);
    tic;
    for i=1:n
    [u,s,v] = qsvd(mat);
    end
    q_time = toc/n;
    fprintf('Normal Matlab: %f\nQLA: %f\nSpeedup:%f\n',normal_time,q_time,normal_time/q_time)
    Normal Matlab: 9.382163
    QLA: 0.029765
    Speedup: 315.208249

    315x!!! With properly vectorized implementation, cha-ching?

    Using r2009b, XPProSP3.

    Let me know what you guys find out.
     
  2. Syprik - I'm curious what happens if you run your SP500 matrices at a higher error tolerance. For instance, if you're using qinv, you could try running qinv(A, .01) instead of qinv(A) to override the default tolerance of .001.

    I see a 1-2 order of magnitude speedup with this change on some non-finance matrices (no appreciable loss of result accuracy).