Apply suggestions from code review
Co-authored-by: BrunoLiegiBastonLiegi <45011234+BrunoLiegiBastonLiegi@users.noreply.github.com>
This commit is contained in:
@@ -35,7 +35,7 @@ class MetaBackend:
|
|||||||
else:
|
else:
|
||||||
raise_error(
|
raise_error(
|
||||||
NotImplementedError,
|
NotImplementedError,
|
||||||
f"Unsupported platform {platform}, please pick one in (`cutensornet`, `qutensornet`, `qmatchatea`)",
|
f"Unsupported platform {platform}, please pick one in {PLATFORMS}",
|
||||||
)
|
)
|
||||||
|
|
||||||
def list_available(self) -> dict:
|
def list_available(self) -> dict:
|
||||||
|
|||||||
@@ -19,7 +19,7 @@ class QMatchaTeaBackend(QibotnBackend):
|
|||||||
def __init__(self):
|
def __init__(self):
|
||||||
super().__init__()
|
super().__init__()
|
||||||
|
|
||||||
self.name = "qiboml"
|
self.name = "qibotn"
|
||||||
self.platform = "qmatchatea"
|
self.platform = "qmatchatea"
|
||||||
|
|
||||||
# Set default configurations
|
# Set default configurations
|
||||||
|
|||||||
@@ -26,10 +26,10 @@ class TensorNetworkResult:
|
|||||||
"""Return calculated probabilities according to the given method."""
|
"""Return calculated probabilities according to the given method."""
|
||||||
if self.prob_type == "U":
|
if self.prob_type == "U":
|
||||||
measured_probabilities = deepcopy(self.measured_probabilities)
|
measured_probabilities = deepcopy(self.measured_probabilities)
|
||||||
for bitstring in self.measured_probabilities[self.prob_type]:
|
for bitstring, prob in self.measured_probabilities[self.prob_type].items():
|
||||||
measured_probabilities[self.prob_type][bitstring] = (
|
measured_probabilities[self.prob_type][bitstring] = (
|
||||||
self.measured_probabilities[self.prob_type][bitstring][1]
|
prob[1]
|
||||||
- self.measured_probabilities[self.prob_type][bitstring][0]
|
- prob[0]
|
||||||
)
|
)
|
||||||
probabilities = measured_probabilities[self.prob_type]
|
probabilities = measured_probabilities[self.prob_type]
|
||||||
else:
|
else:
|
||||||
@@ -50,8 +50,7 @@ class TensorNetworkResult:
|
|||||||
"""Return the statevector if the number of qubits is less than 30."""
|
"""Return the statevector if the number of qubits is less than 30."""
|
||||||
if self.nqubits < 20:
|
if self.nqubits < 20:
|
||||||
return self.statevector
|
return self.statevector
|
||||||
else:
|
raise_error(
|
||||||
raise_error(
|
NotImplementedError,
|
||||||
NotImplementedError,
|
f"Tensor network simulation cannot be used to reconstruct statevector for >= 30 .",
|
||||||
f"Tensor network simulation cannot be used to reconstruct statevector for >= 30 .",
|
)
|
||||||
)
|
|
||||||
|
|||||||
Reference in New Issue
Block a user