raj-dahya commited on
Commit
025b651
·
verified ·
1 Parent(s): 4bd3e47

staging > main: cleaner kwargs + added default args

Browse files
src/choi_cholesky/experiments/choi_cholesky/verify.py CHANGED
@@ -23,7 +23,7 @@
23
  the algorithm can get close to a critical error under low numerical precision (e.g. Float32).
24
  For this reason we use double precision (Float64) numbers.
25
 
26
- NOTE: The option `map_kind = "CP"` establishes a proper confirmation.
27
  For completeness we have included the option `"CPTP"`,
28
  but this provides a circular test, as the generation of CPTP-maps here assumes results of paper in advance.
29
 
@@ -61,9 +61,9 @@ def verify_choi_cholesky(
61
  *,
62
  d1: int,
63
  d2: int,
64
- num_experiments: int,
65
- map_kind: MAP_CATEGORY,
66
- algorithm_choice: ALGORITHM_CHOICE,
67
  ):
68
  """
69
  Experimental verification of Choi--Cholesky decomposition of CP-/CPTP-maps
@@ -71,14 +71,14 @@ def verify_choi_cholesky(
71
  # execute main method
72
  tol = TOL
73
  diffs: list[float] = []
74
- for index in range(1, 1 + num_experiments):
75
  logging.info(f"run experiment {index}")
76
 
77
  """
78
  Create a random CP/CPTP-map
79
  """
80
 
81
- match map_kind:
82
  case "CPTP":
83
  logging.info("generate Choi matrix C of a random CPTP map Φ")
84
  C = random_cptp(d1, d2, precision=PRECISION)
@@ -96,7 +96,7 @@ def verify_choi_cholesky(
96
  """
97
 
98
  logging.info("compute Choi-Cholesky decomposition for Φ")
99
- match algorithm_choice:
100
  case "CHOI-CHOLESKY-MODIFIED":
101
  L = algorithm_choi_cholesky_modified(C, tol=TOL)
102
 
 
23
  the algorithm can get close to a critical error under low numerical precision (e.g. Float32).
24
  For this reason we use double precision (Float64) numbers.
25
 
26
+ NOTE: The option `map = "CP"` establishes a proper confirmation.
27
  For completeness we have included the option `"CPTP"`,
28
  but this provides a circular test, as the generation of CPTP-maps here assumes results of paper in advance.
29
 
 
61
  *,
62
  d1: int,
63
  d2: int,
64
+ N: int = 100,
65
+ map: MAP_CATEGORY = "CP",
66
+ algorithm: ALGORITHM_CHOICE = "CHOI-CHOLESKY",
67
  ):
68
  """
69
  Experimental verification of Choi--Cholesky decomposition of CP-/CPTP-maps
 
71
  # execute main method
72
  tol = TOL
73
  diffs: list[float] = []
74
+ for index in range(1, 1 + N):
75
  logging.info(f"run experiment {index}")
76
 
77
  """
78
  Create a random CP/CPTP-map
79
  """
80
 
81
+ match map:
82
  case "CPTP":
83
  logging.info("generate Choi matrix C of a random CPTP map Φ")
84
  C = random_cptp(d1, d2, precision=PRECISION)
 
96
  """
97
 
98
  logging.info("compute Choi-Cholesky decomposition for Φ")
99
+ match algorithm:
100
  case "CHOI-CHOLESKY-MODIFIED":
101
  L = algorithm_choi_cholesky_modified(C, tol=TOL)
102
 
src/examples.py CHANGED
@@ -51,7 +51,7 @@ if __name__ == "__main__":
51
  verify_choi_cholesky(
52
  d1=args.dim1,
53
  d2=args.dim2,
54
- num_experiments=args.num,
55
- map_kind=args.map,
56
- algorithm_choice=args.algorithm,
57
  )
 
51
  verify_choi_cholesky(
52
  d1=args.dim1,
53
  d2=args.dim2,
54
+ N=args.num,
55
+ map=args.map,
56
+ algorithm=args.algorithm,
57
  )