99 plot_oracle_period_pattern ,
1010)
1111
12-
1312PLOT_CHOICES = ["oracle" , "marked" , "continued" , "comparison" , "all" ]
1413
1514
1615def parse_args ():
17- parser = argparse .ArgumentParser (description = "Generate Shor period-finding visualizations." )
18- parser .add_argument ("--N" , type = int , default = 21 , help = "Semiprime for oracle/probability/candidate plots." )
19- parser .add_argument ("--a" , type = int , default = 2 , help = "Base for oracle/probability/candidate plots." )
16+ parser = argparse .ArgumentParser (
17+ description = "Generate Shor period-finding visualizations."
18+ )
19+ parser .add_argument (
20+ "--N" ,
21+ type = int ,
22+ default = 21 ,
23+ help = "Semiprime for oracle/probability/candidate plots." ,
24+ )
25+ parser .add_argument (
26+ "--a" , type = int , default = 2 , help = "Base for oracle/probability/candidate plots."
27+ )
2028 parser .add_argument (
2129 "--mode" ,
2230 choices = ["distribution" , "matrix" ],
@@ -30,11 +38,34 @@ def parse_args():
3038 default = ["all" ],
3139 help = "Plots to generate." ,
3240 )
33- parser .add_argument ("--output-dir" , default = "images" , help = "Directory for generated plots and CSV files." )
34- parser .add_argument ("--top-n" , type = int , default = 12 , help = "Number of continued-fraction candidates to plot." )
35- parser .add_argument ("--comparison-N" , type = int , default = 15 , help = "N for matrix/distribution comparison." )
36- parser .add_argument ("--comparison-a" , type = int , default = 2 , help = "a for matrix/distribution comparison." )
37- parser .add_argument ("--dense-comparison" , action = "store_true" , help = "Use dense matrices for comparison plot." )
41+ parser .add_argument (
42+ "--output-dir" ,
43+ default = "images" ,
44+ help = "Directory for generated plots and CSV files." ,
45+ )
46+ parser .add_argument (
47+ "--top-n" ,
48+ type = int ,
49+ default = 12 ,
50+ help = "Number of continued-fraction candidates to plot." ,
51+ )
52+ parser .add_argument (
53+ "--comparison-N" ,
54+ type = int ,
55+ default = 15 ,
56+ help = "N for matrix/distribution comparison." ,
57+ )
58+ parser .add_argument (
59+ "--comparison-a" ,
60+ type = int ,
61+ default = 2 ,
62+ help = "a for matrix/distribution comparison." ,
63+ )
64+ parser .add_argument (
65+ "--dense-comparison" ,
66+ action = "store_true" ,
67+ help = "Use dense matrices for comparison plot." ,
68+ )
3869 return parser .parse_args ()
3970
4071
@@ -47,7 +78,9 @@ def selected_plots(plot_args):
4778
4879def print_output (name , value ):
4980 if isinstance (value , dict ):
50- print (f"{ name } : plot={ value ['plot' ]} , csv={ value ['csv' ]} , rows={ len (value ['rows' ])} " )
81+ print (
82+ f"{ name } : plot={ value ['plot' ]} , csv={ value ['csv' ]} , rows={ len (value ['rows' ])} "
83+ )
5184 else :
5285 print (f"{ name } : { value } " )
5386
@@ -62,7 +95,9 @@ def main():
6295 probabilities = compute_probs (args .N , args .a , mode = args .mode )
6396
6497 if "oracle" in plots :
65- outputs ["oracle" ] = plot_oracle_period_pattern (args .N , args .a , output_dir = args .output_dir )
98+ outputs ["oracle" ] = plot_oracle_period_pattern (
99+ args .N , args .a , output_dir = args .output_dir
100+ )
66101
67102 if "continued" in plots :
68103 outputs ["continued" ] = plot_continued_fraction_diagnostics (
0 commit comments