stan-dev / example-models

Example models for Stan
http://mc-stan.org/
772 stars 479 forks source link

revised to only use two mdivide_ calls #126

Closed Sycor4x closed 6 years ago

Sycor4x commented 6 years ago

this should be more efficient since mdivide_ is expensive.

bob-carpenter commented 6 years ago

Thanks. I hope @rtrangucci or @betanalpha or @avehtari can review. This one's making my head hurt from the linear algebra.

Sycor4x commented 6 years ago

Over the weekend I'll take a look at the other GP scripts and see if similar improvements may be made.

avehtari commented 6 years ago

A good catch. Yes, it's correct. For big n, Cholesky will still dominate, but there shouldn't be any downsides for this change. Do you want to add other changes to the same pull request or make a new one for those?

Sycor4x commented 6 years ago

Your point about the Cholesky factorization dominating the computational cost is well-taken.

Please merge this one. Once I make review of the other GP scripts, I'll make a new PR to group together any of my possible future efficiency improvements.