general_decomposer
check_gate_decomposition
Checks that the decomposition gate(s) are valid by verifying that they operate on the same qubits and preserve the quantum state up to a global phase.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
gate
|
Gate
|
Gate that is being decomposed. |
required |
decomposition_gates
|
Iterable[Gate]
|
Gate(s) that are decomposing the original gate. |
required |
Raises:
| Type | Description |
|---|---|
ValueError
|
If the decomposition gates do not operate on the same qubits as the original gate. |
ValueError
|
If the decomposition gates do not preserve the quantum state up to a global phase. |
Source code in opensquirrel/passes/decomposer/general_decomposer.py
decompose
Decomposes the statements in the circuit IR using the provided decomposer.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
ir
|
IR
|
The circuit IR to decompose. |
required |
decomposer
|
Decomposer
|
The decomposer to use for decomposing the gates. |
required |