FibonacciChain.jl

FibonacciChain.jl is a Julia package for simulating 1D interacting anyons chain, particularly focusing on Fibonacci anyons and related topological systems.

Overview

This package provides comprehensive tools for studying anyon chains based on the principle that, $(2+1) \mathrm{D}$ bulk TQFT has correspondence to $(1+1) \mathrm{D}$ boundary CFT. Similar to the Heisenberg model where singlet states have lower energy, fusion outcomes with trivial topological charge are energetically preferred. Then we can write down a interacting Hamiltonian.

Supported Anyon Types

The package currently supports three types of anyonic systems:

  • Ising Anyons (SU(2)₂): Majorana fermions with non-Abelian statistics
  • Fibonacci Anyons (SU(2)₃): Universal anyons for quantum computation
  • Spin-1/2 Systems (SU(2)∞): Regular spin systems

Key Features

  • Exact Diagonalization: Full quantum many-body calculations for small systems
  • Matrix Product States (MPS): Efficient simulation of larger systems using ITensors.jl
  • Measurement Protocols: Quantum measurement and post-selection dynamics
  • Topological Properties: Utilizing topological symmetry sector.
  • Anyon Operations: Implementation of anyonic braiding and exchange statistics, fusion operation.

Installation

using Pkg
Pkg.add("FibonacciChain")

Quick Start

using FibonacciChain

# Create a Fibonacci anyon chain with N=6 sites
N = 6
model = AnyonModel(FibonacciAnyon(), N; pbc=true)
basis = anyon_basis(model)  # periodic boundary conditions

# Generate the Hamiltonian
H = anyon_ham(model)

# Find ground state
eigenvals, eigenvecs = eigen(H)
ground_state = eigenvecs[:, 1]

# Calculate entanglement entropy profile
ee_profile = anyon_eelis(model, ground_state)

Documentation Sections

Theoretical Background

The package implements the anyon chain Hamiltonian described in Phys. Rev. Lett. 98, 160409 (2007), where the energy scale is determined by favoring trivial fusion channels in three-body interactions.

For Fibonacci anyons, the local Hamiltonian terms involve three consecutive anyons and depend on their fusion outcomes according to the golden ratio φ = (1+√5)/2, which characterizes the Fibonacci fusion algebra.

API Reference

FibonacciChain.AnyonModelType
AnyonModel(anyon_type::AbstractAnyonType, N::Int; pbc::Bool=true, measure_operator::Symbol=:Antiferro, kwargs...)

Represents a 1D anyon chain model.

Fields

  • anyon_type::AbstractAnyonType: The type of anyon, e.g., FibonacciAnyon() or IsingAnyon().
  • N::Int: The number of sites in the chain.
  • pbc::Bool: A boolean indicating whether periodic boundary conditions are applied (true) or not (false).
  • measure_operator::Symbol: The operator type used for defining the Hamiltonian, e.g., :Antiferro or :Ferro for Fibonacci anyons.
  • params::Dict{Symbol, Any}: Additional model parameters (e.g., J, h for Ising model).

Examples

# Fibonacci anyon model
model_fibo = AnyonModel(FibonacciAnyon(), 6; pbc=true, measure_operator=:Antiferro)

# Ising model with custom couplings
model_ising = AnyonModel(IsingAnyon(), 10; pbc=true, measure_operator=:X, J=1.0, h=0.5)

# Access parameters
model_ising.params[:J]  # returns 1.0
source
FibonacciChain.MeasureConfigType

Configuration struct for measurement evolution parameters.

Fields

  • τ::Float64: Measurement strength parameter
  • t₂::Int: 2*Number of measurement layers (time steps)
  • rng::MersenneTwister: Random number generator (default: MersenneTwister())
  • mode::Symbol: Sampling mode, one of :sample, :Born (default: :sample)
  • t₁::Int: Starting layer index for evolution (default: 1)
  • verbose::Bool: Verbosity flag for detailed output (default: false)
  • enable_τ_eff::Bool: Whether to enable half-strength measurement for the last layer (default: true)
  • λ::Float64: O'Brien-Fendley coupling strength (default: 0.0, pure Ising when λ=0)
source
FibonacciChain.FibomapMethod
Fibomap(state::T, i::Int; ferro::Bool=false) where {N, T <: BitStr{N}}

Apply Fibonacci anyon projection term at site i (Temperley-Lieb generator).

Fibonacci Hamiltonian structure:

The Hamiltonian H = ∑i πi acts on the fusion tree with local terms. Each term π_i depends on the local fusion outcomes at sites i-1, i, i+1.

