lanl-ansi / QuantumAnnealing.jl

Tools for the Simulation and Execution of Quantum Annealing Algorithms
Other
23 stars 5 forks source link

Add boltzmann sampling functionality, closes #34 #35

Closed zmorrell closed 2 years ago

zmorrell commented 2 years ago

@ccoffrin The testing on this is rather rudimentary, but I couldn't figure out a much better way to do it, since theoretically boltzmann sampling of the classical and quantum hamiltonian would give the same results under the tests which I added. I think it is best to just double check that the code is correct, which should be fine since it is only 4 lines or so.

codecov[bot] commented 2 years ago

Codecov Report

Merging #35 (2a90105) into main (d7adf1b) will increase coverage by 0.05%. The diff coverage is 100.00%.

@@            Coverage Diff             @@
##             main      #35      +/-   ##
==========================================
+ Coverage   92.80%   92.86%   +0.05%     
==========================================
  Files           5        5              
  Lines         598      603       +5     
==========================================
+ Hits          555      560       +5     
  Misses         43       43              
Impacted Files Coverage Δ
src/base.jl 98.33% <100.00%> (+0.15%) :arrow_up:

:mega: Codecov can now indicate which changes are the most critical in Pull Requests. Learn more

ccoffrin commented 2 years ago

I didn't get a deep understanding of what Marc had in mind for this feature but I had imagine the API would work for an arbitrary Hamiltonian. I was expecting it would look something like z_probailities_boltzmann(hamiltonian_transverse_ising(...),1.0). My inclination is to make the beta parameter explicit as this is a fundamental term in the Boltzmann model. We might even break it down further like, z_measure_probabilities(distribution_boltzmann(hamiltonian_transverse_ising(...),1.0))

In general I would also reserve the term "sample" for functions that return a vector/histogram of states, rather than ones that can return exact probabilities.

zmorrell commented 2 years ago

@ccoffrin I agree that the word sample has some different meanings when it comes to statistics, so it would probably be a good idea for me to change the name. If I am not mistaken, the code as it is written will work for any Hamiltonian that is a function of s. I will send you an email separately pointing you to what I believe Marc had in mind. I will change the name to the suggested z_probabilities_boltzmann suggestion since I think that name is consistent with the rest of the package.