Format with black
This commit is contained in:
@@ -28,7 +28,7 @@ def eval_tn_MPI(qibo_circ, datatype, n_samples=8):
|
||||
The pathfinder looks at user defined number of samples (n_samples) iteratively to select the least costly contraction path. This is sped up with multi thread.
|
||||
After pathfinding the optimal path is used in the actual contraction to give a dense vector representation of the TN.
|
||||
"""
|
||||
|
||||
|
||||
from mpi4py import MPI # this line initializes MPI
|
||||
import socket
|
||||
from cuquantum import Network
|
||||
@@ -103,7 +103,7 @@ def eval_tn_MPI(qibo_circ, datatype, n_samples=8):
|
||||
|
||||
# Sum the partial contribution from each process on root.
|
||||
result = comm.reduce(sendobj=result, op=MPI.SUM, root=root)
|
||||
|
||||
|
||||
"""
|
||||
path, opt_info = network.contract_path(optimize={"samples": n_samples, "threads": ncpu_threads, 'slicing': {'min_slices': max(16, size)}})
|
||||
|
||||
@@ -369,6 +369,7 @@ def eval_tn_MPI_expectation(qibo_circ, datatype, n_samples=8):
|
||||
|
||||
return result, rank
|
||||
|
||||
|
||||
def eval_mps(qibo_circ, gate_algo, datatype):
|
||||
myconvertor = QiboCircuitToMPS(qibo_circ, gate_algo, dtype=datatype)
|
||||
mps_helper = MPSContractionHelper(myconvertor.num_qubits)
|
||||
@@ -377,6 +378,7 @@ def eval_mps(qibo_circ, gate_algo, datatype):
|
||||
myconvertor.mps_tensors, {"handle": myconvertor.handle}
|
||||
)
|
||||
|
||||
|
||||
def PauliStringGen(nqubits):
|
||||
if nqubits <= 0:
|
||||
return "Invalid input. N should be a positive integer."
|
||||
|
||||
Reference in New Issue
Block a user