From 253ff4add64cd5d1da970cb1b6c88b8e37ad65b4 Mon Sep 17 00:00:00 2001 From: Vinitha-balachandran <127284874+Vinitha-balachandran@users.noreply.github.com> Date: Thu, 8 Feb 2024 17:58:53 +0800 Subject: [PATCH] Update src/qibotn/backends/cpu.py Co-authored-by: Alessandro Candido --- src/qibotn/backends/cpu.py | 72 ++++---------------------------------- 1 file changed, 6 insertions(+), 66 deletions(-) diff --git a/src/qibotn/backends/cpu.py b/src/qibotn/backends/cpu.py index 542599c..cb03cb8 100644 --- a/src/qibotn/backends/cpu.py +++ b/src/qibotn/backends/cpu.py @@ -62,80 +62,20 @@ class QuimbBackend(NumpyBackend): import qibotn.eval_qu as eval - if ( - self.MPI_enabled == False - and self.MPS_enabled == False - and self.NCCL_enabled == False - and self.expectation_enabled == False - ): - - state = eval.dense_vector_tn_qu( - circuit.to_qasm(), initial_state, is_mps=False, backend="numpy" - ) - - elif ( - self.MPI_enabled == False - and self.MPS_enabled == True - and self.NCCL_enabled == False - and self.expectation_enabled == False - ): - - state = eval.dense_vector_tn_qu( - circuit.to_qasm(), initial_state, is_mps=True, backend="numpy" - ) - - elif ( - self.MPI_enabled == True - and self.MPS_enabled == False - and self.NCCL_enabled == False - and self.expectation_enabled == False - ): - + if self.MPI_enabled == True: raise_error(NotImplementedError, "QiboTN quimb backend cannot support MPI.") - - elif ( - self.MPI_enabled == False - and self.MPS_enabled == False - and self.NCCL_enabled == True - and self.expectation_enabled == False - ): - + if self.NCCL_enabled == True: raise_error( NotImplementedError, "QiboTN quimb backend cannot support NCCL." ) - - elif ( - self.MPI_enabled == False - and self.MPS_enabled == False - and self.NCCL_enabled == False - and self.expectation_enabled == True - ): - + if self.expectation_enabled == True: raise_error( NotImplementedError, "QiboTN quimb backend cannot support expectation" ) - elif ( - self.MPI_enabled == True - and self.MPS_enabled == False - and self.NCCL_enabled == False - and self.expectation_enabled == True - ): - raise_error( - NotImplementedError, "QiboTN quimb backend cannot support expectation" - ) - - elif ( - self.MPI_enabled == False - and self.MPS_enabled == False - and self.NCCL_enabled == True - and self.expectation_enabled == True - ): - raise_error( - NotImplementedError, "QiboTN quimb backend cannot support expectation" - ) - else: - raise_error(NotImplementedError, "Compute type not supported.") + state = eval.dense_vector_tn_qu( + circuit.to_qasm(), initial_state, is_mps=self.MPS_enabled, backend="numpy" + ) if return_array: return state.flatten()