Rename expectation function name
This commit is contained in:
@@ -53,7 +53,7 @@ class CuTensorNet(NumpyBackend): # pragma: no cover
|
|||||||
raise TypeError("Type can be either complex64 or complex128")
|
raise TypeError("Type can be either complex64 or complex128")
|
||||||
|
|
||||||
def execute_circuit(
|
def execute_circuit(
|
||||||
self, circuit, test, MPI_enabled=False, MPS_enabled=False, NCCL_enabled=False, expectation_enabled=False, initial_state=None, nshots=None, return_array=False
|
self, circuit, MPI_enabled=False, MPS_enabled=False, NCCL_enabled=False, expectation_enabled=False, initial_state=None, nshots=None, return_array=False
|
||||||
): # pragma: no cover
|
): # pragma: no cover
|
||||||
"""Executes a quantum circuit.
|
"""Executes a quantum circuit.
|
||||||
|
|
||||||
@@ -68,7 +68,11 @@ class CuTensorNet(NumpyBackend): # pragma: no cover
|
|||||||
"""
|
"""
|
||||||
|
|
||||||
import qibotn.eval as eval
|
import qibotn.eval as eval
|
||||||
print("Test", test)
|
print("MPI_enabled", MPI_enabled)
|
||||||
|
print("MPS_enabled", MPS_enabled)
|
||||||
|
print("NCCL_enabled", NCCL_enabled)
|
||||||
|
print("expectation_enabled", expectation_enabled)
|
||||||
|
|
||||||
if (
|
if (
|
||||||
MPI_enabled == False
|
MPI_enabled == False
|
||||||
and MPS_enabled == False
|
and MPS_enabled == False
|
||||||
@@ -150,7 +154,7 @@ class CuTensorNet(NumpyBackend): # pragma: no cover
|
|||||||
raise_error(NotImplementedError,
|
raise_error(NotImplementedError,
|
||||||
"QiboTN cannot support initial state.")
|
"QiboTN cannot support initial state.")
|
||||||
|
|
||||||
state, rank = eval.expectation_tn_MPI(
|
state, rank = eval.expectation_pauli_tn_MPI(
|
||||||
circuit, self.dtype, 32)
|
circuit, self.dtype, 32)
|
||||||
|
|
||||||
if rank > 0:
|
if rank > 0:
|
||||||
@@ -166,7 +170,7 @@ class CuTensorNet(NumpyBackend): # pragma: no cover
|
|||||||
raise_error(NotImplementedError,
|
raise_error(NotImplementedError,
|
||||||
"QiboTN cannot support initial state.")
|
"QiboTN cannot support initial state.")
|
||||||
|
|
||||||
state, rank = eval.expectation_tn_nccl(
|
state, rank = eval.expectation_pauli_tn_nccl(
|
||||||
circuit, self.dtype, 32)
|
circuit, self.dtype, 32)
|
||||||
|
|
||||||
if rank > 0:
|
if rank > 0:
|
||||||
|
|||||||
@@ -14,7 +14,7 @@ def dense_vector_tn(qibo_circ, datatype):
|
|||||||
return contract(*myconvertor.state_vector_operands())
|
return contract(*myconvertor.state_vector_operands())
|
||||||
|
|
||||||
|
|
||||||
def expectation_tn(qibo_circ, datatype):
|
def expectation_pauli_tn(qibo_circ, datatype):
|
||||||
myconvertor = QiboCircuitToEinsum(qibo_circ, dtype=datatype)
|
myconvertor = QiboCircuitToEinsum(qibo_circ, dtype=datatype)
|
||||||
return contract(
|
return contract(
|
||||||
*myconvertor.expectation_operands(PauliStringGen(qibo_circ.nqubits))
|
*myconvertor.expectation_operands(PauliStringGen(qibo_circ.nqubits))
|
||||||
@@ -203,7 +203,7 @@ def dense_vector_tn_nccl(qibo_circ, datatype, n_samples=8):
|
|||||||
return result, rank
|
return result, rank
|
||||||
|
|
||||||
|
|
||||||
def expectation_tn_nccl(qibo_circ, datatype, n_samples=8):
|
def expectation_pauli_tn_nccl(qibo_circ, datatype, n_samples=8):
|
||||||
from mpi4py import MPI # this line initializes MPI
|
from mpi4py import MPI # this line initializes MPI
|
||||||
import socket
|
import socket
|
||||||
from cuquantum import Network
|
from cuquantum import Network
|
||||||
@@ -290,7 +290,7 @@ def expectation_tn_nccl(qibo_circ, datatype, n_samples=8):
|
|||||||
return result, rank
|
return result, rank
|
||||||
|
|
||||||
|
|
||||||
def expectation_tn_MPI(qibo_circ, datatype, n_samples=8):
|
def expectation_pauli_tn_MPI(qibo_circ, datatype, n_samples=8):
|
||||||
from mpi4py import MPI # this line initializes MPI
|
from mpi4py import MPI # this line initializes MPI
|
||||||
import socket
|
import socket
|
||||||
from cuquantum import Network
|
from cuquantum import Network
|
||||||
|
|||||||
Reference in New Issue
Block a user