From cb70764b89d02c4e9eb8df0eb551519becb4da3e Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Sun, 29 Sep 2024 15:15:05 +0000 Subject: [PATCH] [pre-commit.ci] auto fixes from pre-commit.com hooks --- README.md | 3 ++- pyriemann_qiskit/classification.py | 2 +- pyriemann_qiskit/utils/quantum_provider.py | 11 ++++++----- requirements.txt | 1 - 4 files changed, 9 insertions(+), 8 deletions(-) diff --git a/README.md b/README.md index f4e1cbcb..537436a0 100644 --- a/README.md +++ b/README.md @@ -135,7 +135,8 @@ To use symbolic quantum simulation, run: pip install .[optim] ``` -Which will enable [qiskit-symb](https://github.com/SimoneGasperini/qiskit-symb) integration. +Which will enable [qiskit-symb](https://github.com/SimoneGasperini/qiskit-symb) +integration. Note, Qiskit only provide binaries for Linux. For other platforms, or if you want to enable specific NVIDIA optimization for quantum, you need to build the binary diff --git a/pyriemann_qiskit/classification.py b/pyriemann_qiskit/classification.py index 3b23d8b6..6d01cd36 100644 --- a/pyriemann_qiskit/classification.py +++ b/pyriemann_qiskit/classification.py @@ -423,7 +423,7 @@ def _init_algo(self, n_features): self.gen_feature_map, self._quantum_instance, self.use_fidelity_state_vector_kernel, - not self.pegasos + not self.pegasos, ) if self.pegasos: self._log("[Warning] `gamma` is not supported by PegasosQSVC") diff --git a/pyriemann_qiskit/utils/quantum_provider.py b/pyriemann_qiskit/utils/quantum_provider.py index 70079a05..1f18e96e 100644 --- a/pyriemann_qiskit/utils/quantum_provider.py +++ b/pyriemann_qiskit/utils/quantum_provider.py @@ -15,12 +15,13 @@ FidelityStatevectorKernel, FidelityQuantumKernel, ) + try: from qiskit_symb.quantum_info import Statevector - QISKIT_SYMB=True -except: - QISKIT_SYMB=False + QISKIT_SYMB = True +except: + QISKIT_SYMB = False class SymbFidelityStatevectorKernel: @@ -218,14 +219,14 @@ def get_quantum_kernel( gen_feature_map, quantum_instance, use_fidelity_state_vector_kernel, - use_qiskit_symb + use_qiskit_symb, ): """Get a quantum kernel Return an instance of FidelityQuantumKernel or FidelityStatevectorKernel (in the case of a simulation). - For simulation with a small number of qubits (< 9), and `use_qiskit_symb` is True, + For simulation with a small number of qubits (< 9), and `use_qiskit_symb` is True, qiskit-symb is used. Parameters diff --git a/requirements.txt b/requirements.txt index 9f6e94a5..e5486b47 100644 --- a/requirements.txt +++ b/requirements.txt @@ -14,4 +14,3 @@ docplex>=2.21.207 firebase_admin==6.5.0 tqdm pandas -