feat: integrating qmatchatea SimulationResult in the circuit execution
This commit is contained in:
@@ -2,10 +2,10 @@ from typing import Union
|
|||||||
|
|
||||||
from qibo.config import raise_error
|
from qibo.config import raise_error
|
||||||
|
|
||||||
from qibotn.backends.cutensornet import CuTensorNet # pylint: disable=E0401
|
|
||||||
from qibotn.backends.quimb import QuimbBackend # pylint: disable=E0401
|
|
||||||
from qibotn.backends.qmatchatea import QMatchaTeaBackend # pylint: disable=E0401
|
|
||||||
from qibotn.backends.abstract import QibotnBackend
|
from qibotn.backends.abstract import QibotnBackend
|
||||||
|
from qibotn.backends.cutensornet import CuTensorNet # pylint: disable=E0401
|
||||||
|
from qibotn.backends.qmatchatea import QMatchaTeaBackend # pylint: disable=E0401
|
||||||
|
from qibotn.backends.quimb import QuimbBackend # pylint: disable=E0401
|
||||||
|
|
||||||
QibotnBackend = Union[CuTensorNet, QuimbBackend, QMatchaTeaBackend]
|
QibotnBackend = Union[CuTensorNet, QuimbBackend, QMatchaTeaBackend]
|
||||||
|
|
||||||
|
|||||||
@@ -1,11 +1,11 @@
|
|||||||
from abc import abstractmethod
|
from abc import abstractmethod
|
||||||
|
|
||||||
from qibo.backends.numpy import NumpyBackend
|
from qibo.backends.numpy import NumpyBackend
|
||||||
from qibo.config import raise_error
|
from qibo.config import raise_error
|
||||||
|
|
||||||
|
|
||||||
DEFAULT_CONFIGURATION = {
|
DEFAULT_CONFIGURATION = {
|
||||||
"MPI_enabled": False, # TODO: cutensornet specific, TBRemoved
|
"MPI_enabled": False, # TODO: cutensornet specific, TBRemoved
|
||||||
"NCCL_enabled": False, # TODO: cutensornet specific, TBRemoved
|
"NCCL_enabled": False, # TODO: cutensornet specific, TBRemoved
|
||||||
"expectation_enabled": False,
|
"expectation_enabled": False,
|
||||||
"pauli_string_pattern": None,
|
"pauli_string_pattern": None,
|
||||||
"MPS_enabled": False,
|
"MPS_enabled": False,
|
||||||
@@ -14,10 +14,9 @@ DEFAULT_CONFIGURATION = {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
class QibotnBackend(NumpyBackend):
|
class QibotnBackend(NumpyBackend):
|
||||||
|
|
||||||
def __init__(self, runcard:dict = DEFAULT_CONFIGURATION):
|
def __init__(self, runcard: dict = DEFAULT_CONFIGURATION):
|
||||||
super().__init__()
|
super().__init__()
|
||||||
|
|
||||||
def apply_gate(self, gate, state, nqubits): # pragma: no cover
|
def apply_gate(self, gate, state, nqubits): # pragma: no cover
|
||||||
@@ -32,10 +31,8 @@ class QibotnBackend(NumpyBackend):
|
|||||||
def set_precision(self, precision):
|
def set_precision(self, precision):
|
||||||
if precision != self.precision:
|
if precision != self.precision:
|
||||||
super().set_precision(precision)
|
super().set_precision(precision)
|
||||||
|
|
||||||
@abstractmethod
|
@abstractmethod
|
||||||
def configure_tn_simulation(self, **config):
|
def configure_tn_simulation(self, **config):
|
||||||
"""Configure the TN simulation that will be performed."""
|
"""Configure the TN simulation that will be performed."""
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -82,7 +82,6 @@ class CuTensorNet(QibotnBackend): # pragma: no cover
|
|||||||
if hasattr(self, "cutn"):
|
if hasattr(self, "cutn"):
|
||||||
self.cutn.destroy(self.handle)
|
self.cutn.destroy(self.handle)
|
||||||
|
|
||||||
|
|
||||||
def cuda_type(self, dtype="complex64"):
|
def cuda_type(self, dtype="complex64"):
|
||||||
"""Get CUDA Type.
|
"""Get CUDA Type.
|
||||||
|
|
||||||
|
|||||||
@@ -1,4 +1,3 @@
|
|||||||
from qibo.backends.numpy import NumpyBackend
|
|
||||||
from qibo.config import raise_error
|
from qibo.config import raise_error
|
||||||
from qibo.result import QuantumState
|
from qibo.result import QuantumState
|
||||||
|
|
||||||
@@ -38,7 +37,6 @@ class QuimbBackend(QibotnBackend):
|
|||||||
self.platform = "QuimbBackend"
|
self.platform = "QuimbBackend"
|
||||||
self.versions["quimb"] = self.quimb.__version__
|
self.versions["quimb"] = self.quimb.__version__
|
||||||
|
|
||||||
|
|
||||||
def execute_circuit(
|
def execute_circuit(
|
||||||
self, circuit, initial_state=None, nshots=None, return_array=False
|
self, circuit, initial_state=None, nshots=None, return_array=False
|
||||||
): # pragma: no cover
|
): # pragma: no cover
|
||||||
|
|||||||
Reference in New Issue
Block a user