unfoldtoolbox / Unfold.jl

Neuroimaging (EEG, fMRI, pupil ...) regression analysis in Julia
MIT License
46 stars 10 forks source link

preconditioner #197

Open behinger opened 4 months ago

behinger commented 4 months ago

I saw in simple testing a ~12% increase in performance just by scaling

function scale_ls!(A)
    s = ones(size(A, 2))
    for j = 1 : size(A, 2)
      i = A.colptr[j]
      k = A.colptr[j+1] - 1
      nj = i <= k ? norm(A.nzval[i:k]) : 0.0
      if nj > 0.0
        A.nzval[i:k] ./= nj
        s[j] = nj
      end
    end
    return s  # s contains the diagonal elements of the (right) diagonal scaling
  end

before scaling ~ 1.42s, after scaling 1.23s +0.03s scaling => 12% speedup the scaling is fast, and can be ignored when multiple channels are fitted

behinger commented 4 months ago

https://dl.acm.org/doi/pdf/10.1145/3014057