Skip to content
This repository has been archived by the owner on Dec 7, 2021. It is now read-only.

Sort parameters in variational distributions #985

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ def __init__(self,
self._var_form = var_form
# fix the order of the parameters in the circuit
if isinstance(self._var_form, QuantumCircuit):
self._var_form_params = list(self._var_form.parameters)
self._var_form_params = sorted(self._var_form.parameters, key=lambda p: p.name)
else:
warnings.warn('The VariationalForm type is deprecated as argument of the '
'MultivariateVariationalDistribution as of 0.7.0 and will be removed no '
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ def __init__(self,

# fix the order of the parameters in the circuit
if isinstance(self._var_form, QuantumCircuit):
self._var_form_params = list(self._var_form.parameters)
self._var_form_params = sorted(self._var_form.parameters, key=lambda p: p.name)
else:
warnings.warn('The VariationalForm type is deprecated as argument of the '
'UnivariateVariationalDistribution as of 0.7.0 and will be removed no '
Expand Down