adamsardar / metaDEGth

metaDEGth: meta-analysis of Differentially Expressed Genes using parametric, empirically-derived P-value distributions
Mozilla Public License 2.0
0 stars 1 forks source link

Explore ways to speed up the phase-type test #22

Open adamsardar opened 4 years ago

adamsardar commented 4 years ago

The phase-type matrix has a large number of symmetries (it is Toeplitz block tridiagonal). This should produce a much easier means of computing the matrix exponential.

Benchmark and optimise. How much of an overhead is S4 adding here? I presume not much.

adamsardar commented 4 years ago

This will require some careful study. From studying '19 dubious ways to compute a matrix exponential' it would seem that the Schur-Parlett method of iterative compution of the elements of exp(T) is suitable.

See A SCHUR–PARLETT ALGORITHM FOR COMPUTING MATRIX FUNCTIONS (Davies) for more info - they talk of a form suitable for blocked matrices.

adamsardar commented 4 years ago

BioPlanet runs in on our erlotinib example in:

Linux Matrix:expm ~90s expoRkit::expv ~30s

Windows Matrix:expm ~1200s (20 minutes!!) expoRkit::expv - not run (need Rtools to install)

If expoRkit is competative on Windows, consider copying in the fortran code from expoRkit (since it is not on CRAN to depend on - we also don't need to pade approximations).

adamsardar commented 4 years ago

Thinking about it, this is almost certainly the terrible BLAS libraries that come with R on windows.

adamsardar commented 4 years ago

if the aim is to make something performant for windows users, then a partial re-implementation using RcppEigen might be the route forward.

adamsardar commented 4 years ago

https://www.avrahamadler.com/2015/06/04/a-practical-example-of-calculating-pade-approximant-coefficients-using-r/

The Pade approximation and exploitation of the block structure seems the way ...