> ## Documentation Index
> Fetch the complete documentation index at: https://dynex.mintlify.app/llms.txt
> Use this file to discover all available pages before exploring further.

# Quantum Gates

> Quantum gate reference for PennyLane, Qiskit, and OpenQASM on Dynex

# Quantum Gates on Dynex

Quantum gates are the building blocks of quantum circuits. Each gate performs a specific unitary operation on one or more qubits, altering their probability amplitudes and phases. Dynex supports all standard gates via PennyLane, Qiskit, and OpenQASM.

## Single-Qubit Gates

### Pauli-X (NOT gate)

Flips the qubit state: X|0⟩ = |1⟩, X|1⟩ = |0⟩.

| Framework | Syntax                |
| --------- | --------------------- |
| PennyLane | `qml.PauliX(wires=0)` |
| OpenQASM  | `x q[0];`             |
| Qiskit    | `qc.x(0)`             |

### Pauli-Y

Phase flip then bit flip: Y|0⟩ = i|1⟩, Y|1⟩ = −i|0⟩.

| Framework | Syntax                |
| --------- | --------------------- |
| PennyLane | `qml.PauliY(wires=0)` |
| OpenQASM  | `y q[0];`             |
| Qiskit    | `qc.y(0)`             |

### Pauli-Z

Phase flip: Z|0⟩ = |0⟩, Z|1⟩ = −|1⟩.

| Framework | Syntax                |
| --------- | --------------------- |
| PennyLane | `qml.PauliZ(wires=0)` |
| OpenQASM  | `z q[0];`             |
| Qiskit    | `qc.z(0)`             |

### Hadamard (H)

Creates equal superposition: H|0⟩ = (|0⟩ + |1⟩)/√2.

| Framework | Syntax                  |
| --------- | ----------------------- |
| PennyLane | `qml.Hadamard(wires=0)` |
| OpenQASM  | `h q[0];`               |
| Qiskit    | `qc.h(0)`               |

### T Gate

Applies a π/4 phase shift. Non-Clifford gate essential for universal quantum computation.

| Framework | Syntax           |
| --------- | ---------------- |
| PennyLane | `qml.T(wires=0)` |
| OpenQASM  | `t q[0];`        |
| Qiskit    | `qc.t(0)`        |

## Rotation Gates

### RX, RY, RZ

Single-axis rotations by angle `θ`.

| Gate | PennyLane                | Qiskit            |
| ---- | ------------------------ | ----------------- |
| RX   | `qml.RX(theta, wires=0)` | `qc.rx(theta, 0)` |
| RY   | `qml.RY(theta, wires=0)` | `qc.ry(theta, 0)` |
| RZ   | `qml.RZ(theta, wires=0)` | `qc.rz(theta, 0)` |

## Two-Qubit Gates

### CNOT (CX)

Flips target qubit if control qubit is |1⟩.

| Framework | Syntax                   |
| --------- | ------------------------ |
| PennyLane | `qml.CNOT(wires=[0, 1])` |
| OpenQASM  | `cx q[0], q[1];`         |
| Qiskit    | `qc.cx(0, 1)`            |

### Controlled-Z (CZ)

Applies Z to target if control is |1⟩.

| Framework | Syntax                 |
| --------- | ---------------------- |
| PennyLane | `qml.CZ(wires=[0, 1])` |
| OpenQASM  | `cz q[0], q[1];`       |
| Qiskit    | `qc.cz(0, 1)`          |

### SWAP (Fredkin)

Exchanges the states of two qubits.

| Framework | Syntax                   |
| --------- | ------------------------ |
| PennyLane | `qml.SWAP(wires=[0, 1])` |
| OpenQASM  | `swap q[0], q[1];`       |
| Qiskit    | `qc.swap(0, 1)`          |

### Controlled Rotations (CRX, CRY, CRZ)

Apply rotation to target qubit if control is |1⟩.

| Gate | PennyLane                      | Qiskit                |
| ---- | ------------------------------ | --------------------- |
| CRX  | `qml.CRX(theta, wires=[0, 1])` | `qc.crx(theta, 0, 1)` |
| CRY  | `qml.CRY(theta, wires=[0, 1])` | `qc.cry(theta, 0, 1)` |
| CRZ  | `qml.CRZ(theta, wires=[0, 1])` | `qc.crz(theta, 0, 1)` |

### Controlled Phase Shift

Applies phase shift to target if control is |1⟩.

| Framework | Syntax                                          |
| --------- | ----------------------------------------------- |
| PennyLane | `qml.ControlledPhaseShift(theta, wires=[0, 1])` |
| Qiskit    | `qc.cp(theta, 0, 1)`                            |

## Three-Qubit Gates

### Toffoli (CCNOT)

Flips target if both control qubits are |1⟩.

| Framework | Syntax                         |
| --------- | ------------------------------ |
| PennyLane | `qml.Toffoli(wires=[0, 1, 2])` |
| OpenQASM  | `ccx q[0], q[1], q[2];`        |
| Qiskit    | `qc.ccx(0, 1, 2)`              |

## Advanced Operations

### Quantum Fourier Transform (QFT)

```python theme={null}
# PennyLane
def qft(wires):
    qml.QFT(wires=wires)

# Qiskit
from qiskit.circuit.library import QFT
qc.append(QFT(num_qubits).decompose(), range(num_qubits))
```

### Adjoint (Dagger)

```python theme={null}
# PennyLane
qml.adjoint(qml.Hadamard)(wires=0)

# Qiskit
qc.h(0).inverse()
```

### Basis Embedding

Encodes classical binary data into quantum states:

```python theme={null}
# PennyLane
qml.BasisEmbedding(features, wires=[0, 1, 2])
```

### Controlled Unitary (CU)

```python theme={null}
# PennyLane
qml.ControlledQubitUnitary(U_matrix, control_wires=[0], wires=[1])
```

## Next: Running circuits on Dynex

See [DynexCircuit Class](/circuits/dynex-circuit) to learn how to execute these gates on the Dynex platform.
