Conversation
Extract solver abstraction helpers (_ga_init_solver, _ga_update_and_solve!, _ga_make_posterior) so the Newton iteration and IFT-based rrule each exist once, dispatching on GMRF type. Removes ~130 lines of duplicated code.
Add 4-arg SparseMatrixCSC constructor that wraps Q in Hermitian, matching
the 2-arg constructor's behavior. Fix rrule dispatch from ::typeof(ChordalGMRF)
(resolves to ::UnionAll, matching GMRF too) to ::Type{ChordalGMRF}.
The rrules for HermSparse/SymSparse cause method invalidation that exposes
an upstream ChainRulesCore bug: ProjectTo{SymTridiagonal} extracts only one
triangle of the off-diagonal, losing the factor of 2 from symmetry.
|
I am going to rewrite this all using Mooncake; probably today. |
|
Ah, alright! I didn't make any major changes to it, just restructured things a bit to avoid code duplication particularly for |
|
@timweiland It is ready. The |
|
I noticed MooncakeSparse.jl is registered now, nice!
Fresh install fails to resolve. DI maintainers are aware though and this should be resolved quite soon from what I've seen on the Julia Slack, so I'm fine with simply waiting for that to happen |
|
Annoying. What if you relax the compat in your your local MooncakeSparse.jl to |
|
As far as I can tell MooncakeSparse.jl uses the new API that was only introduced in 0.5.25, in particular the whole friendly tangent business |
I added a new type
ChordalGMRF <: AbstractGMRF, along with files for testing and benchmarking it.Performance depends on the merging of several PRs:
ProjectTofor symmetric sparse matrices. JuliaDiff/ChainRulesCore.jl#707accummethod for symmetric sparse matrices. FluxML/Zygote.jl#1609In the meantime, I added a
piracy.jlfile that implements the changes locally. Some type piracy also occurs in the Zygote.jl extension.Make sure to run this with CliqueTrees.
Benchmarks
Here is the output of
gaussian_approximation_comparison.jl.And here is the output of
logpdf_comparison.jl: