QuantumCircuit
QuantumCircuit
The abstract QuantumCircuit
is the key object in Qadence, as it is what can be executed.
QuantumCircuit(support, *blocks)
dataclass
Am abstract QuantumCircuit instance.
It needs to be passed to a quantum backend for execution.
Arguments:
support: `Register` or number of qubits. If an integer is provided, a register is
constructed with `Register.all_to_all(x)`
*blocks: (Possibly multiple) blocks to construct the circuit from.
Source code in qadence/circuit.py
unique_parameters: list[Parameter]
property
Return the unique parameters in the circuit.
These parameters are the actual user-facing parameters which can be assigned by the user. Multiple gates can contain the same unique parameter
RETURNS | DESCRIPTION |
---|---|
list[Parameter]
|
list[Parameter]: List of unique parameters in the circuit |
dagger()
get_blocks_by_tag(tag)
Extract one or more blocks using the human-readable tag.
This function recursively explores all composite blocks to find all the occurrences of a certain tag in the blocks.
PARAMETER | DESCRIPTION |
---|---|
tag |
the tag to look for
TYPE:
|
RETURNS | DESCRIPTION |
---|---|
list[AbstractBlock]
|
list[AbstractBlock]: The block(s) corresponding to the given tag |
Source code in qadence/circuit.py
parameters()
Extract all parameters for primitive blocks in the circuit.
Notice that this function returns all the unique Parameters used in the quantum circuit. These can correspond to constants too.
RETURNS | DESCRIPTION |
---|---|
list[Parameter | Basic] | list[tuple[Parameter | Basic, ...]]
|
List[tuple[Parameter]]: A list of tuples containing the Parameter |
list[Parameter | Basic] | list[tuple[Parameter | Basic, ...]]
|
instance of each of the primitive blocks in the circuit or, if the |
list[Parameter | Basic] | list[tuple[Parameter | Basic, ...]]
|
flag is set to True, a flattened list of all circuit parameters |