Skip to content

Commit

Permalink
[pre-commit.ci] auto fixes from pre-commit.com hooks
Browse files Browse the repository at this point in the history
  • Loading branch information
pre-commit-ci[bot] committed Sep 19, 2024
1 parent 9fc6cff commit fb82bb1
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 9 deletions.
4 changes: 3 additions & 1 deletion examples/toys_dataset/plot_qaoa_cv.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,9 @@ def run_qaoa_cv(n_reps, optimizer, create_mixer):

# Instanciate the QAOA-CV
# Note: if quantum_instance is None, it will be created inside the optimizer.
qaoa_cv = QAOACVOptimizer(create_mixer, n_reps, quantum_instance=None, optimizer=optimizer)
qaoa_cv = QAOACVOptimizer(
create_mixer, n_reps, quantum_instance=None, optimizer=optimizer
)

# reshape is when working with covariance matrices
# So the vector of solution is reshaped into a matrix
Expand Down
1 change: 1 addition & 0 deletions pyriemann_qiskit/utils/docplex.py
Original file line number Diff line number Diff line change
Expand Up @@ -592,6 +592,7 @@ def get_weights(self, prob, classes):

from qiskit.quantum_info import Pauli, SparsePauliOp


def _is_pauli_identity(operator):
if isinstance(operator, SparsePauliOp):
if len(operator.paulis) == 1:
Expand Down
16 changes: 8 additions & 8 deletions pyriemann_qiskit/utils/hyper_params_factory.py
Original file line number Diff line number Diff line change
Expand Up @@ -361,7 +361,7 @@ def create_mixer_rotational_X_gates(angle):
-------
mixer : Callable[[int, boolean], QuantumCircuit]
A method that create the mixer with the correct angle.
This method takes into parameters the number of qubits in the circuit,
This method takes into parameters the number of qubits in the circuit,
and a parameter `use_params`.
if True, `use_params` create a Parameter in the circuit (same for all gates)
Expand Down Expand Up @@ -407,7 +407,7 @@ def create_mixer_rotational_XY_gates(angle):
-------
mixer : Callable[[int, boolean], QuantumCircuit]
A method that create the mixer with the correct angle.
This method takes into parameters the number of qubits in the circuit,
This method takes into parameters the number of qubits in the circuit,
and a parameter `use_params`.
if True, `use_params` create a Parameter in the circuit (same for all gates)
Expand All @@ -427,10 +427,10 @@ def mixer_XY(n_qubits, use_params):
p = Parameter("beta")
for i in range(n_qubits - 1):
if use_params:
mixer.rxx(p + angle, qr[i], qr[i+1])
mixer.rxx(p + angle, qr[i], qr[i + 1])
else:
mixer.rxx(angle, qr[i], qr[i+1])
mixer.ryy(0 + angle,qr[i], qr[i+1])
mixer.rxx(angle, qr[i], qr[i + 1])
mixer.ryy(0 + angle, qr[i], qr[i + 1])
return mixer

return mixer_XY
Expand All @@ -453,7 +453,7 @@ def create_mixer_rotational_XZ_gates(angle):
-------
mixer : Callable[[int, boolean], QuantumCircuit]
A method that create the mixer with the correct angle.
This method takes into parameters the number of qubits in the circuit,
This method takes into parameters the number of qubits in the circuit,
and a parameter `use_params`.
if True, `use_params` create a Parameter in the circuit (same for all gates)
Notes
Expand All @@ -473,10 +473,10 @@ def mixer_XZ(n_qubits, use_params):
p = Parameter("beta")
for i in range(n_qubits - 1):
if use_params:
mixer.rzx(p + angle, qr[i], qr[i+1])
mixer.rzx(p + angle, qr[i], qr[i + 1])
else:
mixer.rzx(angle, qr[i], qr[i + 1])
mixer.rzx(0 + angle, qr[i], qr[i+1]).inverse(annotated=True)
mixer.rzx(0 + angle, qr[i], qr[i + 1]).inverse(annotated=True)
return mixer

return mixer_XZ

0 comments on commit fb82bb1

Please sign in to comment.