Updated docstring to class
This commit is contained in:
@@ -3,17 +3,17 @@ import numpy as np
|
|||||||
|
|
||||||
|
|
||||||
class QiboCircuitToEinsum:
|
class QiboCircuitToEinsum:
|
||||||
"""This class takes a quantum circuit defined in Qibo (i.e. a Circuit object)
|
"""Convert a circuit to Tensor Network(TN) representation.
|
||||||
and convert it to an equivalent Tensor Network (TN) representation that is formatted for
|
The circuit is first processed to an intermediate form by grouping each gate
|
||||||
cuQuantum' contract method to compute the state vectors.
|
matrix with its corresponding qubit it is acting on to a list. It is then
|
||||||
See document for detail: https://docs.nvidia.com/cuda/cuquantum/python/api/generated/cuquantum.contract.html
|
converted it to an equivalent TN expression through the class function
|
||||||
|
state_vector_operands() following the Einstein summation convention in the
|
||||||
|
interleave format.
|
||||||
|
|
||||||
When the class is constructed, it first process the circuit to an intermediate form by extracting the gate matrix
|
See document for detail of the format: https://docs.nvidia.com/cuda/cuquantum/python/api/generated/cuquantum.contract.html
|
||||||
and grouping each gate with its corresponding qubit it is acting on to a list.
|
|
||||||
|
|
||||||
It is then converted it to an equivalent TN expression following the Einstein
|
The output is to be used by cuQuantum's contract() for computation of the
|
||||||
summation convention through the class function state_vector_operands().
|
state vectors of the circuit.
|
||||||
The output is to be used by cuQuantum's contract() for computation of the state vectors of the circuit.
|
|
||||||
"""
|
"""
|
||||||
|
|
||||||
def __init__(self, circuit, dtype="complex128"):
|
def __init__(self, circuit, dtype="complex128"):
|
||||||
@@ -70,8 +70,7 @@ class QiboCircuitToEinsum:
|
|||||||
for key in qubits_frontier:
|
for key in qubits_frontier:
|
||||||
out_list.append(qubits_frontier[key])
|
out_list.append(qubits_frontier[key])
|
||||||
|
|
||||||
operand_exp_interleave = [x for y in zip(
|
operand_exp_interleave = [x for y in zip(operands, mode_labels) for x in y]
|
||||||
operands, mode_labels) for x in y]
|
|
||||||
operand_exp_interleave.append(out_list)
|
operand_exp_interleave.append(out_list)
|
||||||
return operand_exp_interleave
|
return operand_exp_interleave
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user