Liking cljdoc? Tell your friends :D

org.soulspace.qclojure.domain.gate-decomposition

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

Circuit Transformation:

  • Transforms entire quantum circuits to use only supported operations
  • Preserves quantum circuit semantics while changing implementation
  • Provides iterative decomposition with cycle detection

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

Circuit Transformation:
- Transforms entire quantum circuits to use only supported operations
- Preserves quantum circuit semantics while changing implementation
- Provides iterative decomposition with cycle detection

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.
raw docstring

decompose-operationclj

(decompose-operation operation 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 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
sourceraw docstring

decompose-swap-if-neededclj

(decompose-swap-if-needed swap-op supported-operations)

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

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
sourceraw docstring

resolve-supported-operationsclj

(resolve-supported-operations supported-operations)

Resolve supported operations - converts keyword targets to gate sets or returns the set as-is.

Parameters:

  • supported-operations: Either a keyword (hardware target) or a set of operation types

Returns: Set of supported operation types

Resolve supported operations - converts keyword targets to gate sets or returns the set as-is.

Parameters:
- supported-operations: Either a keyword (hardware target) or a set of operation types

Returns:
Set of supported operation types
sourceraw docstring

transform-operationsclj

(transform-operations operations supported-operations max-iterations)

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 or keyword for hardware target
  • 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

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 or keyword for hardware target
- 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
sourceraw docstring

cljdoc is a website building & hosting documentation for Clojure/Script libraries

× close