@@ -187,7 +187,7 @@ def state_type_from_op_type(op_type):
187
187
return state_type_preferences
188
188
189
189
190
- def convert (state , to_type , basis , cptp_penalty = 1e-7 , ideal_state = None , flatten_structure = False ):
190
+ def convert (state , to_type , basis , cp_penalty = 1e-7 , ideal_state = None , flatten_structure = False ):
191
191
"""
192
192
TODO: update docstring
193
193
Convert SPAM vector to a new type of parameterization.
@@ -220,7 +220,7 @@ def convert(state, to_type, basis, cptp_penalty=1e-7, ideal_state=None, flatten_
220
220
unchanged. When `True`, composed and embedded operations are "flattened"
221
221
into a single state of the requested `to_type`.
222
222
223
- cptp_penalty : float, optional
223
+ cp_penalty : float, optional
224
224
CPTP penalty that gets factored into the optimization to find the resulting model
225
225
when converting to an error-generator type.
226
226
@@ -269,7 +269,7 @@ def convert(state, to_type, basis, cptp_penalty=1e-7, ideal_state=None, flatten_
269
269
errgen = _LindbladErrorgen .from_error_generator (2 ** (2 * num_qubits ), parameterization = to_type )
270
270
num_errgens = errgen .num_params
271
271
272
- #GLND for states suffers from "dumb gauge" freedom. This function identifies
272
+ #GLND for states suffers from "trivial gauge" freedom. This function identifies
273
273
#the physical directions to avoid this gauge.
274
274
def calc_physical_subspace (ideal_prep , epsilon = 1e-9 ):
275
275
@@ -293,16 +293,13 @@ def calc_physical_subspace(ideal_prep, epsilon = 1e-9):
293
293
294
294
#We use optimization to find the best error generator representation
295
295
#we only vary physical directions, not independent error generators
296
-
297
296
def _objfn (v ):
298
297
L_vec = _np .zeros (len (phys_directions [0 ]))
299
298
for coeff , phys_direction in zip (v ,phys_directions ):
300
299
L_vec += coeff * phys_direction
301
300
errorgen .from_vector (L_vec )
302
301
proc_matrix = _spl .expm (errorgen .to_dense ())
303
- #basis of to_dense() CHECK if always pp
304
- dense_basis = Basis .cast ('pp' , (2 ** num_qubits )** 2 )
305
- return _np .linalg .norm (proc_matrix @ dense_st - dense_state ) + cptp_penalty * sum_of_negative_choi_eigenvalues_gate (proc_matrix , dense_basis )
302
+ return _np .linalg .norm (proc_matrix @ dense_st - dense_state ) + cp_penalty * sum_of_negative_choi_eigenvalues_gate (proc_matrix , basis )
306
303
307
304
soln = _spo .minimize (_objfn , _np .zeros (len (phys_directions ), 'd' ), method = "Nelder-Mead" , options = {},
308
305
tol = 1e-13 ) # , callback=callback)
0 commit comments