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

Compute e^T * e^T only once #57

Closed ffreyer closed 4 years ago

ffreyer commented 4 years ago

Since T is a static matrix we should not be repeating this computation. Same goes for the inverse.

https://github.com/crstnbr/MonteCarlo.jl/blob/ab564454400ea9d921153117875a37710279beac/src/flavors/DQMC/slice_matrices.jl#L17-L21

https://github.com/crstnbr/MonteCarlo.jl/blob/ab564454400ea9d921153117875a37710279beac/src/flavors/DQMC/slice_matrices.jl#L31-L39

Quick benchmark using my own model w/ 16 sites and 20 slices:

                                                        Time                   Allocations      
                                                ──────────────────────   ───────────────────────
                Tot / % measured:                  535495s / 0.00%           5.17GiB / 26.9%    

 Section                                ncalls     time   %tot     avg     alloc   %tot      avg
 ───────────────────────────────────────────────────────────────────────────────────────────────
 run!                                        1    3.65s   100%   3.65s   1.39GiB  100%   1.39GiB
...
  slice_matrix!   (precomputed)           23.6k    268ms  8.04%  11.3μs    377KiB  0.03%    16.3B
  slice_matrix!   (not precomputed)       23.6k    513ms  14.1%  21.7μs    377KiB  0.03%    16.3B
───────────────────────────────────────────────────────────────────────────────────────────────