Quantum gate decomposition and circuit transformation for quantum hardware compatibility.
This namespace provides functionality to decompose complex quantum gates into simpler, hardware-native operations. It enables quantum circuits to be transformed to match the specific gate sets supported by different quantum hardware platforms and simulators.
Gate Decomposition:
Gate Decomposition Examples
;; Decompose Toffoli gate for CNOT+T gate set
(decompose-operation 
  {:operation-type :toffoli 
   :operation-params {:control1 0 :control2 1 :target 2}}
  :cnot-t)
;; Decompose rotation gate with specific angle
(decompose-operation
  {:operation-type :ry :operation-params {:target 0 :angle (/ Math/PI 3)}}
  #{:rz :x :cnot})
See also: org.soulspace.qclojure.domain.operation-registry for gate definitions.
Quantum gate decomposition and circuit transformation for quantum hardware compatibility.
This namespace provides functionality to decompose complex quantum gates into simpler,
hardware-native operations. It enables quantum circuits to be transformed to match the
specific gate sets supported by different quantum hardware platforms and simulators.
  
Gate Decomposition:
- Decomposes complex gates (Toffoli, Fredkin, etc.) into universal gate sets
- Handles parametric gates (rotation gates with arbitrary angles)
- Supports multiple decomposition strategies based on target hardware
Gate Decomposition Examples
```clojure
;; Decompose Toffoli gate for CNOT+T gate set
(decompose-operation 
  {:operation-type :toffoli 
   :operation-params {:control1 0 :control2 1 :target 2}}
  :cnot-t)
;; Decompose rotation gate with specific angle
(decompose-operation
  {:operation-type :ry :operation-params {:target 0 :angle (/ Math/PI 3)}}
  #{:rz :x :cnot})
```
See also: `org.soulspace.qclojure.domain.operation-registry` for gate definitions.(decompose-operation operation supported-operations)Decompose an operation into a sequence of more primitive operations using the operation catalog.
Parameters:
Returns: Vector of operation maps representing the decomposition, or the original operation if no decomposition is available or if it cannot be fully decomposed to supported operations
Decompose an operation into a sequence of more primitive operations using the operation catalog. Parameters: - operation: operation map to decompose - supported-operations: Set of operation types supported or keyword for hardware target Returns: Vector of operation maps representing the decomposition, or the original operation if no decomposition is available or if it cannot be fully decomposed to supported operations
(decompose-swap-if-needed swap-op supported-operations)Decompose a SWAP gate if it's not natively supported.
Parameters:
Returns: Vector of operation maps representing the decomposition, or the original SWAP operation if supported
Decompose a SWAP gate if it's not natively supported. Parameters: - swap-op: SWAP operation map to decompose - supported-operations: Set of operation types supported by the backend Returns: Vector of operation maps representing the decomposition, or the original SWAP operation if supported
(transform-operations operations supported-operations max-iterations)Transform the operations in a circuit to use only supported operations.
Parameters:
Returns: A vector of transformed operations that are all supported or operations that couldn't be further decomposed
Transform the operations in a circuit to use only supported operations. Parameters: - operations: Original vector of operation maps - supported-operations: Set of operation types supported - max-iterations: Maximum decomposition iterations to prevent infinite loops Returns: A vector of transformed operations that are all supported or operations that couldn't be further decomposed
cljdoc builds & hosts documentation for Clojure/Script libraries
| Ctrl+k | Jump to recent docs | 
| ← | Move to previous article | 
| → | Move to next article | 
| Ctrl+/ | Jump to the search field |