Skip to content

Commit 6249bef

Browse files
Revert "these are changes from the bugfix reparam branch, not sure what is going on here"
This reverts commit 074c743.
1 parent 744f055 commit 6249bef

File tree

1 file changed

+4
-7
lines changed

1 file changed

+4
-7
lines changed

Diff for: pygsti/modelmembers/states/__init__.py

+4-7
Original file line numberDiff line numberDiff line change
@@ -187,7 +187,7 @@ def state_type_from_op_type(op_type):
187187
return state_type_preferences
188188

189189

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):
191191
"""
192192
TODO: update docstring
193193
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_
220220
unchanged. When `True`, composed and embedded operations are "flattened"
221221
into a single state of the requested `to_type`.
222222
223-
cptp_penalty : float, optional
223+
cp_penalty : float, optional
224224
CPTP penalty that gets factored into the optimization to find the resulting model
225225
when converting to an error-generator type.
226226
@@ -269,7 +269,7 @@ def convert(state, to_type, basis, cptp_penalty=1e-7, ideal_state=None, flatten_
269269
errgen = _LindbladErrorgen.from_error_generator(2**(2*num_qubits), parameterization=to_type)
270270
num_errgens = errgen.num_params
271271

272-
#GLND for states suffers from "dumb gauge" freedom. This function identifies
272+
#GLND for states suffers from "trivial gauge" freedom. This function identifies
273273
#the physical directions to avoid this gauge.
274274
def calc_physical_subspace(ideal_prep, epsilon = 1e-9):
275275

@@ -293,16 +293,13 @@ def calc_physical_subspace(ideal_prep, epsilon = 1e-9):
293293

294294
#We use optimization to find the best error generator representation
295295
#we only vary physical directions, not independent error generators
296-
297296
def _objfn(v):
298297
L_vec = _np.zeros(len(phys_directions[0]))
299298
for coeff, phys_direction in zip(v,phys_directions):
300299
L_vec += coeff * phys_direction
301300
errorgen.from_vector(L_vec)
302301
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)
306303

307304
soln = _spo.minimize(_objfn, _np.zeros(len(phys_directions), 'd'), method="Nelder-Mead", options={},
308305
tol=1e-13) # , callback=callback)

0 commit comments

Comments
 (0)