jcmgray / quimb

A python library for quantum information and many-body calculations including tensor networks.
http://quimb.readthedocs.io
Other
488 stars 108 forks source link

fix TypeError in compute_marginal function #98

Closed ChienKaiMa closed 2 years ago

ChienKaiMa commented 2 years ago

This is a fix for issue #97. It prevents TypeError when sampling random quantum circuits.

Test

This fix was tested with 3 random quantum circuits. Before this fix, the problem mentioned in #97 showed up in these circuits.

  1. 72-qubit, depth=6
  2. 80-qubit, depth=6
  3. 90-qubit, depth=6

    P.S.

    More circuits are tested after the this fix. sample handled a 10x10-qubit, depth-10 case on RTX3090, while the program ran out of memory in 10x10-qubit, depth-20 case.

codecov[bot] commented 2 years ago

Codecov Report

Merging #98 (179cb16) into develop (a296805) will not change coverage. The diff coverage is 0.00%.

Impacted file tree graph

@@           Coverage Diff            @@
##           develop      #98   +/-   ##
========================================
  Coverage    39.23%   39.23%           
========================================
  Files           38       38           
  Lines        15000    15000           
========================================
  Hits          5885     5885           
  Misses        9115     9115           
Impacted Files Coverage Δ
quimb/tensor/circuit.py 18.34% <0.00%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more Δ = absolute <relative> (impact), ø = not affected, ? = missing data Powered by Codecov. Last update a296805...179cb16. Read the comment docs.

jcmgray commented 2 years ago

Looks good, I may also tweak this at some point, to just ignore rescaling the marginal - since this is not needed for 'sample' anyhow.