From ca6d5796dcba7dd4cc4b5e4f608678062b4b2fd3 Mon Sep 17 00:00:00 2001 From: tankya2 Date: Thu, 3 Aug 2023 11:26:20 +0800 Subject: [PATCH] Removed duplicated self.options --- src/qibotn/QiboCircuitToMPS.py | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) diff --git a/src/qibotn/QiboCircuitToMPS.py b/src/qibotn/QiboCircuitToMPS.py index 4c18aac..f504d5a 100644 --- a/src/qibotn/QiboCircuitToMPS.py +++ b/src/qibotn/QiboCircuitToMPS.py @@ -7,22 +7,32 @@ from qibotn.MPSUtils import get_initial_mps, apply_gate class QiboCircuitToMPS: - def __init__(self, circ_qibo, gate_algo, dtype='complex128', rand_seed=0,): + def __init__( + self, + circ_qibo, + gate_algo, + dtype="complex128", + rand_seed=0, + ): np.random.seed(rand_seed) cp.random.seed(rand_seed) self.num_qubits = circ_qibo.nqubits self.handle = cutn.create() - self.options = {'handle': self.handle} self.dtype = dtype self.mps_tensors = get_initial_mps(self.num_qubits, dtype=dtype) circuitconvertor = QiboCircuitToEinsum(circ_qibo) - for (gate, qubits) in circuitconvertor.gate_tensors: + for gate, qubits in circuitconvertor.gate_tensors: # mapping from qubits to qubit indices # apply the gate in-place - apply_gate(self.mps_tensors, gate, qubits, - algorithm=gate_algo, options=self.options) + apply_gate( + self.mps_tensors, + gate, + qubits, + algorithm=gate_algo, + options={"handle": self.handle}, + ) def __del__(self): cutn.destroy(self.handle)