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
basis = anyon_basis(N, true) # periodic boundary conditions
# Generate the Hamiltonian
H = anyon_ham(N, true)
# Find ground state
eigenvals, eigenvecs = eigen(H)
ground_state = eigenvecs[:, 1]
# Calculate entanglement entropy profile
ee_profile = anyon_eelis(N, ground_state)
Documentation Sections
- Basis Functions
- Observable Functions
- Measurement and Dynamics
- Matrix Product State Methods
- Examples
- API Reference
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.Boundary_measure
— MethodBoundary_measure(::Type{T}, τ::Float64, state::Vector{ET}, measurement_sites::Vector{Int}, num_samples::Int=1000, rng::MersenneTwister=MersenneTwister(), pbc::Bool=true; anyon_type::Symbol=:Fibo) where {N, T <: BitStr{N}, ET}
Generate measurement samples at boundary sites with probabilistic outcomes, i.e., without time axis evolution.
Arguments
T::Type
: BitStr type specifying chain length Nτ::Float64
: Measurement strength parameterstate::Vector{ET}
: Initial quantum state vectormeasurement_sites::Vector{Int}
: Sites to perform measurementsnum_samples::Int=1000
: Number of measurement samples to generaterng::MersenneTwister
: Random number generatorpbc::Bool=true
: Periodic boundary conditionsanyon_type::Symbol=:Fibo
: anyon type
Returns
Tuple{Vector{Vector{Float64}}, Vector{Vector{Int64}}, Vector{Float64}}
: (post-measurement states, measurement sequences, free energies)
Samples measurement outcomes probabilistically based on Born rule.
FibonacciChain.Boundarypost_selection
— MethodBoundarypost_selection(N::Int64, τ::Float64, state::Vector{ET}, measurement_sites::Vector{Int}, sign::Int64, pbc::Bool=true; anyon_type::Symbol=:Fibo)
Generate measurement samples at boundary sites with post_selection outcomes, i.e., given spatial evolution without time axis evolution.
Arguments
N::Int
: Chain length Nτ::Float64
: Measurement strength parameterstate::Vector{ET}
: Initial quantum state vectormeasurement_sites::Vector{Int}
: Sites to perform measurementspbc::Bool=true
: Periodic boundary conditionsanyon_type::Symbol=:Fibo
: anyon type
Returns
Tuple{Vector{Vector{Float64}}, Vector{Vector{Int64}}, Vector{Float64}}
: (post-measurement states, measurement sequences, free energies)
Samples measurement outcomes with given measurement outcomes.
FibonacciChain.Bulkmeasure
— MethodBulkmeasure(N::Int64, τ::Float64, state::Vector{ET}, D::Int64, rng::MersenneTwister=MersenneTwister(), pbc::Bool=true; anyon_type::Symbol=:Fibo)
Generate measurement samples at bulk sites with probabilistic outcomes, i.e., with time axis evolution, together with spatial evolution axis as bulk.
Arguments
N::Int
: Chain length Nτ::Float64
: Measurement strength parameterstate::Vector{ET}
: Initial quantum state vectorD::Int64
: Number of measurement layers (depth), or time step (over 2)rng::MersenneTwister
: Random number generatorpbc::Bool=true
: Periodic boundary conditionsanyon_type::Symbol=:Fibo
: anyon type
Returns
Tuple{Vector{Vector{Float64}}, Vector{Vector{Int64}}, Vector{Float64}}
: (post-measurement states, measurement sequences, free energies)
Samples measurement outcomes probabilistically based on Born rule.
FibonacciChain.Bulkpost_selection
— MethodBulkpost_selection(N::Int64, τ::Float64, state::Vector{ET}, D::Int64, sign::Int64, pbc::Bool=true; anyon_type::Symbol=:Fibo)
Generate measurement samples at bulk sites with post_selection outcomes, i.e., with time axis evolution, together with spatial evolution axis as bulk.
Arguments
N::Int
: Chain length Nτ::Float64
: Measurement strength parameterstate::Vector{ET}
: Initial quantum state vectorD::Int64
: Number of measurement layers (depth), or time step (over 2)sign::Int64
: Measurement sign, 0 for positive, 1 for negativepbc::Bool=true
: Periodic boundary conditionsanyon_type::Symbol=:Fibo
: anyon type
Returns
Tuple{Vector{Vector{Float64}}, Vector{Vector{Int64}}, Vector{Float64}}
: (post-measurement states, measurement sequences, free energies)
Samples measurement outcomes with given measurement outcomes.
FibonacciChain.Fsymmetry_coef
— MethodFsymmetry_coef(state::T, base::T, pbc::Bool=true, anyon_type::Symbol=:Fibo) where {N, T <: BitStr{N}}
Compute topological symmetry coefficient for state in given base configurations for Fibonacci anyon chain.
Arguments
state::T
: Target state configurationbase::T
: Base state configurationpbc::Bool=true
: Periodic boundary conditionsanyon_type::Symbol=:Fibo
: Measurement class
Returns
Float64
: Topological symmetry coefficient based on Fibonacci fusion rules
Examples
julia> using FibonacciChain, BitBasis
julia> N = 4; T = BitStr{N, Int};
julia> state = T(0b1010); ϕ = (1 + sqrt(5)) / 2; # Example state configuration
julia> base = T(0b0101); # Example base configuration
julia> coef = Fsymmetry_coef(state, base, true, :Fibo); coef ≈ 0.3819660112501051
true
julia> abs(coef - (1-1/ϕ)) < 1e-10 # Should equal φ for this configuration
true
FibonacciChain.add_reference_qubits!
— Methodadd_reference_qubits!(N::Int, state::Vector{ET}, site_idx::Int64, rng::MersenneTwister=MersenneTwister(); k_new::Int=1, pbc::Bool=true, anyon_type::Symbol=:Fibo) where {ET}
Add reference qubits to quantum state at specified site for correlation measurements.
Arguments
N::Int
: System sizestate::Vector{ET}
: Quantum state vectorsite_idx::Int64
: Site index for reference qubit insertion (1 ≤ site_idx ≤ N)k_new::Int=1
: Number of new reference qubits to add (0 or 1)pbc::Bool=true
: Periodic boundary conditionsanyon_type::Symbol=:Fibo
: anyon typeverbose::Bool=false
: Enable verbose outputentangle_way::Symbol=:copy
: Method to entangle reference qubit, either:copy
or:reset
Returns
Vector{ET}
: New state with reference qubits in maximally entangled configuration
For multiple reference qubits, call this function multiple times at different sites.
FibonacciChain.anyon_basis
— Methodanyon_basis(::Type{T}, pbc::Bool=true; Y=nothing, anyon_type::Symbol=:Fibo) where {N, T <: BitStr{N}}
Generate basis states for 1D anyon chain.
Arguments
T::Type
: BitStr type specifying chain length Npbc::Bool=true
: Periodic boundary conditionsY
: Topological charge filter (:tau
,:trivial
,0
,1
, ornothing
)anyon_type::Symbol=:Fibo
: anyon type (:Fibo
,:resetFibo
,:IsingX
,:IsingZZ
,:IsingZ
,:reset
)
Returns
Vector{T}
: Sorted basis states satisfying constraints
Supports Fibonacci anyons, Ising anyons/Majorana fermions, and spin-1/2 systems.
Examples
julia> using FibonacciChain, BitBasis
julia> # Generate Fibonacci basis for N=4 with PBC
N = 4; T = BitStr{N, Int};
julia> basis_fibo = anyon_basis(T, true, anyon_type=:Fibo);
julia> length(basis_fibo) # Fibonacci numbers give the dimension
7
julia> basis_fibo[1] # First basis state (vacuum)
0000 ₍₂₎
julia> # Generate Ising basis for comparison
basis_ising = anyon_basis(T, true, anyon_type=:IsingX);
julia> length(basis_ising) # All 2^N states for Ising
16
FibonacciChain.anyon_basis
— Methodanyon_basis(::Type{T}, k::Int64; Y=nothing, anyon_type::Symbol=:Fibo) where {N, T <: BitStr{N}}
Generate basis states in specific momentum sector k
and topological sector Y
.
Arguments
T::Type
: BitStr type specifying chain length Nk::Int64
: Momentum sector (0 ≤ k ≤ N-1)Y
: Topological charge sectoranyon_type::Symbol=:Fibo
: anyon type
Returns
Vector{T}
: Basis states in momentum sector kDict{T, Vector{T}}
: Representative mapping for translation equivalence classes
FibonacciChain.anyon_eelis
— Methodanyon_eelis(N::Int64, state::Union{Vector{ET}, Matrix{ET}}, pbc::Bool=true; anyon_type::Symbol=:Fibo) where {ET}
Calculate entanglement entropy profile along the chain for given quantum state or density matrix.
Arguments
N::Int64
: System sizestate::Union{Vector{ET}, Matrix{ET}}
: Quantum state vector or density matrix in anyon basispbc::Bool=true
: Periodic boundary conditionsanyon_type::Symbol=:Fibo
: anyon type
Returns
Vector{Float64}
: Entanglement entropy at each bipartition from left to right
Examples
julia> using FibonacciChain, LinearAlgebra
julia> N = 6;
julia> # Create ground state of Fibonacci Hamiltonian
H = anyon_ham(N, true);
julia> eigenvals, eigenvecs = eigen(H);
julia> ground_state = eigenvecs[:, 1];
julia> # Calculate entanglement entropy profile
ee_profile = anyon_eelis(N, ground_state, true);
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
FibonacciChain.anyon_eelis_mps
— Methodanyon_eelis_mps(N::Int64, ψ::MPS)
Calculate entanglement entropy profile along the chain for MPS state.
Arguments
N::Int64
: System sizeψ::MPS
: MPS state
Returns
Vector{Float64}
: Entanglement entropy at each bipartition from left to right
Examples
julia> using FibonacciChain, ITensorMPS, ITensors
julia> N = 6;
julia> ψ_gs, E0 = fibonacci_mps_ground_state(N, pbc=true, maxdim=10, outputlevel=0);
julia> # Calculate entanglement entropy profile
ee_profile = anyon_eelis_mps(N, ψ_gs);
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
FibonacciChain.anyon_ham
— Methodanyon_ham(::Type{T}, pbc::Bool=true; anyon_type::Symbol=:Fibo, kwargs...) where {N, T <: BitStr{N}}
Construct Hamiltonian matrix for 1D anyon chain.
Arguments
T::Type
: BitStr type specifying chain length Npbc::Bool=true
: Periodic boundary conditionsanyon_type::Symbol=:Fibo
: anyon typekwargs...
: Additional model parameters, e.g.,J
,h
for Ising model.
Returns
Matrix{Float64}
: Hamiltonian matrix in chosen basis
Supports various anyon models including Fibonacci and Ising anyons.
Examples
julia> using FibonacciChain, BitBasis
julia> N = 4; T = BitStr{N,Int};
julia> H_fibo = anyon_ham(T, true, anyon_type=:Fibo);
julia> size(H_fibo) # Hamiltonian dimension matches basis size
(7, 7)
julia> H_Ising = anyon_ham(T, true, anyon_type=:IsingX, J=1.0, h=1.0);
julia> size(H_Ising) # full Hilbert space for Ising model
(16, 16)
FibonacciChain.anyon_ham
— Methodanyon_ham(::Type{T}, k::Int; Y=nothing, anyon_type::Symbol=:Fibo, kwargs...) where {N, T <: BitStr{N}}
Construct Hamiltonian matrix in specific symmetry sector for 1D anyon chain.
Arguments
T::Type
: BitStr type specifying chain length Npbc::Bool=true
: Periodic boundary conditionsanyon_type::Symbol=:Fibo
: anyon typekwargs...
: Additional model parameters, e.g.,J
,h
for Ising model.
Returns
Matrix{Float64}
: Hamiltonian matrix in chosen basis
FibonacciChain.anyon_ham_sparse
— Methodanyon_ham_sparse(::Type{T}, pbc::Bool=true; anyon_type::Symbol=:Fibo) where {N, T <: BitStr{N}}
Construct anyon chain Hamiltonian as sparse matrix.
Arguments
T::Type
: BitStr type specifying chain length Npbc::Bool=true
: Periodic boundary conditionsanyon_type::Symbol=:Fibo
: Model typekwargs...
: Additional keyword arguments passed toactingHam
, e.g.J
,h
.
Returns
SparseMatrixCSC{Float64, Int}
: Sparse Hamiltonian matrix in anyon basis
Examples
julia> using FibonacciChain, BitBasis, SparseArrays, LinearAlgebra
julia> N = 6; T = BitStr{N, Int};
julia> H_sparse = anyon_ham_sparse(T, true, anyon_type=:Fibo);
julia> H_sparse isa SparseMatrixCSC # Check it's a sparse matrix
true
julia> ishermitian(H_sparse) # Should be Hermitian
true
julia> H_dense = anyon_ham(N, true); # Compare with dense version for small system
julia> norm(Matrix(H_sparse) - H_dense) < 1e-10
true
FibonacciChain.anyon_ham_sparse
— Methodanyon_ham_sparse(::Type{T}, k::Int, Y=nothing; anyon_type::Symbol=:Fibo) where {N, T <: BitStr{N}}
Construct Hamiltonian in momentum-topological sector as sparse matrix.
Arguments
T::Type
: BitStr type specifying chain length Nk::Int
: Momentum quantum number (0 ≤ k ≤ N-1)Y
: Topological charge sectoranyon_type::Symbol=:Fibo
: Model typekwargs...
: Additional keyword arguments passed toactingHam
, e.g.J
,h
.
Returns
SparseMatrixCSC{ComplexF64, Int}
: Sparse Hamiltonian in symmetric sector
FibonacciChain.anyon_rdm
— Methodanyon_rdm(::Type{T}, subsystems::Vector{Int64}, state::Union{Vector{ET}, Matrix{ET}}, pbc::Bool=true; anyon_type::Symbol=:Fibo) where {N,T <: BitStr{N}, ET}
Compute reduced density matrix for specified subsystems from quantum state or density matrix.
Arguments
T::Type
: BitStr type specifying chain length Nsubsystems::Vector{Int64}
: Indices of subsystem sites to keepstate::Union{Vector{ET}, Matrix{ET}}
: Quantum state vector or density matrixpbc::Bool=true
: Periodic boundary conditionsanyon_type::Symbol=:Fibo
: Model type
Returns
Matrix{ET}
: Reduced density matrix for specified subsystems
Subsystem indices are counted from right in binary representation.
Examples
julia> using FibonacciChain, BitBasis, LinearAlgebra
julia> N = 4; T = BitStr{N, Int};
julia> basis = anyon_basis(T, true, anyon_type=:Fibo);
julia> state = randn(ComplexF64, length(basis)); state ./= norm(state);
julia> rdm = anyon_rdm(T, [1, 2], state, true, anyon_type=:Fibo);
julia> size(rdm) # Reduced density matrix dimension
(3, 3)
julia> ishermitian(rdm) # RDM should be Hermitian
true
julia> tr(rdm) ≈ 1.0 + 0.0im # Trace should be 1
true
FibonacciChain.anyon_rdm_sec
— Methodanyon_rdm_sec(::Type{T}, subsystems::Vector{Int64}, kstate::Vector{ET}, k::Int64) where {N,T <: BitStr{N}, ET}
Compute reduced density matrix for specified subsystems from quantum state or density matrix in specific symmetry sector.
Arguments
T::Type
: BitStr type specifying chain length Nsubsystems::Vector{Int64}
: Indices of subsystem sites to keepkstate::Vector{ET}
: State vector in symmetric sector Hilbert spacek::Int64
: Momentum sector (0 ≤ k ≤ N-1)anyon_type::Symbol=:Fibo
: anyon type
Returns
Matrix{ET}
: Reduced density matrix in total Hilbert basis
FibonacciChain.apply_measurement_mps
— Methodapply_measurement_mps(ψ::MPS, sites, i::Int, τ::Float64, sign::Int64; pbc::Bool=true, cutoff::Float64=1e-10, maxdim::Int=100, anyon_type::Symbol=:Fibo)
Apply measurement operator to MPS state and return post-measurement state.
Arguments
ψ::MPS
: Input quantum statesites
: ITensor site indicesi::Int
: Measurement siteτ::Float64
: Evolution time parametersign::Int64
: Measurement outcomepbc::Bool=true
: Periodic boundary conditionscutoff::Float64=1e-10
: MPS truncation cutoffmaxdim::Int=100
: Maximum bond dimensionanyon_type::Symbol=:Fibo
: Model type
Returns
MPS
: Post-measurement quantum stateFloat64
: Measurement probability
FibonacciChain.bayes_distort
— MethodDistort the measurement trajectories based on a Bayesian distortion factor γ. Noting that it only works for one layer measurement to generate new sample for the other factor γ based on Projective limit measurement.
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
Args: γ: Distortion factor (readout fidelity parameter, 0 ≤ γ ≤ 1). trajectories: Vector of measurement trajectories. probabilities: Corresponding probabilities for each trajectory.
Returns: Tuple of (distortedtrajectories, distortedprobabilities) where: - distortedtrajectories: All possible distorted trajectories - distortedprobabilities: Their corresponding probabilities after distortion in corresponding order.
FibonacciChain.braidingsq_basismap
— Methodbraidingsqmap(::Type{T}, state::Vector{ET}, idx::Int, pbc::Bool=true; anyon_type::Symbol=:Fibo) where {N, T <: BitStr{N}, ET}
Apply braiding squared operation to quantum state at specified site.
Arguments
T::Type
: BitStr type specifying chain length Nstate::Vector{ET}
: Quantum state vector in anyon basisidx::Int
: Site index for braiding operationpbc::Bool=true
: Periodic boundary conditionsanyon_type::Symbol=:Fibo
: Model type
Returns
Vector{ET}
: Transformed state after braiding operation
Braiding is a fundamental topological operation that exchanges adjacent anyons.
FibonacciChain.braidingsqmap
— Methodbraidingsqmap(::Type{T}, state::Vector{ET}, idx::Int, pbc::Bool=true; anyon_type::Symbol=:Fibo) where {N, T <: BitStr{N}, ET}
Apply braiding squared operation to quantum state at specified site.
Arguments
T::Type
: BitStr type specifying chain length Nstate::Vector{ET}
: Quantum state vector in anyon basisidx::Int
: Site index for braiding operationpbc::Bool=true
: Periodic boundary conditionsanyon_type::Symbol=:Fibo
: Model type
Returns
Vector{ET}
: Transformed state after braiding operation
FibonacciChain.disjoint_rdm
— Methoddisjoint_rdm(::Type{T1}, ::Type{T2}, subsystemsA::Vector{Int64}, subsystemsB::Vector{Int64}, state::Vector{ET}, pbc::Bool=true; totalsubApbc::Bool=false, totalsubBpbc::Bool=false, anyon_typeA::Symbol=:Fibo, anyon_typeB::Symbol=:Fibo) where {N1, N2,T1 <: BitStr{N1},T2 <: BitStr{N2}, ET}
Compute reduced density matrix for two joint different systems, or two parallel chains. Where specified subsystems is given, output quantum state or density matrix.
Arguments
T1::Type
: BitStr type specifying chain length N1T2::Type
: BitStr type specifying chain length N2subsystemsA::Vector{Int64}
: Indices of subsystem sites to keepsubsystemsB::Vector{Int64}
: Indices of subsystem sites to keepstate::Vector{ET}
: Quantum state vector in total Hilbert spacepbc::Bool=true
: Periodic boundary conditionstotalsubApbc::Bool=false
: Whether the total subsystem A is periodictotalsubBpbc::Bool=false
: Whether the total subsystem B is periodicanyon_typeA::Symbol=:Fibo
: anyon type for subsystem Aanyon_typeB::Symbol=:Fibo
: anyon type for subsystem B
Returns
Matrix{ET}
: Reduced density matrix in total Hilbert basis
Examples
julia> using FibonacciChain, BitBasis, LinearAlgebra
julia> N1, N2 = 4, 4; T1, T2 = BitStr{N1,Int}, BitStr{N2,Int};
julia> basisA = anyon_basis(T1, true, anyon_type=:Fibo);
julia> basisB = anyon_basis(T2, true, anyon_type=:Fibo);
julia> state = randn(ComplexF64, length(basisA) * length(basisB));
julia> state ./= norm(state);
julia> rdm = disjoint_rdm(T1, T2, [1,2], [1,2], state, true,
totalsubApbc=false, totalsubBpbc=false,
anyon_typeA=:Fibo, anyon_typeB=:Fibo);
julia> size(rdm) # reduced density matrix dimension
(9, 9)
julia> ishermitian(rdm) # should be Hermitian
true
julia> tr(rdm) ≈ 0.9999999999999999 + 0.0im # trace should be 1
true
FibonacciChain.ee
— Methodee(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
FibonacciChain.ee_mps
— Methodcalculate_entanglement_entropy_mps(ψ::MPS, b::Int) -> Float64
Calculate entanglement entropy of MPS state with bipartition at bond b.
FibonacciChain.fibonacci_hamiltonian_mps
— Methodfibonacci_hamiltonian_mps(sites; pbc::Bool=true)
Construct Fibonacci chain Hamiltonian as Matrix Product Operator (MPO).
Arguments
sites
: ITensor site indicespbc::Bool=true
: Periodic boundary conditions
Returns
MPO
: Hamiltonian with three-body interactions based on Fibonacci fusion rules
FibonacciChain.initial_mps
— Methodfibonacci_mps_ground_state(N::Int; pbc::Bool=true, sweep_times=20, maxdim=50, cutoff=1e-10)
Find ground state of Fibonacci chain Hamiltonian using DMRG.
Arguments
N::Int
: System sizepbc::Bool=true
: Periodic boundary conditionssweep_times=20
: Number of DMRG sweepsmaxdim=50
: Maximum bond dimensioncutoff=1e-10
: Truncation cutoff
Returns
MPS
: Ground state as Matrix Product StateFloat64
: Ground state energy
Examples
julia> using FibonacciChain, ITensorMPS, ITensors
julia> N = 8;
julia> ψ_gs, E0 = fibonacci_mps_ground_state(N, pbc=true, maxdim=10, outputlevel=0);
julia> ψ_gs isa MPS
true
julia> E0 < 0 && imag(E0) ≈ 0
true
FibonacciChain.inversion_matrix
— Methodinversion_matrix(::Type{T}) where {N, T <: BitStr{N}}
Generate spatial inversion operator matrix for Fibonacci basis states.
Arguments
T::Type
: BitStr type specifying chain length N
Returns
Matrix{Float64}
: Inversion matrix mapping each basis state to its spatially reflected version
FibonacciChain.ladderChoi
— MethodladderChoi(::Type{T}, p::Float64, state::Vector{ET}, pbc::Bool=true; anyon_type::Symbol=:Fibo) where {N,T <: BitStr{N}, ET}
Apply probabilistic braiding noise channel to density matrix state in vec form.
Arguments
T::Type
: BitStr type specifying chain length Np::Float64
: Braiding probability (0 ≤ p ≤ 1)state::Vector{ET}
: Density matrix state in vectorized formpbc::Bool=true
: Periodic boundary conditionsanyon_type::Symbol=:Fibo
: Model type
Returns
Vector{ET}
: State after applying Choi map with braiding noise
Implements noise channel: ρ → (1-p)ρ + p B(ρ) where B is braiding operation.
FibonacciChain.ladderbraidingsqmap
— Methodladderbraidingsqmap(::Type{T}, state::Vector{ET}, idx::Int, pbc::Bool=true; anyon_type::Symbol=:Fibo) where {N, T <: BitStr{N}, ET}
Apply braiding squared operation to density matrix state in vectorized form. Effectively, it's the noise induced by inter-two layer chain braiding.
Arguments
T::Type
: BitStr type specifying chain length Nstate::Vector{ET}
: Density matrix state in vectorized formidx::Int
: Site index for braiding operationpbc::Bool=true
: Periodic boundary conditionsanyon_type::Symbol=:Fibo
: Model type
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; T = BitStr{N, Int};
julia> # Create PBC Fibonacci anyon basis
basis = anyon_basis(T, true, anyon_type=:Fibo);
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(T, ρ_vec, 2, true);
julia> norm(ρ_braided) > 0 # Should be non-zero
true
FibonacciChain.ladderrdm
— Methodladderrdm(::Type{T}, subsystems::Vector{Int64}, state::Vector{ET}, pbc::Bool=true; anyon_type::Symbol=:Fibo) where {N,T <: BitStr{N}, ET}
Compute reduced density matrix for specified subsystem from vectorized density matrix.
Arguments
T::Type
: BitStr type specifying chain length Nsubsystems::Vector{Int64}
: Indices of subsystem sites to trace outstate::Vector{ET}
: Full density matrix state in vectorized formpbc::Bool=true
: Periodic boundary conditionsanyon_type::Symbol=:Fibo
: Model type
Returns
Matrix{Float64}
: Reduced density matrix of the subsystem
For ladder systems where both subsystems have equal dimensions.
FibonacciChain.laddertranslationmap
— Methodladdertranslationmap(::Type{T}, state::Vector{ET}) where {N, T <: BitStr{N}, ET}
Apply translation operator to vectorized density matrix state.
Arguments
T::Type
: BitStr type specifying chain length Nstate::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.
FibonacciChain.mapst_sec2tot
— Methodmapst_sec2tot(::Type{T}, state::Vector{ET}, k::Int64; anyon_type::Symbol=:Fibo) where {N, T <: BitStr{N}, ET}
map state in symmetric sector to total Hilbert space.
Arguments
T::Type
: BitStr type specifying chain length Nstate::Vector{ET}
: State vector in symmetric sector Hilbert spaceanyon_type::Symbol=:Fibo
: anyon type
Returns
Vector{ET}
: Total space state vector
FibonacciChain.measure_basismap
— Methodmeasure_basismap(::Type{T}, τ::Float64, state::T, i::Int, sign::Int64, pbc::Bool=true; anyon_type::Symbol=:Fibo) where {N, T <: BitStr{N}}
Map single basis state under measurement operation at site i.
Arguments
T::Type
: BitStr type specifying chain length Nτ::Float64
: Measurement strength parameterstate::T
: Input basis statei::Int
: Measurement site index (1 ≤ i ≤ N)sign::Int64
: Measurement outcome (0 for +, 1 for -)pbc::Bool=true
: Periodic boundary conditionsanyon_type::Symbol=:Fibo
: anyon type
Returns
- Basis-dependent output: Either
(basis, coefficient)
or(basis1, basis2, coeff1, coeff2)
Maps individual basis states according to measurement protocols and fusion rules. Here we choose Heisenberg-like preferring way, selecting specific fusion outcome.
Examples
julia> using FibonacciChain, BitBasis
julia> N = 4; T = BitStr{N, Int};
julia> state = T(0b0100); # Single τ at site 2
julia> τ = 1.0; # Measurement strength
julia> # Measure at site 2 with outcome + (sign=0)
result = measure_basismap(T, τ, state, 2, 0, true);
julia> length(result) ∈ [2, 4] # Returns 2 or 4 elements depending on configuration
true
julia> # The first element is always a basis state
typeof(result[1]) == T
true
FibonacciChain.measurement_enumeration
— Methodmeasurement_enumeration(::Type{T}, τ::Float64, initial_state::Vector{ET}, measurement_sites::Vector{Int}, pbc::Bool=true; anyon_type::Symbol=:Fibo) where {N, T <: BitStr{N}, ET}
Enumerating all trajectories of measurements on a given initial state.
Args:T, τ, initialstate, measurementsites, pbc
Returns: final_states, trajectories, probabilities
FibonacciChain.measurement_operator_mps
— Methodmeasurement_operator_mps(sites, i::Int, τ::Float64, sign::Int64; pbc::Bool=true, anyon_type::Symbol=:Fibo)
Create local measurement operator at site i as Matrix Product Operator.
Arguments
sites
: ITensor site indicesi::Int
: Measurement siteτ::Float64
: Evolution time parametersign::Int64
: Measurement outcome (0 or 1)pbc::Bool=true
: Periodic boundary conditionsanyon_type::Symbol=:Fibo
: Model type
Returns
ITensor
: Local measurement operator incorporating neighboring site correlations
FibonacciChain.mps_boundary_measure
— Methodmps_boundary_measure(ψ::MPS, sites, measurement_sites::Vector{Int}, τ::Float64;
num_samples::Int=1000, pbc::Bool=true) -> Vector{Vector{Int64}}, Vector{Float64}
Perform boundary measurements on MPS state.
FibonacciChain.mps_bulk_measurement
— Methodmps_bulk_measurement(ψ::MPS, sites, N::Int, τ::Float64, D::Int; pbc::Bool=true)
Perform bulk measurements on MPS with D layers.
FibonacciChain.mps_measurement_enumeration
— Methodmps_measurement_enumeration(ψ::MPS, sites, measurement_sites::Vector{Int}, τ::Float64;
pbc::Bool=true) -> Vector{MPS}, Vector{Vector{Int64}}, Vector{Float64}
Enumerate all possible measurement trajectories on MPS state.
FibonacciChain.ref_correlation
— Methodref_correlation(N::Int64, state_addref3::Vector{ET}; pbc::Bool=true, anyon_type::Symbol=:Fibo) where {ET}
Calculate spatio-temporal correlation using state with three reference qubits.
Arguments
N::Int64
: System sizestate_addref3::Vector{ET}
: Quantum state with three reference qubits addedpbc::Bool=true
: Periodic boundary conditionsanyon_type::Symbol=:Fibo
: Model type
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.
FibonacciChain.reference_evolution
— Methodreference_evolution(τ, forward, sample, site, t₁, t₂; pbc=true, anyon_type::Symbol=:Fibo, temp::Bool=false)
Compute temporal correlation between two time slices using cached forward evolution.
Arguments
τ
: Evolution time parameterforward
: Cached forward state evolution trajectorysample
: Measurement sample configurationx₂
: Site index for reference qubit insertiont₁
: First time slice indext₂
: Second time slice index (must be >= t₁)x₁::Int=1
: Spatial site index for first reference qubitpbc=true
: Periodic boundary conditionsanyon_type::Symbol=:Fibo
: anyon typetemp::Bool=false
: Return trajectory if trueverbose::Bool=false
: Enable verbose output
Returns
- Reference qubit added state between specified time slices
Avoids redundant computation by reusing forward evolution results.
FibonacciChain.reference_generate_state
— Methodreference_generate_state(N::Int64, τ::Float64, state::Vector{ET}, sample; pbc::Bool=true, temp::Bool=true, k_old::Int64=1, anyon_type::Symbol=:Fibo) where {ET}
Generate quantum state evolution under measurement protocol with reference qubits.
Arguments
N::Int64
: System sizeτ::Float64
: Evolution time parameterstate::Vector{ET}
: Initial quantum state with reference qubitssample
: Measurement sample configurationpbc::Bool=true
: Periodic boundary conditionstemp::Bool=true
: Return trajectory if true, final state if falseanyon_type::Symbol=:Fibo
: Model type
Returns
Vector{ET}
or trajectory: Evolved state or time evolution trajectory
Examples
julia> using FibonacciChain, Random, LinearAlgebra
julia> N = 4;
julia> initial_state = normalize!(ones(Float64, length(anyon_basis(N))));
julia> add_ref = add_reference_qubits!(N, initial_state, 1, verbose=false);
julia> Random.seed!(42);
julia> sample = ones(Int, 2, 2);
julia> τ = 0.5;
julia> trajectory = reference_generate_state(τ, add_ref, sample, temp=true);
julia> length(trajectory) == size(sample, 1)
true
FibonacciChain.spatial_correlation
— Methodspatial_correlation(N::Int64, state::Union{Vector{ET}, Matrix{ET}}, site1::Int64, site2::Int64; pbc::Bool=true, anyon_type::Symbol=:Fibo) where {ET}
Calculate mutual information between two sites as spatial correlation measure.
Arguments
N::Int64
: System sizestate::Union{Vector{ET}, Matrix{ET}}
: Quantum state vector or density matrixsite1::Int64
: First site index (1 ≤ site1 ≤ N)site2::Int64
: Second site index (1 ≤ site2 ≤ N, site2 ≠ site1)pbc::Bool=true
: Periodic boundary conditionsanyon_type::Symbol=:Fibo
: Model type
Returns
Float64
: Mutual information I(1:2) = S(1) + S(2) - S(1,2)
Computes quantum mutual information as measure of spatial correlations.
FibonacciChain.temporal_correlation
— Methodtemporal_correlation(N::Int64, state_addref2::Vector{ET}; pbc::Bool=true, anyon_type::Symbol=:Fibo) where {ET}
Calculate temporal correlation using state with two reference qubits.
Arguments
N::Int64
: System sizestate_addref2::Vector{ET}
: Quantum state with two reference qubits addedpbc::Bool=true
: Periodic boundary conditionsanyon_type::Symbol=:Fibo
: Model type
Returns
Float64
: Temporal correlation measure between time slices
Uses reference qubit protocol to measure temporal correlations at single site.
FibonacciChain.topological_symmetry_basismap
— Methodtopological_symmetry_basismap(state::T, pbc::Bool=true) where {N, T <: BitStr{N}}
Compute topological symmetry coefficients for all basis states relative to given state.
Arguments
state::T
: Reference state configurationpbc::Bool=true
: Periodic boundary conditions
Returns
Vector{Float64}
: Coefficients for each basis state
Examples
julia> using FibonacciChain, BitBasis
julia> N = 4; T = BitStr{N, Int};
julia> state = T(0b0000); # Vacuum state
julia> coeffs = topological_symmetry_basismap(state, true);
julia> length(coeffs) == length(anyon_basis(T, true, anyon_type=:Fibo))
true
julia> all(x -> abs(x) > 1e-10 || abs(x) < 1e-10, coeffs) # All coeffs are well-defined
true
FibonacciChain.translation_matrix
— Methodtranslation_matrix(::Type{T}) where {N, T <: BitStr{N}}
Generate translation operator matrix for Fibonacci basis states.
Arguments
T::Type
: BitStr type specifying chain length N
Returns
Matrix{Float64}
: Translation matrix mapping each basis state to its translated version
Index
FibonacciChain.Boundary_measure
FibonacciChain.Boundary_measure
FibonacciChain.Boundarypost_selection
FibonacciChain.Boundarypost_selection
FibonacciChain.Bulkmeasure
FibonacciChain.Bulkmeasure
FibonacciChain.Bulkpost_selection
FibonacciChain.Bulkpost_selection
FibonacciChain.Fsymmetry_coef
FibonacciChain.Fsymmetry_coef
FibonacciChain.add_reference_qubits!
FibonacciChain.anyon_basis
FibonacciChain.anyon_basis
FibonacciChain.anyon_basis
FibonacciChain.anyon_eelis
FibonacciChain.anyon_eelis
FibonacciChain.anyon_eelis_mps
FibonacciChain.anyon_eelis_mps
FibonacciChain.anyon_ham
FibonacciChain.anyon_ham
FibonacciChain.anyon_ham
FibonacciChain.anyon_ham_sparse
FibonacciChain.anyon_ham_sparse
FibonacciChain.anyon_ham_sparse
FibonacciChain.anyon_rdm
FibonacciChain.anyon_rdm
FibonacciChain.anyon_rdm_sec
FibonacciChain.anyon_rdm_sec
FibonacciChain.apply_measurement_mps
FibonacciChain.apply_measurement_mps
FibonacciChain.bayes_distort
FibonacciChain.braidingsq_basismap
FibonacciChain.braidingsqmap
FibonacciChain.braidingsqmap
FibonacciChain.disjoint_rdm
FibonacciChain.disjoint_rdm
FibonacciChain.ee
FibonacciChain.ee
FibonacciChain.ee_mps
FibonacciChain.ee_mps
FibonacciChain.fibonacci_hamiltonian_mps
FibonacciChain.fibonacci_hamiltonian_mps
FibonacciChain.initial_mps
FibonacciChain.initial_mps
FibonacciChain.inversion_matrix
FibonacciChain.inversion_matrix
FibonacciChain.ladderChoi
FibonacciChain.ladderChoi
FibonacciChain.ladderbraidingsqmap
FibonacciChain.ladderbraidingsqmap
FibonacciChain.ladderrdm
FibonacciChain.ladderrdm
FibonacciChain.laddertranslationmap
FibonacciChain.laddertranslationmap
FibonacciChain.mapst_sec2tot
FibonacciChain.mapst_sec2tot
FibonacciChain.measure_basismap
FibonacciChain.measure_basismap
FibonacciChain.measurement_enumeration
FibonacciChain.measurement_enumeration
FibonacciChain.measurement_operator_mps
FibonacciChain.measurement_operator_mps
FibonacciChain.mps_boundary_measure
FibonacciChain.mps_boundary_measure
FibonacciChain.mps_bulk_measurement
FibonacciChain.mps_bulk_measurement
FibonacciChain.mps_measurement_enumeration
FibonacciChain.mps_measurement_enumeration
FibonacciChain.ref_correlation
FibonacciChain.reference_evolution
FibonacciChain.reference_generate_state
FibonacciChain.spatial_correlation
FibonacciChain.spatial_correlation
FibonacciChain.temporal_correlation
FibonacciChain.temporal_correlation
FibonacciChain.topological_symmetry_basismap
FibonacciChain.topological_symmetry_basismap
FibonacciChain.translation_matrix
FibonacciChain.translation_matrix