Skip to main content

q_rust/ir/
gates.rs

1/// Quantum Gate Types
2///
3/// This enum represents the set of supported quantum gates.
4/// It includes standard single-qubit gates (H, X, Y, Z),
5/// two-qubit gates (CX), and parameterized rotation gates (RX, RY, RZ).
6///
7/// # Examples
8///
9/// ```
10/// use q_rust::ir::GateType;
11/// let h_gate = GateType::H;
12/// let rx_gate = GateType::RX(1.57);
13/// ```
14#[derive(Debug, Clone, PartialEq)]
15pub enum GateType {
16    /// Hadamard gate
17    H,
18    /// Pauli-X gate (NOT)
19    X,
20    /// Pauli-Y gate
21    Y,
22    /// Pauli-Z gate
23    Z,
24    /// Controlled-NOT gate
25    CX,
26    /// Rotation around X-axis with angle theta
27    RX(f64),
28    /// Rotation around Y-axis with angle theta
29    RY(f64),
30    /// Rotation around Z-axis with angle theta
31    RZ(f64),
32    /// General unitary gate U(theta, phi, lambda)
33    U(f64, f64, f64),
34    /// Identity gate (wait)
35    ID,
36    /// S gate (sqrt(Z))
37    S,
38    /// S-dagger gate (inverse of S)
39    Sdg,
40    /// T gate (sqrt(S))
41    T,
42    /// T-dagger gate (inverse of T)
43    Tdg,
44    /// Swap gate
45    SWAP,
46    /// Toffoli gate (CCX)
47    CCX,
48    // Add more as needed
49    /// Custom user-defined gate
50    Custom(String),
51}