Skip to main content

Quantum Gates

Quantum gates are the building blocks of quantum circuits. This guide covers the basic gates available in LeafSheep QVU.

Single-Qubit Only Gates

These gates cannot be used as controlled operations.

Basic Gates

  • H (Hadamard): Creates superposition states
    • No parameters
    • Color: Gold (#FFD700)
Hadamard gate icon in gold color
  • I (Identity): Does nothing to the qubit state
    • No parameters
    • Color: Light Pink (#FFB6C1)
Identity gate icon in light pink color

Phase Gates

  • S Gate: Fixed π/2 phase rotation
    • No parameters (equivalent to P(π/2))
    • Color: Turquoise (#00CED1)
S gate icon in turquoise color
  • T Gate: Fixed π/4 phase rotation
    • No parameters (equivalent to P(π/4))
    • Color: Tomato (#FF6347)
T gate icon in tomato color

Special Operations

  • Reset to |0⟩: Resets qubit to ground state
    • No parameters
    • Color: Light Gray (#D3D3D3)
Reset gate icon in light gray color

Controllable Gates

These gates can be used with control qubits.

Example of controlled gates with control points

Pauli Gates

  • X (NOT Gate): Flips the state of a qubit
    • No parameters
    • Control qubits: Up to maximum qubit number
    • Color: Light Green (#98FB98)
X gate icon in light green color
  • Y Gate: Rotates the state around Y-axis
    • No parameters
    • Control qubits: Up to 1
    • Color: Light Pink (#FFB6C1)
Y gate icon in light pink color
  • Z Gate: Adds a phase difference
    • No parameters
    • Control qubits: Up to 2
    • Color: Silver (#B8C0C0)
Z gate icon in silver color

Rotation Gates

  • RX(θ): Rotation around X-axis
    • Parameter θ (theta): Value from -2 to 2 (multiplied by π)
    • Control qubits: Up to 1
    • Color: Yellow (#FFFF00)
RX gate icon in yellow color with parameter panel
  • RY(θ): Rotation around Y-axis
    • Parameter θ (theta): Value from -2 to 2 (multiplied by π)
    • Control qubits: Up to 1
    • Color: Yellow (#FFFF00)
RY gate icon in yellow color with parameter panel
  • RZ(φ): Rotation around Z-axis
    • Parameter φ (phi): Value from -2 to 2 (multiplied by π)
    • Control qubits: Up to 1
    • Color: Yellow (#FFFF00)
RZ gate icon in yellow color with parameter panel

Phase Gates

  • P(θ): Phase rotation
    • Parameter θ (theta): Value from -2 to 2 (multiplied by π)
    • Control qubits: Up to 1
    • Color: Light Green (#98FB98)
P gate icon in light green color with parameter panel

Universal Gate

  • U3(θ,φ,λ): General single-qubit rotation
    • Parameter θ (theta): Value from 0 to 1 (multiplied by π)
    • Parameter φ (phi): Value from -2 to 2 (multiplied by π)
    • Parameter λ (lambda): Value from -2 to 2 (multiplied by π)
    • Control qubits: Up to 1
    • Color: Bisque (#FFE4C4)
U3 gate icon in bisque color with parameter panel

Parameter Panel

When you select and hover a gate, the parameter panel appears next to the gate:

  • Enter values between -2 and 2 (these are multiplied by π)
  • Values are multipliers of π (e.g., 0.5 means 0.5π)
Example of parameter panel with mathematical expressions

Common Parameter Values

Here are some frequently used parameter values:

  • 0.5: Means 0.5π (π/2), used in S gates
  • 0.25: Means 0.25π (π/4), used in T gates
  • 1.0: Means π, full phase rotation
  • -0.5: Means -0.5π (-π/2), inverse rotation
note

All angle parameters are multipliers of π. For example:

  • Entering 0.5 means 0.5π (or π/2)
  • Entering 0.25 means 0.25π (or π/4)
  • Entering 1 means π
  • Entering -2 means -2π

Tips for Working with Parameters

  • Use mathematical expressions for precise values (e.g., "1/2" for π/2)
  • Parameters update the circuit in real-time

Using Gates in LeafSheep QVU

  1. Select a gate from the left panel
  2. Drag it onto your circuit

Example: Creating a CNOT Gate

  1. Add an X gate to your circuit
  2. Hover over the X gate to reveal control points
  3. Click and drag from the control point to another qubit
  4. The X gate is now controlled by the other qubit (CNOT)
Example showing steps to create a CNOT gate