Skip to content

Discrete Time Quantum Walks Extension #449

@JanWojcikPhys

Description

@JanWojcikPhys

Summary

I would like to propose adding a discrete time quantum walks sub-library to QuantumOptics.jl

Motivation

Discrete time quantum walks are fundamental quantum algorithms with applications in quantum search, transport phenomena, and quantum simulation. Currently, there's no comprehensive quantum walk implementation in the Julia quantum ecosystem.

Proposed API

DiscreteTimeQuantumWalks.jl - Extension for QuantumOptics.jl

module DiscreteTimeQuantumWalks
using QuantumOptics
using Plots, LinearAlgebra
import QuantumOptics: Basis, Operator, Ket, tensor, expect
export QuantumWalk, InhomogeneousQW, Psi0, Evolution, PlotDistribution, Heatmap, Eigenenergies, StochasticQW, StochasticResetQW

Core Data Structures

QuantumWalk(lattice_type, N; coin_type=:hadamard, coin_params=Dict(), 
            gauge_field=nothing, boundary=:open)

Build evolution operator for discrete time quantum walk on specified lattice.

Arguments

  • lattice_type: Symbol specifying lattice (:line, :cycle, :grid, :honeycomb)
  • N: Lattice size (Int for 1D, Tuple for higher dimensions)
  • coin_type: Type of coin operator (:hadamard, :grover, :fourier, :custom)
  • coin_params: Dictionary of coin parameters (e.g., Dict(:theta => π/4))
  • gauge_field: Optional gauge field amplitudes for each edge
  • boundary: Boundary conditions (:open, :periodic, :reflecting)

Returns

  • QuantumWalk struct containing evolution operator and system parameters

Examples

# 1D line with Hadamard coin
qw = QuantumWalk(:line, 101)

# 2D grid with parameterized coin
qw = QuantumWalk(:grid, (21, 21), coin_type=:custom, 
                 coin_params=Dict(:theta => π/3, :phi => π/6))

# 1D with gauge field (complex hopping amplitudes)
gauge = exp.(im * rand(100)) # random phases
qw = QuantumWalk(:line, 101, gauge_field=gauge)
InhomogeneousQW(base_qw::QuantumWalk, inhomogeneity_positions, 
               inhomogeneity_type, inhomogeneity_params)

Build evolution operator for inhomogeneous quantum walk with site-dependent coins.

Arguments

  • base_qw: Base homogeneous quantum walk
  • inhomogeneity_positions: Vector of positions with modified properties
  • inhomogeneity_type: Type of inhomogeneity (:theta, :phase, :absorption, :gain)
  • inhomogeneity_params: Parameters for each inhomogeneous site

Returns

  • InhomogeneousQW struct with modified evolution operator

Examples

base_qw = QuantumWalk(:line, 101)

# Different coin angles at specific sites
inhom_qw = InhomogeneousQW(base_qw, [25, 50, 75], :theta, 
                          [π/3, π/6, 2π/3])

# Phase defects
inhom_qw = InhomogeneousQW(base_qw, [50], :phase, [π])

# Absorbing boundaries
inhom_qw = InhomogeneousQW(base_qw, [1, 101], :absorption, [0.1, 0.1])

Initial State Preparation

Psi0(qw::Union{QuantumWalk, InhomogeneousQW}; 
     position=:center, coin_state=:symmetric, custom_state=nothing)

Generate initial state vector for quantum walk.

Arguments

  • qw: Quantum walk system
  • position: Initial position (:center, :left, :right, Int, or Vector{Int})
  • coin_state: Initial coin state (:symmetric, :up, :down, :custom)
  • custom_state: Custom initial state (Ket) if coin_state=:custom

Returns

  • Initial state as QuantumOptics.jl Ket

Examples

qw = QuantumWalk(:line, 101)

# Walker starts at center with symmetric coin
ψ0 = Psi0(qw)

# Walker starts at position 25 with coin in |↑⟩ state  
ψ0 = Psi0(qw, position=25, coin_state=:up)

# Multiple starting positions (superposition)
ψ0 = Psi0(qw, position=[40, 50, 60])

Evolution Functions

Evolution(qw::Union{QuantumWalk, InhomogeneousQW}, initial_state::Ket, 
          tmax::Int; store_intermediate=false)

Perform quantum walk evolution for tmax steps.

Arguments

  • qw: Quantum walk system
  • initial_state: Initial state vector
  • tmax: Number of evolution steps
  • store_intermediate: Whether to store states at each step

Returns

  • Final state after tmax steps (or Vector of states if store_intermediate=true)

Examples

qw = QuantumWalk(:line, 101)
ψ0 = Psi0(qw)

# Evolve for 50 steps
ψ_final = Evolution(qw, ψ0, 50)

# Store all intermediate states
states = Evolution(qw, ψ0, 50, store_intermediate=true)