Fusion rules for Fibonacci anyons:

  • τ × τ = 1 + τ (two τ's can fuse to vacuum 1 or τ)
  • τ × 1 = τ (τ with vacuum gives τ)
  • 1 × 1 = 1 (two vacuums give vacuum)

Returns

  • (state, X_state, diag_weight, off_diag_weight):
    • state: original state (diagonal contribution)
    • X_state: flipped state at site i (off-diagonal)
    • diag_weight, off_diag_weight: matrix element weights
source
FibonacciChain.Fsymmetry_coefMethod
Fsymmetry_coef(::FibonacciAnyon, ::Type{T}, state::T, base::T; pbc::Bool=true) where {N, T <: BitStr{N}}
Fsymmetry_coef(model::AnyonModel{FibonacciAnyon}, state::T, base::T)

Compute topological symmetry coefficient for state in given base configurations for Fibonacci anyon chain.

Arguments

Low-level interface

  • ::FibonacciAnyon: Fibonacci anyon type instance
  • ::Type{T}: BitStr type specifying chain length N
  • state::T: Target state configuration
  • base::T: Base state configuration
  • pbc::Bool=true: Periodic boundary conditions

High-level interface

  • model::AnyonModel{FibonacciAnyon}: Anyon model containing system parameters
  • state::T: Target state configuration
  • base::T: Base state configuration

Returns

  • Float64: Topological symmetry coefficient based on Fibonacci fusion rules

Examples

julia> using FibonacciChain, BitBasis

julia> N = 4; T = BitStr{N, Int};

julia> model = AnyonModel(FibonacciAnyon(), N; pbc=true);

julia> state = T(0b1010); ϕ = (1 + sqrt(5)) / 2;

julia> base = T(0b0101);

julia> coef = Fsymmetry_coef(model, state, base); coef ≈ 0.3819660112501051
true
source
FibonacciChain.OBFmapMethod
OBFmap(state::T, i::Int, pbc::Bool=true) where {N, T <: BitStr{N}}

Apply O'Brien-Fendley terms (Xi Z{i} Z{i+2} + Zi Z{i+1} X{i+2}) at site i.

Returns (output_states, weights) for the XZZ + ZZX terms in the OBF Hamiltonian. For OBC, valid range is 1 ≤ i ≤ N-2. For PBC, valid range is 1 ≤ i ≤ N with periodic wrapping.

source
FibonacciChain._apply_measurement_layerMethod
_apply_measurement_layer(model::AnyonModel, τ::Float64, state::Vector{T}, 
                          layer_sample::BitVector; layer_idx::Int=1) where {T}

Apply deterministic measurements to a layer with given measurement outcomes.

Arguments

  • model::AnyonModel: Anyon model containing system parameters
  • τ::Float64: Measurement strength parameter
  • state::Vector{T}: Quantum state vector
  • layer_sample::BitVector: Measurement outcomes for the layer
  • layer_idx::Int=1: Layer index (1-based) to determine measurement pattern

Returns

  • Measurement_outcome_boundary: A struct containing the post-measurement state, sample, and total free energy.
source
FibonacciChain._born_measure_mpsMethod
_born_measure_mps(model, sites, current_state, measure_config; ...)

Evolve an MPS state using probabilistic Born-rule sampling for a specified number of time steps.

This internal helper function is called by bulk_evolution when mode is :Born.

Arguments

  • model::AnyonModel: The anyon model.
  • sites: ITensor site indices.
  • current_state::MPS: The initial MPS state.
  • measure_config::MeasureConfig: Configuration containing τ, t₁, t₂, rng, etc.
  • cutoff::Float64=1e-10: MPS truncation cutoff.
  • maxdim::Int=100: Maximum bond dimension.

Returns

  • Measurement_outcome_mps_bulk: A struct containing:
    • states::Vector{MPS}: Intermediate states at each full time step.
    • samples::BitMatrix: The generated measurement outcome sequences.
    • free_energy::Vector{Float64}: The free energy for each measurement layer.
source
FibonacciChain._braidingsq_applyMethod
_braidingsq_apply(model::AnyonModel{FibonacciAnyon}, state::T, i::Int) where {N, T <: BitStr{N}}

Apply braiding squared operation on a single basis state at specified site.

Arguments

  • model::AnyonModel{FibonacciAnyon}: Fibonacci anyon model containing system parameters
  • state::T: Single basis state (BitStr)
  • i::Int: Site index for braiding operation

Returns

  • Tuple{T, T, ComplexF64, ComplexF64}: (outputstate1, outputstate2, coefficient1, coefficient2)

Braiding is a fundamental topological operation that exchanges adjacent anyons.

source
FibonacciChain._get_sample_column_indicesMethod
_get_sample_column_indices(model::AnyonModel, layer_idx::Int) -> Vector{Int}

Get the column indices in the samples BitMatrix for a given layer.

For models where different layers have different numbers of measurement sites, this maps the measurement sites to fixed column positions in the samples matrix.

Returns

  • Vector of column indices where this layer's samples should be stored/read
source
FibonacciChain._reference_apply_measurement_layerMethod
_reference_apply_measurement_layer(model::AnyonModel, τ::Float64, state::Vector{ET},
                                   layer_sample::BitVector, layer_idx::Int64;
                                   extended_basis::Vector{newT}, k_old::Int64=1) where {ET, newT}

Apply deterministic measurements to a layer with given outcomes for states with reference qubits.

Arguments

  • model::AnyonModel: Anyon model containing system parameters
  • τ::Float64: Measurement strength parameter
  • state::Vector{ET}: Quantum state vector with reference qubits
  • layer_sample::BitVector: Measurement outcomes for the layer
  • layer_idx::Int64: Layer index (1-based) to determine measurement pattern
  • extended_basis::Vector{newT}: Extended basis with reference qubits
  • k_old::Int64=1: Number of reference qubits in the state

Returns

  • Measurement_outcome_boundary: A struct containing the post-measurement state, sample, and total free energy.
source
FibonacciChain._reference_born_measureMethod
_reference_born_measure(model::AnyonModel, state::Vector{ET}, measure_config::MeasureConfig;
                        extended_basis::Vector{newT}, k_old::Int64=1) where {ET, newT}

Evolve a reference qubit state using probabilistic Born-rule sampling.

This internal helper function is called by reference_bulk_evolution when mode is :Born.

Arguments

  • model::AnyonModel: The anyon model.
  • state::Vector{ET}: The initial state with reference qubits.
  • measure_config::MeasureConfig: Configuration containing τ, t₁, t₂, rng, etc.
  • extended_basis::Vector{newT}: Extended basis with reference qubits.
  • k_old::Int64=1: Number of reference qubits in the state.

Returns

  • Measurement_outcome_bulk: A struct containing:
    • states::Vector{Vector{ET}}: Intermediate states at each full time step.
    • samples::BitMatrix: The generated measurement outcome sequences.
    • free_energys::Vector{Float64}: The free energy for each measurement layer.
source
FibonacciChain._reference_sample_layerMethod
_reference_sample_layer(model::AnyonModel, τ_eff::Float64, state::Vector{T}, 
                        rng::MersenneTwister=MersenneTwister(), layer_idx::Int64=1;
                        extended_basis::Vector{newT}, k_old::Int64=1, 
                        verbose::Bool=false) where {T, newT}

Perform random measurement on a layer using Born rule sampling for states with reference qubits.

Arguments

  • model::AnyonModel: Anyon model containing system parameters
  • τ_eff::Float64: Effective measurement strength parameter
  • state::Vector{T}: Quantum state vector with reference qubits
  • rng::MersenneTwister=MersenneTwister(): Random number generator
  • layer_idx::Int64=1: Layer index (1-based) to determine measurement pattern
  • extended_basis::Vector{newT}: Extended basis with reference qubits
  • k_old::Int64=1: Number of reference qubits in the state
  • verbose::Bool=false: Whether to print debug information

Returns

  • Measurement_outcome_boundary: A struct containing the post-measurement state, sample outcomes, and free energy.
source
FibonacciChain._reference_sample_measureMethod
_reference_sample_measure(model::AnyonModel, state::Vector{ET}, samples::BitMatrix,
                          measure_config::MeasureConfig;
                          extended_basis::Vector{newT}, k_old::Int64=1) where {ET, newT}

Evolve a reference qubit state using a predefined measurement trajectory.

This internal helper function is called by reference_bulk_evolution when mode is :sample.

Arguments

  • model::AnyonModel: The anyon model.
  • state::Vector{ET}: The initial state with reference qubits.
  • samples::BitMatrix: The predefined measurement outcomes.
  • measure_config::MeasureConfig: Configuration containing τ, t₁, t₂, etc.
  • extended_basis::Vector{newT}: Extended basis with reference qubits.
  • k_old::Int64=1: Number of reference qubits in the state.

Returns

  • Measurement_outcome_bulk: A struct containing:
    • states::Vector{Vector{ET}}: Intermediate states at each full time step.
    • samples::BitMatrix: The input measurement outcome sequences.
    • free_energys::Vector{Float64}: The free energy for each measurement layer.
source
FibonacciChain._sample_layerMethod
_sample_layer(model::AnyonModel, τ::Float64, state::Vector{T};
               layer_idx::Int=1, rng::MersenneTwister=MersenneTwister(), 
               verbose::Bool=false) where {T}

Perform random measurement on a layer using Born rule sampling.

Arguments

  • model::AnyonModel: Anyon model containing system parameters
  • τ::Float64: Measurement strength parameter
  • state::Vector{T}: Quantum state vector
  • layer_idx::Int=1: Layer index (1-based) to determine measurement pattern
  • rng::MersenneTwister: Random number generator
  • verbose::Bool=false: Whether to print debug information

Returns

  • Measurement_outcome_boundary: A struct containing the post-measurement state, sample outcomes, and free energy.
source
FibonacciChain._sample_measure_mpsMethod
_sample_measure_mps(model, sites::Vector{<:Index}, current_state, samples, measure_config; ...)

Evolve an MPS state using a predefined measurement trajectory.

This internal helper function is called by bulk_evolution when mode is :sample.

Arguments

  • model::AnyonModel: The anyon model.
  • sites::Vector{<:Index}: ITensor site indices.
  • current_state::MPS: The initial MPS state.
  • samples::BitMatrix: The predefined measurement outcomes.
  • measure_config::MeasureConfig: Configuration containing τ, t₁, t₂, etc.
  • cutoff::Float64=1e-10: MPS truncation cutoff.
  • maxdim::Int=100: Maximum bond dimension.

Returns

  • Measurement_outcome_mps_bulk: A struct containing:
    • states::Vector{MPS}: Intermediate states at each full time step.
    • samples::BitMatrix: The input measurement outcome sequences.
    • free_energy::Vector{Float64}: The free energy for each measurement layer.
source
FibonacciChain.actingHamMethod
actingHam(model::AnyonModel{FibonacciAnyon}, state::T) where {N, T <: BitStr{N}}

Act the Fibonacci anyon Hamiltonian on a given state.

Physics

The Fibonacci anyon chain Hamiltonian consists of Temperley-Lieb generators e_i:

  • H = -∑i ei (ferromagnetic) or H = +∑i ei (antiferromagnetic)
  • Each e_i acts on the fusion space at site i with constraints from neighbors

Fusion Rules

For Fibonacci anyons: τ × τ = 1 + τ

  • Configuration 0x0 (neighbors are trivial): allows Fibomap operation
  • Configuration 101, 100, 001: contributes diagonal energy from fusion constraints
  • Configuration 111 (three consecutive τ): additional fusion contribution (PBC only)

Returns

Dict{T, Float64}: mapping from output states to their coefficients

source
FibonacciChain.add_reference_qubitsMethod
add_reference_qubits(model::AnyonModel, ψ::MPS, sites::Vector{<:Index}, site_idx::Int=1;
                     k_new::Int=1, verbose::Bool=false) -> Tuple{MPS, Vector{<:Index}}

Add reference qubits to an MPS state at specified site using copy method for correlation measurements.

Principle

Reference qubits are ancillary qubits used to probe spatial and temporal correlations in monitored quantum systems. The key idea is to create a maximally entangled state between the reference qubit and a system qubit at a specific site, enabling measurement of correlations through the reference qubit's reduced density matrix.

Copy Method

Creates a controlled-copy (CNOT-like) entanglement:

  • If the system qubit at site_idx is in state |0⟩, the reference qubit becomes |0⟩
  • If the system qubit at site_idx is in state |1⟩, the reference qubit becomes |1⟩

Mathematically, for a state |ψ⟩ = α|0⟩ + β|1⟩ at site_idx:

    |ψ⟩ → α|00⟩ + β|11⟩  (reference ⊗ system)

This preserves the original state's structure while creating classical correlation.

For reset method (measure system qubit first, then create Bell pair), use add_reference_qubits_reset instead.

Arguments

  • model::AnyonModel: Anyon model containing system parameters
  • ψ::MPS: Input MPS quantum state
  • sites: ITensor site indices
  • site_idx::Int=1: Site index to entangle with reference qubit (1 ≤ site_idx ≤ N)
  • k_new::Int=1: Number of reference qubits to add (must be 0 or 1)
  • verbose::Bool=false: Enable verbose output for debugging

Returns

  • MPS: New MPS with reference qubit added at the leftmost position
  • Vector{Index}: Updated site indices including the new reference qubit

Notes

  • Each system qubit can only be entangled with one reference qubit
  • To add multiple reference qubits at different sites, call this function multiple times
  • The reference qubit is inserted at position 1 (leftmost) of the MPS
  • Original MPS is not modified (returns a new copy)

Example

model = AnyonModel(FibonacciAnyon(), 6)
ψ, sites = anyon_mps_gst(model)
ψ_ref, sites_ref = add_reference_qubits(model, ψ, sites, 3)  # Add ref qubit at site 3

See also: add_reference_qubits_reset

source
FibonacciChain.add_reference_qubitsMethod
add_reference_qubits(model::AnyonModel, state::Vector{ET}, site_idx::Int64; 
                     k_new::Int=1, verbose::Bool=false) -> Vector{ET}

Add reference qubits to a quantum state at specified site using copy method for correlation measurements.

Principle

Reference qubits are ancillary qubits used to probe spatial and temporal correlations in monitored quantum systems. The key idea is to create a maximally entangled state between the reference qubit and a system qubit at a specific site, enabling measurement of correlations through the reference qubit's reduced density matrix.

Copy Method

Creates a controlled-copy (CNOT-like) entanglement:

  • If the system qubit at site_idx is in state |0⟩, the reference qubit becomes |0⟩
  • If the system qubit at site_idx is in state |1⟩, the reference qubit becomes |1⟩

Mathematically, for a state |ψ⟩ = α|0⟩ + β|1⟩ at site_idx:

    |ψ⟩ → α|00⟩ + β|11⟩  (system ⊗ reference)
    |ψ⟩ → α|A0⟩ + β|B1⟩  (system ⊗ reference), where A, B are orthogonal states

This preserves the original state's structure while creating classical correlation.

For reset method (measure system qubit first, then create Bell pair), use add_reference_qubits_reset instead.

Basis Structure

The extended basis combines reference qubits (prefix) with the Fibonacci/Ising constraint basis (suffix):

    |extended_basis⟩ = |ref₁ ref₂ ... refₖ⟩ ⊗ |system basis⟩

Reference qubits are stored as the leftmost (highest) bits in the binary representation.

Arguments

  • model::AnyonModel: Anyon model containing system size N, boundary conditions, etc.
  • state::Vector{ET}: Quantum state vector (may already contain k_old reference qubits)
  • site_idx::Int64: Site index for reference qubit insertion (1 ≤ site_idx ≤ N)
  • k_new::Int=1: Number of new reference qubits to add (must be 0 or 1)
  • verbose::Bool=false: Enable verbose output for debugging

Returns

  • Vector{ET}: New normalized state with reference qubit added

Notes

  • Each system qubit can only be entangled with one reference qubit
  • To add multiple reference qubits at different sites, call this function multiple times
  • The number of existing reference qubits (k_old) is automatically deduced from state length
  • State dimension grows as: newdim = 2^(kold + knew) × len(Fibonaccibasis)

Example

# Add first reference qubit at site 1
state1 = add_reference_qubits(model, initial_state, 1)

# Add second reference qubit at site N÷2
state2 = add_reference_qubits(model, state1, N÷2)

# Now state2 has 2 reference qubits for 2-point correlation measurement

See also: add_reference_qubits_reset, reference_rdm, reference_evolution, build_extended_basis

source
FibonacciChain.add_reference_qubits_resetMethod
add_reference_qubits_reset(model::AnyonModel, ψ::MPS, sites::Vector{<:Index}, site_idx::Int=1;
                           k_new::Int=1, verbose::Bool=false) -> Tuple{Float64, Float64, MPS, MPS, Vector{Index}}

Add reference qubits using reset method: first measures/resets the system qubit, then creates a Bell pair.

Principle

  1. Project the system qubit onto |0⟩ or |1⟩ basis (strong measurement)
  2. Create a Bell pair between the reset qubit and reference qubit
  3. Returns both branches with their probabilities

This method is useful when you want to prepare a known initial state before adding the reference qubit.

Arguments

  • model::AnyonModel: Anyon model containing system parameters
  • ψ::MPS: Input MPS quantum state
  • sites: ITensor site indices
  • site_idx::Int=1: Site index for reference qubit insertion (1 ≤ site_idx ≤ N)
  • k_new::Int=1: Number of new reference qubits to add (must be 0 or 1)
  • verbose::Bool=false: Enable verbose output for debugging

Returns

  • Float64: Probability of measuring |0⟩ at site_idx
  • Float64: Probability of measuring |1⟩ at site_idx
  • MPS: State after measuring |0⟩ and adding Bell pair
  • MPS: State after measuring |1⟩ and adding Bell pair
  • Vector{Index}: Updated site indices including the new reference qubit

Notes

  • Unlike add_reference_qubits, this method returns both measurement branches
  • The probabilities satisfy prob₀ + prob₁ = 1
  • Each returned MPS is normalized

Example

model = AnyonModel(FibonacciAnyon(), 6)
ψ, sites = anyon_mps_gst(model)
prob0, prob1, ψ0, ψ1, sites_ref = add_reference_qubits_reset(model, ψ, sites, 3)
# Use ψ0 with probability prob0, or ψ1 with probability prob1

See also: add_reference_qubits

source
FibonacciChain.add_reference_qubits_resetMethod
add_reference_qubits_reset(model::AnyonModel, state::Vector{ET}, site_idx::Int64; 
                            k_new::Int=1, verbose::Bool=false) -> Tuple{Float64, Float64, Vector{ET}, Vector{ET}}

Add reference qubits using reset method: first measures/resets the system qubit, then creates a Bell pair.

Principle

  1. Project the system qubit onto |0⟩ or |1⟩ basis (strong measurement)
  2. Create a Bell pair between the reset qubit and reference qubit
  3. Returns both branches with their probabilities

This method is useful when you want to prepare a known initial state before adding the reference qubit.

Arguments

  • model::AnyonModel: Anyon model containing system size N, boundary conditions, etc.
  • state::Vector{ET}: Quantum state vector (may already contain k_old reference qubits)
  • site_idx::Int64: Site index for reference qubit insertion (1 ≤ site_idx ≤ N)
  • k_new::Int=1: Number of new reference qubits to add (must be 0 or 1)
  • verbose::Bool=false: Enable verbose output for debugging

Returns

  • Tuple{Float64, Float64, Vector{ET}, Vector{ET}}: (prob₀, prob₁, stateafter0, stateafter1) for both measurement branches

See also: add_reference_qubits, reference_rdm, reference_evolution

source
FibonacciChain.anyon_basisMethod
anyon_basis(model::AnyonModel; symmetry_block=nothing)
anyon_basis(anyon_type::AbstractAnyonType, ::Type{T}; pbc::Bool=true, symmetry_block=nothing) where {N, T <: BitStr{N}}

Generate basis states for an anyon chain model.

This function provides two interfaces: a high-level one that takes an AnyonModel object, and a low-level one that takes the model parameters directly.

Arguments

High-level interface

  • model::AnyonModel: An AnyonModel object containing the system parameters (anyon type, size, and boundary conditions).
  • symmetry_block: Optional. The topological charge sector to filter the basis. Not yet implemented.

Low-level interface

  • anyon_type::AbstractAnyonType: The type of anyon, e.g., FibonacciAnyon() or IsingAnyon().
  • T::Type: The BitStr type specifying the chain length N.
  • pbc::Bool=true: Specifies whether to use periodic (true) or open (false) boundary conditions.
  • symmetry_block: Optional. The topological charge sector.

Returns

  • Vector{T}: A sorted vector of the basis states.

Examples

julia> using FibonacciChain, BitBasis

julia> model = AnyonModel(FibonacciAnyon(), 4; pbc=true); basis = anyon_basis(model); length(basis)
7

julia> basis_fibo = anyon_basis(FibonacciAnyon(), BitStr{4, Int}; pbc=true); length(basis_fibo)
7

julia> model_ising = AnyonModel(IsingAnyon(), 4; pbc=true); basis_ising = anyon_basis(model_ising); length(basis_ising)
16
source
FibonacciChain.anyon_basisMethod
anyon_basis(AT::AbstractAnyonType, ::Type{T}, k::Int; symmetry_block=nothing) where {N, T <: BitStr{N}}
anyon_basis(model::AnyonModel, k::Int; symmetry_block=nothing)

Generate basis states in specific momentum sector k and topological sector symmetry_block.

Arguments

Low-level interface

  • AT::AbstractAnyonType: Anyon type instance (e.g., FibonacciAnyon(), IsingAnyon())
  • T::Type: BitStr type specifying chain length N
  • k::Int: Momentum sector (0 ≤ k ≤ N-1)
  • symmetry_block: Topological charge sector (optional)

High-level interface

  • model::AnyonModel: Anyon model containing system parameters
  • k::Int: Momentum sector (0 ≤ k ≤ N-1)
  • symmetry_block: Topological charge sector (optional)

Returns

  • Vector{T}: Basis states in momentum sector k
  • Dict{T, Vector{T}}: Representative mapping for translation equivalence classes

Examples

julia> using FibonacciChain, BitBasis

julia> model = AnyonModel(FibonacciAnyon(), 6; pbc=true);

julia> basisK, basis_dic = anyon_basis(model, 0);

julia> length(basisK) > 0
true
source
FibonacciChain.anyon_eelisMethod
anyon_eelis(model::AnyonModel, ψ::MPS)

Calculate entanglement entropy profile along the chain for MPS state.

Arguments

  • model::AnyonModel: Anyon model containing system parameters
  • ψ::MPS: MPS state

Returns

  • Vector{Float64}: Entanglement entropy at each bipartition from left to right

Examples

julia> using FibonacciChain, ITensorMPS, ITensors

julia> model = AnyonModel(FibonacciAnyon(), 6; pbc=true);

julia> ψ_gs, E0 = anyon_mps_gst(model, maxdim=10, outputlevel=0);

julia> ee_profile = anyon_eelis(model, ψ_gs);

julia> length(ee_profile) == model.N - 1  # Profile has N-1 points
true

julia> all(x -> x ≥ 0, ee_profile)  # All entropies are non-negative
true
source
FibonacciChain.anyon_eelisMethod
anyon_eelis(model::AnyonModel, state::Union{Vector{ET}, Matrix{ET}}) where {ET}

Calculate entanglement entropy profile along the chain for given quantum state or density matrix.

Arguments

  • model::AnyonModel: Anyon model containing system parameters (N, pbc, anyon_type)
  • state::Union{Vector{ET}, Matrix{ET}}: Quantum state vector or density matrix in anyon basis

Returns

  • Vector{Float64}: Entanglement entropy at each bipartition from left to right

Examples

julia> using FibonacciChain, LinearAlgebra

julia> N = 6;

julia> model = AnyonModel(FibonacciAnyon(), N; pbc=true);

julia> # Create ground state of Fibonacci Hamiltonian
       H = anyon_ham(model);

julia> eigenvals, eigenvecs = eigen(H);

julia> ground_state = eigenvecs[:, 1];

julia> # Calculate entanglement entropy profile
       ee_profile = anyon_eelis(model, ground_state);

julia> length(ee_profile) == N - 1  # Profile has N-1 points
true

julia> all(x -> x ≥ 0, ee_profile)  # All entropies are non-negative
true
source
FibonacciChain.anyon_hamMethod
anyon_ham(model::AnyonModel, sites::Vector{<:Index}; kwargs...)

Construct anyon chain Hamiltonian as Matrix Product Operator (MPO).

Arguments

  • model::AnyonModel: Anyon model containing system parameters
  • sites::Vector{<:Index}: ITensor site indices
  • kwargs...: Additional parameters (e.g., J, h for Ising model)

Returns

  • MPO: Hamiltonian as Matrix Product Operator
    • Fibonacci: three-body interactions based on Fibonacci fusion rules
    • Ising: transverse field Ising model with ZZ and X terms
source
FibonacciChain.anyon_hamMethod
anyon_ham(model::AnyonModel, ::Type{T}, k::Int; symmetry_block=nothing) where {N, T <: BitStr{N}}
anyon_ham(model::AnyonModel, k::Int; symmetry_block=nothing)

Construct Hamiltonian matrix in specific momentum sector for 1D anyon chain.

Arguments

  • model::AnyonModel: Anyon model containing system parameters (including J, h, λ, etc.)
  • T::Type: BitStr type specifying chain length N (optional)
  • k::Int: Momentum sector (0 ≤ k ≤ N-1)
  • symmetry_block: Topological charge sector (optional)

Returns

  • Matrix: Hamiltonian matrix in chosen momentum sector (ComplexF64, or real if k=0 or k=N/2)

Examples

julia> using FibonacciChain

julia> model = AnyonModel(FibonacciAnyon(), 6; pbc=true);

julia> H_k0 = anyon_ham(model, 0);

julia> size(H_k0)[1] > 0
true
source
FibonacciChain.anyon_hamMethod
anyon_ham(model::AnyonModel)

Construct the Hamiltonian matrix for a 1D anyon chain.

Arguments

  • model::AnyonModel: An AnyonModel object specifying the anyon type, system size, boundary conditions, interaction type, and model parameters (J, h, λ, etc.).

Returns

  • Matrix{Float64}: The Hamiltonian matrix constructed in the chosen basis.

Supported Models

  • Fibonacci Anyons: Supports :Antiferro and :Ferro interaction terms.
  • Ising Anyons: Transverse field Ising model with parameters J and h.
  • OBF Anyons: O'Brien-Fendley model with parameter λ.

Examples

julia> using FibonacciChain, BitBasis

julia> N = 4; model_fibo = AnyonModel(FibonacciAnyon(), N; pbc=true, measure_operator=:Antiferro);

julia> H_fibo = anyon_ham(model_fibo); size(H_fibo)
(7, 7)

julia> model_ising = AnyonModel(IsingAnyon(), N; pbc=true, J=1.0, h=1.0); H_ising = anyon_ham(model_ising); size(H_ising)
(16, 16)
source
FibonacciChain.anyon_ham_sparseMethod
anyon_ham_sparse(model::AnyonModel, k::Int; symmetric_block=nothing, kwargs...)

Construct the Hamiltonian in a specific momentum and/or topological sector as a sparse matrix.

Arguments

  • model::AnyonModel: An AnyonModel object containing the system parameters.
  • k::Int: The momentum quantum number (0 ≤ k ≤ N-1).
  • symmetric_block: Optional. The topological charge sector (e.g., :trivial, :nontrivial).
  • kwargs...: Additional keyword arguments passed to actingHam, e.g., J, h.

Returns

  • SparseMatrixCSC: The sparse Hamiltonian in the specified symmetric sector. The element type will be ComplexF64 for general k and Float64 for k=0 or k=N/2.
source
FibonacciChain.anyon_ham_sparseMethod
anyon_ham_sparse(model::AnyonModel; kwargs...)

Construct the anyon chain Hamiltonian as a sparse matrix.

Arguments

  • model::AnyonModel: An AnyonModel object containing the system parameters.
  • kwargs...: Additional keyword arguments passed to actingHam, e.g., J, h for the Ising model.

Returns

  • SparseMatrixCSC{Float64, Int}: The sparse Hamiltonian matrix in the anyon basis.

Examples

julia> using FibonacciChain, BitBasis, SparseArrays, LinearAlgebra

julia> N = 6; model = AnyonModel(FibonacciAnyon(), N; pbc=true); H_sparse = anyon_ham_sparse(model);

julia> H_sparse isa SparseMatrixCSC
true

julia> ishermitian(H_sparse)
true

julia> H_dense = anyon_ham(model); norm(Matrix(H_sparse) - H_dense) < 1e-10
true
source
FibonacciChain.anyon_rdmMethod
anyon_rdm(AT::AbstractAnyonType, ::Type{T}, subsystems::Vector{Int64}, state::Vector{ET}; pbc::Bool=true) where {N, T <: BitStr{N}, ET}
anyon_rdm(AT::AbstractAnyonType, ::Type{T}, subsystems::Vector{Int64}, state::Matrix{ET}; pbc::Bool=true) where {N, T <: BitStr{N}, ET}
anyon_rdm(model::AnyonModel, subsystems::Vector{Int64}, state::Union{Vector{ET}, Matrix{ET}})

Compute the reduced density matrix (RDM) for a specified subsystem.

This function can operate on both state vectors and density matrices.

Arguments

High-level interface

  • model::AnyonModel: An AnyonModel object containing the system parameters.
  • subsystems::Vector{Int64}: A vector of site indices to keep in the reduced system. Indices are 1-based.
  • state::Union{Vector{ET}, Matrix{ET}}: The quantum state, either as a state vector or a full density matrix.

Low-level interface

  • AT::AbstractAnyonType: The anyon type, e.g., FibonacciAnyon().
  • T::Type: The BitStr type specifying the total chain length N.
  • subsystems::Vector{Int64}: The indices of the subsystem sites.
  • state::Union{Vector{ET}, Matrix{ET}}: The quantum state vector or density matrix.
  • pbc::Bool=true: Specifies whether the original system has periodic boundary conditions.

Returns

  • Matrix{ET}: The reduced density matrix for the specified subsystem.

Details

The subsystem indices are 1-based and refer to the site positions in the chain. The function correctly handles both contiguous and non-contiguous subsystems.

Examples

julia> using FibonacciChain, BitBasis, LinearAlgebra, Random

julia> Random.seed!(42); N = 4; model = AnyonModel(FibonacciAnyon(), N; pbc=true);

julia> basis = anyon_basis(model); state = randn(ComplexF64, length(basis)); state ./= norm(state);

julia> rdm = anyon_rdm(model, [1, 2], state); size(rdm)
(3, 3)

julia> ishermitian(rdm)
true

julia> isapprox(tr(rdm), 1.0; atol=1e-10)
true
source
FibonacciChain.anyon_rdm_secMethod
anyon_rdm_sec(model::AnyonModel, subsystems::Vector{Int64}, kstate::Vector{ET}, k::Int) where {ET}

Compute reduced density matrix for specified subsystems from quantum state in specific momentum sector.

Arguments

  • model::AnyonModel: Anyon model containing system parameters
  • subsystems::Vector{Int64}: Indices of subsystem sites to keep
  • kstate::Vector{ET}: State vector in momentum sector Hilbert space
  • k::Int: Momentum sector (0 ≤ k ≤ N-1)

Returns

  • Matrix{ET}: Reduced density matrix in total Hilbert basis

Examples

julia> using FibonacciChain, LinearAlgebra

julia> model = AnyonModel(FibonacciAnyon(), 6; pbc=true);

julia> H_k0 = anyon_ham(model, 0);

julia> eigvecs_k0 = eigvecs(H_k0);

julia> kstate = eigvecs_k0[:, 1];

julia> rdm = anyon_rdm_sec(model, [1, 2, 3], kstate, 0);

julia> isapprox(tr(rdm), 1.0; atol=1e-10)
true
source
FibonacciChain.bayes_distortMethod
bayes_distort(γ::Float64, trajectories::Vector{Int64}, probabilities::Vector{Float64})

Distort measurement trajectories based on a Bayesian distortion factor γ.

This function implements the distortion process where each faithful sample s is converted to a distorted sample s̃ according to the conditional probability: P(s̃|s) = ∏ⱼ (1 + γ s̃ⱼ sⱼ)/2

Only works for single-layer measurements to generate new samples based on the projective limit measurement.

Arguments

  • γ::Float64: Distortion factor (readout fidelity parameter, 0 ≤ γ ≤ 1)
  • trajectories::Vector{Int64}: Vector of measurement trajectories
  • probabilities::Vector{Float64}: Corresponding probabilities for each trajectory

Returns

  • Tuple{Vector{Vector{Int64}}, Vector{Float64}}: (distortedtrajectories, distortedprobabilities) in corresponding order
source
FibonacciChain.boundary_evolutionMethod
boundary_evolution(model::AnyonModel, state::Vector{T}, measure_config::MeasureConfig, 
                   sample::Union{Nothing, BitVector}=nothing; layer_idx::Int=1)
boundary_evolution(model::AnyonModel, sites, state::MPS, sample::BitVector, 
                   measure_config::MeasureConfig; 
                   cutoff::Float64=1e-12, maxdim::Int=1000, layer_idx::Int=1)

Evolve a quantum state under a single layer of boundary measurements with a given trajectory.

Methods

Vector version (from Measurement.jl)

Evolve a state vector under boundary measurements.

Arguments

  • model::AnyonModel: The anyon model specifying system parameters.
  • state::Vector{T}: The initial state vector.
  • measure_config::MeasureConfig: Configuration containing measurement strength τ and mode.
  • sample::Union{Nothing, BitVector}=nothing: The measurement outcomes for the layer.
  • layer_idx::Int=1: The layer index for measurement configuration.

Returns

  • Measurement_outcome_boundary: A struct containing state, sample, and free_energy.

MPS version (from MPSMeasurement.jl)

Evolve an MPS state under boundary measurements.

Arguments

  • model::AnyonModel: The anyon model specifying system parameters.
  • sites: The ITensor site indices.
  • state::MPS: The initial MPS state.
  • sample::BitVector: The measurement outcomes for the layer.
  • measure_config::MeasureConfig: Configuration containing measurement strength τ and mode (:sample or :Born).
  • cutoff::Float64=1e-12: MPS truncation cutoff.
  • maxdim::Int=1000: Maximum bond dimension for MPS operations.
  • layer_idx::Int=1: The layer index for measurement configuration.

Returns

  • Measurement_outcome_mps_boundary: A struct containing:
    • state::MPS: The evolved MPS state.
    • samples::BitVector: The measurement outcomes for the layer.
    • free_energy::Float64: The free energy associated with the measurement layer.
source
FibonacciChain.braidingsqmapMethod
braidingsqmap(model::AnyonModel{FibonacciAnyon}, state::Vector{ET}, idx::Int) where {ET}

Apply braiding squared operation to quantum state at specified site.

Arguments

  • model::AnyonModel{FibonacciAnyon}: Fibonacci anyon model containing system parameters (N, pbc)
  • state::Vector{ET}: Quantum state vector in anyon basis
  • idx::Int: Site index for braiding operation

Returns

  • Vector{ComplexF64}: Transformed state after braiding operation
source
FibonacciChain.build_extended_basisMethod
    build_extended_basis(k_total::Int, basis::Vector{T}) where {T<:BitStr}
    build_extended_basis(basis::Vector{ET}, ::Type{T}) where {k_total, ET, T<:BitStr{k_total, Int}}

Construct the extended basis that concatenates k_total reference qubits (as a prefix) with the anyon constraint system basis.

Arguments

  • k_total::Int: Total number of reference qubits to include as prefix.
  • basis::Vector{T}: Sorted anyon basis of the system (suffix).
  • ::Type{T}: BitStr type for the extended basis when using the low-level interface.

Returns

  • Vector{T}: Sorted extended basis with reference prefix concatenated to system basis.

Notes

  • Reference bits occupy the highest-order positions (leftmost) in the binary representation.
  • Use high-level build_extended_basis(k_total, basis) for convenience; low-level variant accepts the extended BitStr type.
source
FibonacciChain.bulk_evolutionMethod
bulk_evolution(model::AnyonModel, state::Vector{ET}, measure_config::MeasureConfig,
               samples::Union{Nothing,BitMatrix}=nothing)
bulk_evolution(model::AnyonModel, sites, state::MPS, measure_config::MeasureConfig,
               samples::Union{Nothing,BitMatrix}=nothing;
               cutoff::Float64=1e-10, maxdim::Int=100)

Perform bulk measurement evolution from t₁ to t₂ on quantum state.

Methods

Vector version (from Measurement.jl)

Evolve a state vector under bulk measurements.

Arguments

  • model::AnyonModel: Anyon model containing system parameters
  • state::Vector{ET}: Initial quantum state vector
  • measure_config::MeasureConfig: Configuration struct containing τ, t₁, t₂, mode, rng, etc.
  • samples::Union{Nothing,BitMatrix}=nothing: Predefined measurement sequences for :sample mode

Returns

  • Measurement_outcome_bulk: A struct containing:
    • states::Vector{Vector{ET}}: Intermediate states at each time step
    • samples::BitMatrix: Measurement outcome sequences
    • free_energys::Vector{Float64}: Free energy for each layer

MPS version (from MPSMeasurement.jl)

Evolve an MPS state under bulk measurements.

Arguments

  • model::AnyonModel: Anyon model containing system parameters
  • sites: ITensor site indices
  • state::MPS: Initial MPS quantum state
  • measure_config::MeasureConfig: Configuration struct containing τ, t₁, t₂, mode, rng, etc.
  • samples::Union{Nothing,BitMatrix}=nothing: Predefined measurement sequences for :sample mode
  • cutoff::Float64=1e-10: MPS truncation cutoff
  • maxdim::Int=100: Maximum bond dimension

Returns

  • Measurement_outcome_bulk: A struct containing:
    • states::Vector{MPS}: Intermediate states at each time step
    • samples::BitMatrix: Measurement outcome sequences
    • free_energy::Vector{Float64}: Free energy for each layer

Notes

  • In :Born mode, samples are generated probabilistically via Born rule
  • In :sample mode, samples must be provided as input
  • (2N+1) layers of measurements correspond to N time steps of evolution
source
FibonacciChain.disjoint_rdmMethod
disjoint_rdm(AT1::AbstractAnyonType, AT2::AbstractAnyonType, ::Type{T1}, ::Type{T2}, subsystemsA::Vector{Int64}, subsystemsB::Vector{Int64}, state::Vector{ET}; totalsubApbc::Bool=false, totalsubBpbc::Bool=false) where {N1, N2, T1 <: BitStr{N1}, T2 <: BitStr{N2}, ET}
disjoint_rdm(model1::AnyonModel, model2::AnyonModel, subsystemsA::Vector{Int64}, subsystemsB::Vector{Int64}, state::Vector{ET})

Compute reduced density matrix for two joint different systems, or two parallel chains.

Arguments

Low-level interface

  • AT1::AbstractAnyonType: Anyon type for subsystem A
  • AT2::AbstractAnyonType: Anyon type for subsystem B
  • T1::Type: BitStr type specifying chain length N1
  • T2::Type: BitStr type specifying chain length N2
  • subsystemsA::Vector{Int64}: Indices of subsystem A sites to keep
  • subsystemsB::Vector{Int64}: Indices of subsystem B sites to keep
  • state::Vector{ET}: Quantum state vector in total Hilbert space
  • totalsubApbc::Bool=false: Whether subsystem A is periodic
  • totalsubBpbc::Bool=false: Whether subsystem B is periodic

High-level interface

  • model1::AnyonModel: The model for the first subsystem (A).
  • model2::AnyonModel: The model for the second subsystem (B).
  • subsystemsA::Vector{Int64}: Indices of subsystem A sites to keep
  • subsystemsB::Vector{Int64}: Indices of subsystem B sites to keep
  • state::Vector{ET}: Quantum state vector in total Hilbert space

Returns

  • Matrix{ET}: Reduced density matrix

Examples

julia> using FibonacciChain, BitBasis, LinearAlgebra

julia> N1, N2 = 4, 4;

julia> model1 = AnyonModel(FibonacciAnyon(), N1; pbc=true);

julia> model2 = AnyonModel(FibonacciAnyon(), N2; pbc=true);

julia> basisA = anyon_basis(model1);

julia> basisB = anyon_basis(model2);

julia> state = randn(ComplexF64, length(basisA) * length(basisB));

julia> state ./= norm(state);

julia> rdm = disjoint_rdm(model1, model2, [1,2], [1,2], state);

julia> size(rdm)          # reduced density matrix dimension
(9, 9)

julia> ishermitian(rdm)   # should be Hermitian
true

julia> isapprox(tr(rdm), 1.0; atol=1e-10)  # trace should be 1
true
source
FibonacciChain.eeMethod
ee(subrm::Matrix{ET}) where {ET}

Calculate entanglement entropy from reduced density matrix.

Arguments

  • subrm::Matrix{ET}: Hermitian reduced density matrix

Returns

  • Float64: von Neumann entanglement entropy

Examples

julia> using FibonacciChain, LinearAlgebra

julia> # Create a simple 2x2 density matrix
       ρ = [0.5 0.0; 0.0 0.5];  # Maximally mixed state

julia> entropy = ee(ρ);

julia> abs(entropy - log(2)) < 1e-10  # Should equal log(2) ≈ 0.693
true

julia> # Pure state has zero entropy
       ρ_pure = [1.0 0.0; 0.0 0.0];

julia> ee(ρ_pure) ≈ 0.0
true
source
FibonacciChain.ee_mpsMethod
ee_mps(ψ::MPS, b::Int)

Calculate entanglement entropy of MPS state with bipartition at bond b.

Arguments

  • ψ::MPS: MPS state
  • b::Int: Bond index for bipartition (1 ≤ b < N)

Returns

  • Float64: Entanglement entropy (von Neumann entropy) at bond b
source
FibonacciChain.initial_mpsMethod
anyon_mps_gst(model::AnyonModel; sweep_times=5, maxdim=5, cutoff=1e-10, outputlevel=1)

Find ground state of anyon chain Hamiltonian using DMRG.

Arguments

  • model::AnyonModel: Anyon model containing system parameters (N, pbc, anyon_type)
  • sweep_times=5: Number of DMRG sweeps
  • maxdim=5: Maximum bond dimension
  • cutoff=1e-10: Truncation cutoff
  • outputlevel=1: Verbosity level

Returns

  • MPS: Ground state as Matrix Product State
  • Float64: Ground state energy

Examples

julia> using FibonacciChain, ITensorMPS, ITensors

julia> model = AnyonModel(FibonacciAnyon(), 8; pbc=true);

julia> ψ_gs, E0 = anyon_mps_gst(model, maxdim=10, outputlevel=0);

julia> ψ_gs isa MPS
true

julia> E0 < 0 && imag(E0) ≈ 0
true
source
FibonacciChain.inversion_matrixMethod
inversion_matrix(model::AnyonModel)

Generate spatial inversion operator matrix for anyon basis states.

Arguments

  • model::AnyonModel: Anyon model containing system parameters (N, pbc, anyon_type)

Returns

  • Matrix{Float64}: Inversion matrix mapping each basis state to its spatially reflected version
source
FibonacciChain.ladderChoiMethod
ladderChoi(model::AnyonModel{FibonacciAnyon}, p::Float64, state::Vector{ET}) where {ET}

Apply probabilistic braiding noise channel to density matrix state in vec form.

Arguments

  • model::AnyonModel{FibonacciAnyon}: Fibonacci anyon model containing system parameters (N, pbc)
  • p::Float64: Braiding probability (0 ≤ p ≤ 1)
  • state::Vector{ET}: Density matrix state in vectorized form

Returns

  • Vector{ET}: State after applying Choi map with braiding noise

Implements noise channel: ρ → (1-p)ρ + p B(ρ) where B is braiding operation.

source
FibonacciChain.ladderbraidingsqmapMethod
ladderbraidingsqmap(model::AnyonModel{FibonacciAnyon}, state::Vector{ET}, idx::Int) where {ET}

Apply braiding squared operation to density matrix state in vectorized form. Effectively, it describes the noise induced by inter-two layer chain braiding.

Arguments

  • model::AnyonModel{FibonacciAnyon}: Fibonacci anyon model containing system parameters (N, pbc)
  • state::Vector{ET}: Density matrix state in vectorized form
  • idx::Int: Site index for braiding operation

Returns

  • Vector{ET}: Transformed density matrix state after braiding

Operates on superposition states represented as vectorized density matrices.

Examples

julia> using FibonacciChain, LinearAlgebra, BitBasis

julia> N = 4;

julia> model = AnyonModel(FibonacciAnyon(), N; pbc=true);

julia> # Create PBC Fibonacci anyon basis 
       basis = anyon_basis(model);

julia> l = length(basis);

julia> ρ_vec = zeros(ComplexF64, l^2);

julia> # Initialize as identity matrix (vectorized)
       for i in 1:l
           ρ_vec[(i-1)*l + i] = 1.0/l;
       end

julia> # Apply braiding at site 2
       ρ_braided = ladderbraidingsqmap(model, ρ_vec, 2);

julia> norm(ρ_braided) > 0  # Should be non-zero
true
source
FibonacciChain.ladderrdmMethod
ladderrdm(model::AnyonModel, subsystems::Vector{Int64}, state::Vector{ET}) where {ET}

Compute reduced density matrix for specified subsystem from vectorized density matrix.

Arguments

  • model::AnyonModel: Anyon model containing system parameters (N, pbc, anyon_type)
  • subsystems::Vector{Int64}: Indices of subsystem sites to trace out
  • state::Vector{ET}: Full density matrix state in vectorized form

Returns

  • Matrix{Float64}: Reduced density matrix of the subsystem

For ladder systems where both subsystems have equal dimensions.

source
FibonacciChain.laddertranslationmapMethod
laddertranslationmap(model::AnyonModel, state::Vector{ET}) where {ET}

Apply translation operator to vectorized density matrix state.

Arguments

  • model::AnyonModel: Anyon model containing system parameters (N, pbc, anyon_type)
  • state::Vector{ET}: Density matrix state in vectorized form

Returns

  • Vector{ET}: Translated density matrix state

Translates both bra and ket parts of the density matrix consistently.

source
FibonacciChain.layers_per_periodMethod
layers_per_period(anyon_type) -> Int

Return the number of measurement layers per evolution period.

  • Fibonacci: 2 layers
  • Ising: 2 layers (X, ZZ)
  • OBF: 14 layers (√XZZ₁, √ZZX₁, √XZZ₂, √ZZX₂, √XZZ₃, √ZZX₃, X, √ZZX₃, √XZZ₃, √ZZX₂, √XZZ₂, √ZZX₁, √XZZ₁, ZZ), here OBF represents XZZ + ZZX. At the end plus a final √ZZ layer.
source
FibonacciChain.mapst_sec2totMethod
mapst_sec2tot(AT::AbstractAnyonType, ::Type{T}, state::Vector{ET}, k::Int; pbc::Bool=true) where {N, T <: BitStr{N}, ET}
mapst_sec2tot(model::AnyonModel, state::Vector{ET}, k::Int)

Map state in momentum sector to total Hilbert space.

Arguments

High-level interface

  • model::AnyonModel: An AnyonModel object containing system parameters
  • state::Vector{ET}: The state vector in the Hilbert space of the specified momentum sector
  • k::Int: The momentum sector index (0 ≤ k ≤ N-1)

Low-level interface

  • AT::AbstractAnyonType: The anyon type.
  • T::Type: The BitStr type specifying the chain length N.
  • state::Vector{ET}: The state vector in the momentum sector.
  • k::Int: The momentum sector index.
  • pbc::Bool=true: Specifies periodic boundary conditions (required for momentum sectors).

Returns

  • Vector{ET}: The state vector represented in the total Hilbert space basis.

Examples

julia> using FibonacciChain, LinearAlgebra

julia> model = AnyonModel(FibonacciAnyon(), 6; pbc=true); H_k0 = anyon_ham(model, 0);

julia> eigvecs_k0 = eigvecs(H_k0); kstate = eigvecs_k0[:, 1];

julia> total_state = mapst_sec2tot(model, kstate, 0); length(total_state) == length(anyon_basis(model))
true
source
FibonacciChain.measure_basismapMethod
measure_basismap(model::AnyonModel, τ::Float64, state::T, i::Int, sign::Bool) where {T}

Map single basis state under measurement operation at site i.

Arguments

  • model::AnyonModel: Anyon model containing system parameters (N, pbc, measure_operator)
  • τ::Float64: Measurement strength parameter
  • state::T: Input basis state
  • i::Int: Measurement site index (1 ≤ i ≤ N)
  • sign::Bool: Measurement outcome (false for +, true for -)

Returns

  • Tuple: Either (basis1, basis2, coeff1, coeff2) for superposition output or (basis, coeff) for single output

Maps individual basis states according to measurement protocols and fusion rules.

Examples

julia> using FibonacciChain, BitBasis

julia> N = 4; T = BitStr{N, Int};

julia> model = AnyonModel(FibonacciAnyon(), N; pbc=true, measure_operator=:Antiferro);

julia> state = T(0b0100);  # Single τ at site 2

julia> τ = 1.0;  # Measurement strength

julia> result = measure_basismap(model, τ, state, 2, false);

julia> length(result) ∈ [2, 4]  # Returns 2 or 4 elements depending on configuration
true
source
FibonacciChain.measuremap!Method
measuremap!(mapped_state, model, τ, state, idx, sign, basis)

In-place version of measuremap that writes result into pre-allocated mapped_state buffer. The basis argument should be obtained from anyon_basis(model) and cached for reuse.

source
FibonacciChain.measuremapMethod
measuremap(model::AnyonModel, τ::Float64, state::Vector{ET}, idx::Int, sign::Bool)
measuremap(model::AnyonModel, ψ::MPS, sites, i::Int, τ::Float64, sign::Bool; 
           cutoff::Float64=1e-10, maxdim::Int=100)

Apply measurement operator to quantum state and return post-measurement state.

Methods

Vector version (from Measurement.jl)

Apply measurement to a state vector.

Arguments

  • model::AnyonModel: Anyon model containing system parameters
  • τ::Float64: Measurement strength parameter
  • state::Vector{ET}: Input quantum state vector
  • idx::Int: Measurement site index
  • sign::Bool: Measurement outcome (false for +, true for -)

Returns

  • Vector{ET}: Post-measurement quantum state (unnormalized)

MPS version (from MPSMeasurement.jl)

Apply measurement to an MPS state.

Arguments

  • model::AnyonModel: Anyon model containing system parameters
  • ψ::MPS: Input quantum state
  • sites: ITensor site indices
  • i::Int: Measurement site
  • τ::Float64: Measurement strength parameter
  • sign::Bool: Measurement outcome (false for +, true for -)
  • cutoff::Float64=1e-10: MPS truncation cutoff
  • maxdim::Int=100: Maximum bond dimension

Returns

  • MPS: Post-measurement quantum state (normalized)
  • Float64: Measurement probability
source
FibonacciChain.measurement_enumerationMethod
measurement_enumeration(model::AnyonModel, τ::Float64, initial_state::Vector{ET}, measurement_sites::Vector{Int}) where {ET}

Enumerate all trajectories of measurements on a given initial state.

Arguments

  • model::AnyonModel: Anyon model containing system parameters
  • τ::Float64: Measurement strength parameter
  • initial_state::Vector{ET}: Initial quantum state vector
  • measurement_sites::Vector{Int}: Sites to measure

Returns

  • Tuple{Vector{Vector{ET}}, Vector{Vector{Int64}}, Vector{Float64}}: (final_states, trajectories, probabilities)

Examples

julia> using FibonacciChain, LinearAlgebra

julia> model = AnyonModel(FibonacciAnyon(), 4; pbc=true, measure_operator=:Antiferro);

julia> basis = anyon_basis(model);

julia> state = normalize(ones(length(basis)));

julia> states, trajs, probs = measurement_enumeration(model, 1.0, state, [2]);

julia> length(states) == 2  # Two possible outcomes
true
source
FibonacciChain.measurement_operator_mpsMethod
measurement_operator_mps(model::AnyonModel, sites::Vector{<:Index}, i::Int, τ::Float64, sign::Bool)

Create local measurement operator at site i as ITensor.

Arguments

  • model::AnyonModel: Anyon model containing system parameters
  • sites::Vector{<:Index}: ITensor site indices
  • i::Int: Measurement site
  • τ::Float64: Measurement strength parameter
  • sign::Bool: Measurement outcome (false for +, true for -)

Returns

  • ITensor: Local measurement operator incorporating neighboring site correlations
source
FibonacciChain.measurement_tree_visualizationMethod
measurement_tree_visualization(trajectories::Vector{Vector{Int64}}, probabilities::Vector{Float64})

Visualize a measurement tree given trajectories and their probabilities.

Arguments

  • trajectories::Vector{Vector{Int64}}: Measurement outcome sequences at each branch.
  • probabilities::Vector{Float64}: Corresponding probabilities for each trajectory.

Behavior

  • Normalizes probabilities to sum to 1.
  • Prints levels from root to leaves with indentation representing depth.
source
FibonacciChain.move_site!Method
move_site!(ψ::MPS, i::Int, j::Int)

Move MPS tensor from position i to position j by sequential SWAP operations. Maintains canonical form throughout. Only for adjacent moves.

source
FibonacciChain.mps_measurement_enumerationMethod
mps_measurement_enumeration(model::AnyonModel, ψ::MPS, sites::Vector{<:Index}, measurement_sites::Vector{Int}, 
                            τ::Float64; cutoff::Float64=1e-10, maxdim::Int=100)

Enumerate all possible measurement trajectories on MPS state.

Arguments

  • model::AnyonModel: Anyon model containing system parameters
  • ψ::MPS: Input quantum state
  • sites: ITensor site indices
  • measurement_sites::Vector{Int}: Sites to measure
  • τ::Float64: Measurement strength parameter
  • cutoff::Float64=1e-10: MPS truncation cutoff
  • maxdim::Int=100: Maximum bond dimension

Returns

  • Vector{MPS}: Final states for each trajectory
  • Vector{Vector{Bool}}: Measurement trajectories
  • Vector{Float64}: Probabilities for each trajectory
source
FibonacciChain.mutual_informationMethod
mutual_information(model::AnyonModel, subsystems::Tuple{Vector{Int64}, Vector{Int64}}, state::Vector{ET}) where {ET}

Calculate the mutual information between two subsystems.

Computes I(A:B) = SA + SB - S_AB where S represents the Von Neumann entropy. Mutual information quantifies the total correlation between subsystems A and B.

Arguments

  • model::AnyonModel: Anyon model containing system parameters (N, pbc, anyon_type)
  • subsystems::Tuple{Vector{Int64}, Vector{Int64}}: Tuple of (Asites, Bsites)
  • state::Vector{ET}: Quantum state vector

Returns

  • Float64: Mutual information I(A:B)

Example

model = AnyonModel(FibonacciAnyon(), 10, true)
A_sites = [1, 2, 3]
B_sites = [7, 8, 9]
mi = mutual_information(model, (A_sites, B_sites), psi)
source
FibonacciChain.ref_correlationMethod
ref_correlation(model::AnyonModel, state_addref3::Vector{ET}; spatial::Bool=false, temporal::Bool=false) where {ET}

Calculate spatio-temporal correlation using state with three reference qubits.

Arguments

  • model::AnyonModel: Anyon model containing system parameters (N, pbc, anyon_type)
  • state_addref3::Vector{ET}: Quantum state with three reference qubits added
  • spatial::Bool=false: If true, calculate only spatial correlation
  • temporal::Bool=false: If true, calculate only temporal correlation

Returns

  • Float64: Spatio-temporal correlation measure between two any spacetime points.

Uses reference qubit protocol to measure spatio-temporal correlations at two any spacetime points.

source
FibonacciChain.reference_boundary_evolutionMethod
reference_boundary_evolution(model::AnyonModel, state::Vector{T}, measure_config::MeasureConfig,
                             sample::Union{Nothing, BitVector}=nothing; layer_idx::Int64=1)

Perform a single measurement layer evolution on a state with reference qubits.

Arguments

  • model::AnyonModel: Anyon model containing system parameters
  • state::Vector{T}: Quantum state vector with reference qubits
  • measure_config::MeasureConfig: Configuration containing τ, mode, rng, etc.
  • sample::Union{Nothing, BitVector}=nothing: Predefined measurement outcomes for :sample mode
  • layer_idx::Int64=1: Layer index (1-based) to determine measurement pattern

Returns

  • Measurement_outcome_boundary: A struct containing:
    • state::Vector{T}: Post-measurement state
    • sample::BitVector: Measurement outcomes for this layer
    • free_energy::Float64: Free energy contribution from this layer

Notes

  • In :Born mode, samples are generated probabilistically via Born rule
  • In :sample mode, sample must be provided as input
source
FibonacciChain.reference_bulk_evolutionMethod
reference_bulk_evolution(model::AnyonModel, state::Vector{T}, measure_config::MeasureConfig,
                         samples::Union{Nothing,BitMatrix}=nothing) where{T}

Perform bulk measurement evolution from t₁ to t₂ on quantum state with reference qubits.

Arguments

  • model::AnyonModel: Anyon model containing system parameters
  • state::Vector{T}: Initial quantum state vector with reference qubits
  • measure_config::MeasureConfig: Configuration struct containing τ, t₁, t₂, mode, rng, etc.
  • samples::Union{Nothing,BitMatrix}=nothing: Predefined measurement sequences for :sample mode

Returns

  • Measurement_outcome_bulk: A struct containing:
    • states::Vector{Vector{T}}: Intermediate states at each time step
    • samples::BitMatrix: Measurement outcome sequences
    • free_energys::Vector{Float64}: Free energy for each layer

Notes

  • In :Born mode, samples are generated probabilistically via Born rule
  • In :sample mode, samples must be provided as input
  • The state should already contain reference qubits added via add_reference_qubits
source
FibonacciChain.reference_evolutionMethod
reference_evolution(N::Int, τ::Float64, forward::Vector{ET}, sample::Matrix{Bool}, 
                    x₂::Int, t₁, t₂; x₁::Int=1, rng=MersenneTwister(), pbc=true, 
                    anyon_type::Symbol=:Fibo, verbose=false, mode::Symbol=:sample)
reference_evolution(model::AnyonModel, sites, forward::Vector{MPS}, sample::Matrix{Bool},
                    x₂::Int, t₁, t₂, measure_config::MeasureConfig; x₁::Int=1, verbose=false)

Compute temporal/spatial correlation between two spacetime points using cached forward evolution.

This function avoids recomputing the forward evolution up to time t₁ by using the cached forward states.

Methods

Vector version (from ReferenceProbe.jl)

Compute correlation using state vectors.

Arguments

  • N::Int: System size
  • τ::Float64: Measurement strength parameter
  • forward::Vector{ET}: Cached forward state evolution trajectory
  • sample::Matrix{Bool}: Measurement sample configuration
  • x₂::Int: Site index for second reference qubit insertion
  • t₁::Int: First time slice index
  • t₂::Int: Second time slice index (must be >= t₁)
  • x₁::Int=1: Spatial site index for first reference qubit
  • rng::MersenneTwister=MersenneTwister(): Random number generator
  • pbc::Bool=true: Periodic boundary conditions
  • anyon_type::Symbol=:Fibo: Anyon type (:Fibo or :Ising)
  • verbose::Bool=false: Enable verbose output
  • mode::Symbol=:sample: Evolution mode (:sample or :Born)

Returns

  • Reference qubit added states between specified spacetime slices.

MPS version (from MPSMeasurement.jl)

Compute correlation using MPS states.

Arguments

  • model::AnyonModel: Anyon model containing system parameters
  • sites: ITensor site indices
  • forward::Vector{MPS}: Cached forward state evolution trajectory from a previous bulk_evolution run.
  • sample::Matrix{Bool}: The full measurement sample configuration for the entire evolution.
  • x₂::Int: The site index for the second reference qubit insertion.
  • t₁::Int: The first time slice index for correlation.
  • t₂::Int: Second time slice index (must be >= t₁)
  • measure_config::MeasureConfig: Configuration containing τ, rng, mode, etc.
  • x₁::Int=1: Site index for first reference qubit
  • verbose::Bool=false: Enable verbose output for debugging.

Returns

  • Vector{MPS}: A vector of MPS states for the specified spacetime slices.
  • BitMatrix: The measurement samples used for the evolution.
  • Vector{Float64}: The free energy calculated for each layer.
source
FibonacciChain.reference_evolutionMethod
reference_evolution(model::AnyonModel, forward::Vector{ET}, measure_config::MeasureConfig, 
                    sample::Union{BitMatrix, Nothing}=nothing) -> Measurement_outcome_bulk

Compute temporal/spatial correlation between two spacetime points using cached forward evolution.

This function avoids recomputing the forward evolution up to time t₁ by using the cached forward states, then adds reference qubits and continues evolution to measure correlations.

Spacetime Diagram

    | ---->|
    forward
          Ref1                    x₁ = 1            
           |
           |
          Ref2 --> Ref3               x₂ = N/2
    | ----> |______| -----> |
    1      t₁   t₂=t₁+δt   Δt
    | --------------------->|
    sample

Arguments

  • model::AnyonModel: Anyon model containing system parameters (N, pbc, anyon_type, etc.)
  • forward::Vector{ET}: Cached forward state evolution trajectory from a previous bulk_evolution run
  • measure_config::MeasureConfig: Configuration struct containing:
    • τ::Float64: Measurement strength parameter
    • t₁::Int: First time slice index for correlation
    • t₂::Int: Second time slice index (must be >= t₁)
    • x₁::Int: Site index for first reference qubit
    • x₂::Int: Site index for second reference qubit (must be >= x₁)
    • mode::Symbol: Evolution mode (:sample or :Born)
    • rng::MersenneTwister: Random number generator (for :Born mode)
    • verbose::Bool: Enable verbose output
  • sample::Union{BitMatrix, Nothing}=nothing: Full measurement sample configuration for the entire evolution

Returns

  • Measurement_outcome_bulk: A struct containing:
    • states::Vector{ET}: State evolution trajectory with reference qubits
    • samples::BitMatrix: Measurement samples used for the evolution
    • free_energys::Vector{Float64}: Free energy calculated for each layer

Correlation Types

Based on δt = t₂ - t₁ and δx = |x₂ - x₁|:

  • δt > 0 && δx > 0: 3-point correlation (both spatial and temporal), uses 3 reference qubits
  • δt == 0: Pure 2-point spatial correlation at fixed time, uses 2 reference qubits
  • δx == 0: Pure 2-point temporal correlation at fixed site, uses 2 reference qubits

Notes

  • The forward states should come from a previous bulk_evolution call
  • Reference qubits are added via add_reference_qubits at the specified spacetime points
  • In :sample mode, sample must be provided; in :Born mode, samples are generated via Born rule

See also: add_reference_qubits, reference_bulk_evolution, ref_correlation

source
FibonacciChain.reference_measuremapMethod
reference_measuremap(model::AnyonModel, τ::Float64, state::Vector{ET}, idx::Int, sign::Bool;
                     extended_basis::Vector{newT}, k_old::Int64=1)
reference_measuremap(model::AnyonModel, ::Type{T}, ::Type{pretype}, τ::Float64, state::Vector{ET},
                     idx::Int, sign::Bool; extended_basis::Vector{newT})

Apply a measurement operator to a quantum state with reference qubits.

This function extends measuremap to handle states that include reference qubits, preserving the reference qubit subspace while applying measurements to the system.

Arguments

  • model::AnyonModel: Anyon model containing system parameters
  • τ::Float64: Measurement strength parameter
  • state::Vector{ET}: Quantum state vector with reference qubits
  • idx::Int: Site index for measurement
  • sign::Bool: Measurement outcome (false=0, true=1)
  • extended_basis::Vector{newT}: Extended basis including reference qubits
  • k_old::Int64=1: Number of reference qubits in the state

Returns

  • Vector{ET}: The post-measurement state (unnormalized)

Notes

The extended basis must be constructed via build_extended_basis before calling this function.

source
FibonacciChain.reference_rdmMethod
reference_rdm(model::AnyonModel, subsystems::Vector{Int64}, state::Vector{ET}; traceref::Bool=true)

Compute the reduced density matrix for a state with reference qubits.

Arguments

  • model::AnyonModel: Anyon model containing system parameters
  • subsystems::Vector{Int64}: Indices of system sites to keep (not trace out)
  • state::Vector{ET}: Quantum state vector with reference qubits
  • traceref::Bool=true: If true, trace out reference qubits and keep system subsystems; if false, trace out system and keep reference qubits

Returns

  • Matrix{ET}: The reduced density matrix

Notes

  • Subsystem indices count from the right of the binary string representation
  • The number of reference qubits k_old is automatically deduced from the state length
source
FibonacciChain.spatial_correlationMethod
spatial_correlation(model::AnyonModel, state::Union{Vector{ET}, Matrix{ET}}, site1::Int64, site2::Int64) where {ET}

Calculate mutual information between two sites as spatial correlation measure.

Arguments

  • model::AnyonModel: Anyon model containing system parameters (N, pbc, anyon_type)
  • state::Union{Vector{ET}, Matrix{ET}}: Quantum state vector or density matrix
  • site1::Int64: First site index (1 ≤ site1 ≤ N)
  • site2::Int64: Second site index (1 ≤ site2 ≤ N, site2 ≠ site1)

Returns

  • Float64: Mutual information I(1:2) = S(1) + S(2) - S(1,2)

Computes quantum mutual information as measure of spatial correlations.

source
FibonacciChain.temporal_correlationMethod
temporal_correlation(model::AnyonModel, state_addref2::Vector{ET}) where {ET}

Calculate temporal correlation using state with two reference qubits.

Arguments

  • model::AnyonModel: Anyon model containing system parameters (N, pbc, anyon_type)
  • state_addref2::Vector{ET}: Quantum state with two reference qubits added

Returns

  • Float64: Temporal correlation measure between time slices

Uses reference qubit protocol to measure temporal correlations at single site.

source
FibonacciChain.topological_charge_operatorMethod
topological_charge_operator(model::AnyonModel{FibonacciAnyon}, ::Type{T}) where {N, T <: BitStr{N}}

Compute the topological charge operator matrix for Fibonacci anyon model.

Arguments

  • model::AnyonModel{FibonacciAnyon}: Fibonacci anyon model
  • T::Type: BitStr type specifying chain length N

Returns

  • Matrix{Float64}: Topological charge operator matrix (Y matrix)

Examples

julia> using FibonacciChain, BitBasis

julia> N = 4; T = BitStr{N, Int};

julia> model = AnyonModel(FibonacciAnyon(), N; pbc=true);

julia> Y = topological_charge_operator(model, T);

julia> size(Y) == (length(anyon_basis(model)), length(anyon_basis(model)))
true
source
FibonacciChain.topological_symmetry_basismapMethod
topological_symmetry_basismap(model::AnyonModel{FibonacciAnyon}, state::T) where {N, T <: BitStr{N}}

Compute topological symmetry coefficients for all basis states relative to given state.

Arguments

  • model::AnyonModel{FibonacciAnyon}: Fibonacci anyon model
  • state::T: Reference state configuration

Returns

  • Vector{Float64}: Coefficients for each basis state

Examples

julia> using FibonacciChain, BitBasis

julia> N = 4; T = BitStr{N, Int};

julia> model = AnyonModel(FibonacciAnyon(), N; pbc=true);

julia> state = T(0b0000);  # Vacuum state

julia> coeffs = topological_symmetry_basismap(model, state);

julia> length(coeffs) == length(anyon_basis(model))
true
source
FibonacciChain.transfer_matrixMethod
transfer_matrix(model::AnyonModel, τ::Float64; sign::Bool=true)

Construct the transfer matrix for two measurement layers.

Arguments

  • model::AnyonModel: Anyon model containing system parameters
  • τ::Float64: Measurement strength parameter
  • sign::Bool=true: Measurement outcome sign

Returns

  • Matrix{Float64}: Transfer matrix between two measurement layers
source
FibonacciChain.translation_matrixMethod
translation_matrix(model::AnyonModel)

Generate translation operator matrix for anyon basis states.

Arguments

  • model::AnyonModel: Anyon model containing system parameters (N, pbc, anyon_type)

Returns

  • Matrix{Float64}: Translation matrix mapping each basis state to its translated version
source
FibonacciChain.tri_mutual_informationMethod
tri_mutual_information(model::AnyonModel, subsystems::Tuple{Vector{Int64}, Vector{Int64}, Vector{Int64}}, state::Vector{ET}) where {ET}

Calculate the tripartite mutual information between three subsystems.

Computes I(A:B:C) = SA + SB + SC - SAB - SBC - SAC + S_ABC. This measures genuine three-partie quantum correlations.

Arguments

  • model::AnyonModel: Anyon model containing system parameters (N, pbc, anyon_type)
  • subsystems::Tuple{Vector{Int64}, Vector{Int64}, Vector{Int64}}: Tuple of (Asites, Bsites, C_sites)
  • state::Vector{ET}: Quantum state vector

Returns

  • Float64: Tripartite mutual information I(A:B:C)

Example

model = AnyonModel(FibonacciAnyon(), 10, true)
A_sites = [1, 2]
B_sites = [5, 6]
C_sites = [9, 10]
tmi = tri_mutual_information(model, (A_sites, B_sites, C_sites), psi)
source

Index