jrbourbeau / pyunfold

Iterative unfolding for Python
https://jrbourbeau.github.io/pyunfold/
MIT License
26 stars 13 forks source link

Use sparse matrices if cov_type='poisson' #108

Open jvavrek opened 4 years ago

jvavrek commented 4 years ago

It would be nice to take advantage of sparse matrix multiplication when cov_type='poisson'. With 100 cause and 100 effect bins I find that about 80% of compute time is spent in

mixer.get_MC_err()  # unfold.py line 214

and about 85% of that time is spent doing

Vc1 = dcdP.dot(CovPP).dot(dcdP.T)  # mix.py line 242

Of course, due to the rapid scaling of the problem, these will get much more expensive going up to even say 200 bins each. But if the covariance is poisson, the covariance should be sparse, and a full dot product over the full [nbins^2 x nbins^2] matrix is not necessary.

jvavrek commented 4 years ago

see #109