Support
The support
module
The support
module defines a Support
type to handle qubit support for single, multi and controlled quantum operations.
Support(*indices, target=None, control=None)
A class to handle the qubit support providing easy initialization for single, multi, and controlled qubit operations.
The class can be initialized in three ways:
Support(i)
for single qubit support.Support(i₀,...,iₙ)
for supports covering indices{i₀,...,iₙ}
use either by multi-indices operation or to span single indices operations over multiple indices.Support(target=(i₀,...), control=(j₀,...))
for controled operations wheretarget
andcontrol
are disjoint sets.
PARAMETER | DESCRIPTION |
---|---|
indices
|
Qubit indices where an operation is applied; all listed qubits are the target qubits.
TYPE:
|
target
|
Tuple of qubit indices where a given operation is applied; not valid if
TYPE:
|
control
|
Tuple of qubit indices used to control an operation; not valid without
TYPE:
|
METHOD | DESCRIPTION |
---|---|
`subspace` |
returns the set of indices covered by the support. |
`overlap_with` |
returns true if a support overlaps with another (not distinguishing between target and controls). |
`join` |
merge two supports. |
Source code in qadence2_expressions/core/support.py
control: tuple[int, ...]
property
Returns the indices used to control a given operation.
max_index: int
cached
property
Returns the largest index within the specified subspace, whether it is a target or
control. If the support is applied to all qubits, it returns -1
.
subspace: set[int]
cached
property
Returns a set containing all the indices covered by the support.
target: tuple[int, ...]
property
Returns the indices to which a given operation is applied.
__lt__(other)
Implement partial order to qubit supports.
join(other)
Merge two support's indices according the following rules.
-
If one of the supports cover all the indices, the result also covers all the indices.
-
If the target of one support overlaps with the control of the other support, the resul is a support which the target covers all the indices without target.
-
Otherwise, the targets and the controls are merged.
Source code in qadence2_expressions/core/support.py
overlap_with(other)
Returns true if both supports cover common indices.
Source code in qadence2_expressions/core/support.py
target_all()
classmethod
Return a support that covers all qubits, regardless of range or total number of qubits.