Visualization Functions

PlotDistribution(state::Ket, qw::Union{QuantumWalk, InhomogeneousQW}; 
                plot_type=:probability, title="", save_path=nothing)

Plot probability distribution after evolution.

Arguments

  • state: Quantum state to plot
  • qw: Quantum walk system (for basis information)
  • plot_type: Type of plot (:probability, :phase, :real, :imag, :wavefunction)
  • title: Plot title
  • save_path: Optional path to save plot

Returns

  • Plots.jl plot object

Examples

qw = QuantumWalk(:line, 101)
ψ0 = Psi0(qw)
ψ_final = Evolution(qw, ψ0, 50)

# Plot probability distribution
PlotDistribution(ψ_final, qw)

# Plot phase information
PlotDistribution(ψ_final, qw, plot_type=:phase)
Heatmap(qw::Union{QuantumWalk, InhomogeneousQW}, initial_state::Ket, 
       tmax::Int; plot_type=:probability, save_path=nothing)

Create heatmap showing probability evolution over time (1D walks only).

Arguments

  • qw: Quantum walk system
  • initial_state: Initial state
  • tmax: Number of evolution steps
  • plot_type: What to plot (:probability, :phase, :real, :imag)
  • save_path: Optional path to save heatmap

Returns

  • Heatmap plot showing evolution over time

Examples

qw = QuantumWalk(:line, 101)
ψ0 = Psi0(qw)

# Create probability heatmap
Heatmap(qw, ψ0, 100)

# Phase evolution heatmap
Heatmap(qw, ψ0, 100, plot_type=:phase)

Spectral Analysis

Eigenenergies(qw::Union{QuantumWalk, InhomogeneousQW}; 
             plot_spectrum=true, analyze_gaps=true)

Calculate and analyze eigenvalues of quantum walk evolution operator.

Arguments

  • qw: Quantum walk system
  • plot_spectrum: Whether to create spectral plot
  • analyze_gaps: Whether to analyze spectral gaps

Returns

  • Dictionary containing:
    • :eigenvalues: Complex eigenvalues
    • :angles: Angles of eigenvalues (quasi-energies)
    • :plot: Spectral plot (if requested)
    • :gap_analysis: Gap analysis results (if requested)

Examples

qw = QuantumWalk(:line, 101)
spectrum = Eigenenergies(qw)

# Access quasi-energies
angles = spectrum[:angles]

# Inhomogeneous walk spectrum
inhom_qw = InhomogeneousQW(qw, [50], :theta, [π/3])
inhom_spectrum = Eigenenergies(inhom_qw)

Stochastic Extensions

StochasticQW(base_qw::QuantumWalk, noise_type::Symbol, noise_strength::Real;
            noise_params=Dict())

Create stochastic quantum walk with environmental noise.

Arguments

  • base_qw: Base deterministic quantum walk
  • noise_type: Type of noise (:dephasing, :amplitude_damping, :phase_flip, :bit_flip)
  • noise_strength: Strength of noise (0 ≤ p ≤ 1)
  • noise_params: Additional noise parameters

Returns

  • StochasticQW struct with noise operators

Examples

qw = QuantumWalk(:line, 101)

# Dephasing noise on coin
stoch_qw = StochasticQW(qw, :dephasing, 0.1)

# Amplitude damping
stoch_qw = StochasticQW(qw, :amplitude_damping, 0.05)
StochasticResetQW(base_qw::QuantumWalk, reset_probability::Real, 
                 reset_position=:center)

Create quantum walk with stochastic reset mechanism.

Arguments

  • base_qw: Base quantum walk
  • reset_probability: Probability of reset at each step
  • reset_position: Position to reset to (:center, :origin, Int)

Returns

  • StochasticResetQW struct

Examples

qw = QuantumWalk(:line, 101)

# 5% chance of reset to center at each step
reset_qw = StochasticResetQW(qw, 0.05)

# Reset to origin (position 1)
reset_qw = StochasticResetQW(qw, 0.1, reset_position=1)

Utility Functions

mean_displacement(state::Ket, qw::Union{QuantumWalk, InhomogeneousQW})

Calculate mean displacement of walker.

variance_displacement(state::Ket, qw::Union{QuantumWalk, InhomogeneousQW})

Calculate variance of walker displacement.

survival_probability(state::Ket, qw::Union{QuantumWalk, InhomogeneousQW}, 
                    origin_radius::Int=0)

Calculate probability of finding walker near origin.

entanglement_entropy(state::Ket, qw::Union{QuantumWalk, InhomogeneousQW})

Calculate entanglement entropy between position and coin degrees of freedom.

Timeline

This would be implemented during summer.

Additional Context

This extension would integrate seamlessly with QuantumOptics.jl's existing Basis, Operator, and Ket types, following established conventions.

@Krastanov

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions