carstenbauer / MonteCarlo.jl

Classical and quantum Monte Carlo simulations in Julia
https://carstenbauer.github.io/MonteCarlo.jl/dev/
Other
186 stars 18 forks source link

Avoid recalculating greens matrix when calling greens() #32

Closed ffreyer closed 3 years ago

ffreyer commented 4 years ago

Currently calling greens(dqmc) always performs calculations. Since most measurements require the the greens function, the calculation is repeated frequently. It would be good to save the result and only recalculate it when necessary.

It might be good to also add a function for I - G and give it the same behavior.

ffreyer commented 4 years ago

I have an implementation for this now (on https://github.com/ffreyer/MonteCarlo.jl/tree/tweaks), but I think we should discuss whether we actually want this. While this is faster it's also more error prone. If one measurements changes measured_greens other measurements will likely become invalid. To avoid/reduce this problem, I made measured_greens a ReadOnlyArray (using https://github.com/bkamins/ReadOnlyArrays.jl).