Avoid flatten() so as to keep the shape information of contraction results
This commit is contained in:
@@ -7,4 +7,4 @@ def eval(qibo_circ, datatype):
|
|||||||
myconvertor = QiboCircuitToEinsum(qibo_circ, dtype=datatype)
|
myconvertor = QiboCircuitToEinsum(qibo_circ, dtype=datatype)
|
||||||
operands_expression = myconvertor.state_vector()
|
operands_expression = myconvertor.state_vector()
|
||||||
results = contract(*operands_expression)
|
results = contract(*operands_expression)
|
||||||
return results.flatten()
|
return results
|
||||||
|
|||||||
@@ -40,7 +40,8 @@ def test_eval(nqubits: int, dtype="complex128"):
|
|||||||
lambda: qibo_qft(nqubits, swaps=True))
|
lambda: qibo_qft(nqubits, swaps=True))
|
||||||
|
|
||||||
# Test Cuquantum
|
# Test Cuquantum
|
||||||
cutn_time, result_tn = time(lambda: qibotn.cutn.eval(qibo_circ, dtype))
|
cutn_time, result_tn = time(
|
||||||
|
lambda: qibotn.cutn.eval(qibo_circ, dtype).flatten())
|
||||||
|
|
||||||
assert 1e-2 * qibo_time < cutn_time < 1e2 * qibo_time
|
assert 1e-2 * qibo_time < cutn_time < 1e2 * qibo_time
|
||||||
assert np.allclose(
|
assert np.allclose(
|
||||||
|
|||||||
Reference in New Issue
Block a user