File tree Expand file tree Collapse file tree 2 files changed +24
-5
lines changed
examples/reproduce_papers/2020_efficient_classical_simulation_random_shallow_2d Expand file tree Collapse file tree 2 files changed +24
-5
lines changed Original file line number Diff line number Diff line change @@ -356,6 +356,13 @@ def standardize_tensor(site_data):
356356
357357
358358def main ():
359+ # Clear log file
360+ with open (
361+ "examples/reproduce_papers/2020_efficient_classical_simulation_random_shallow_2d/outputs/results.log" ,
362+ "w" ,
363+ ) as f :
364+ f .write ("Verification Results:\n " )
365+
359366 # 1. Verification on Small Grids
360367 logger .info ("Running verification on small grids..." )
361368
@@ -381,9 +388,14 @@ def main():
381388 end = time .time ()
382389
383390 diff = abs (exact_prob - sebd_prob )
384- logger .info (
385- f"Bitstring: { target_bits [:5 ]} ... Exact: { exact_prob :.6e} , SEBD: { sebd_prob :.6e} , Diff: { diff :.2e} "
386- )
391+ msg = f"Bitstring: { target_bits [:5 ]} ... Exact: { exact_prob :.6e} , SEBD: { sebd_prob :.6e} , Diff: { diff :.2e} "
392+ logger .info (msg )
393+
394+ with open (
395+ "examples/reproduce_papers/2020_efficient_classical_simulation_random_shallow_2d/outputs/results.log" ,
396+ "a" ,
397+ ) as f :
398+ f .write (f"Grid { rows } x{ cols } depth { depth } : { msg } \n " )
387399
388400 # Relaxed threshold for larger grids/floating point error
389401 if diff > 1e-8 :
@@ -409,7 +421,7 @@ def main():
409421 # Save results
410422 with open (
411423 "examples/reproduce_papers/2020_efficient_classical_simulation_random_shallow_2d/outputs/results.log" ,
412- "w " ,
424+ "a " ,
413425 ) as f :
414426 f .write (f"Large Scale 10x10:\n Prob: { prob } \n Time: { end - start :.4f} s\n " )
415427
Original file line number Diff line number Diff line change 1+ Verification Results:
2+ Grid 2x2 depth 2: Bitstring: 1101... Exact: 3.177146e-03, SEBD: 3.177145e-03, Diff: 9.72e-10
3+ Grid 2x2 depth 2: Bitstring: 0101... Exact: 3.501271e-03, SEBD: 3.501269e-03, Diff: 2.11e-09
4+ Grid 4x4 depth 4: Bitstring: 01000... Exact: 7.651079e-06, SEBD: 7.651004e-06, Diff: 7.45e-11
5+ Grid 4x4 depth 4: Bitstring: 11001... Exact: 1.286861e-05, SEBD: 1.286850e-05, Diff: 1.10e-10
6+ Grid 4x5 depth 4: Bitstring: 11010... Exact: 1.020886e-06, SEBD: 1.020875e-06, Diff: 1.02e-11
7+ Grid 4x5 depth 4: Bitstring: 00010... Exact: 5.336154e-07, SEBD: 5.336101e-07, Diff: 5.29e-12
18Large Scale 10x10:
29Prob: 4.330939486047805e-36
3- Time: 66.6539s
10+ Time: 66.3942s
You can’t perform that action at this time.
0 commit comments