pub struct SpinWalk { /* private fields */ }Expand description
A walker on a graph coupled to one spin per edge (K. Sellapillay and A. D. Verga, Phys. Rev.
E 103, 032123 (2021)). One step is U = V(J) M C:
- the coin
Cappliescoins[x]to the colors of each nodex; - the motion
Mswaps the two half-edges of every edge,|x c_y s⟩ ↔ |y c_x s⟩; - the interaction
V(J) = exp(i J τ·σ / 4)couples, on every edge, the walker’s side of the edge (τ) to the edge spin (σ): an exchange that can move the walker across the edge while flipping the spin.
The state is ψ[h · 2^|E| + s]: half-edge h, spin configuration s (bit e of s is the
spin of edge e, 0 for up).
Implementations§
Source§impl SpinWalk
impl SpinWalk
Sourcepub fn half_edge_probabilities(&self, psi: &[c64]) -> Vec<f64>
pub fn half_edge_probabilities(&self, psi: &[c64]) -> Vec<f64>
Probability on each half-edge, Σ_s |ψ(h, s)|².
Sourcepub fn node_probabilities(&self, psi: &[c64]) -> Vec<f64>
pub fn node_probabilities(&self, psi: &[c64]) -> Vec<f64>
Particle distribution p(x) = Σ_{c,s} |ψ(x, c, s)|².
Sourcepub fn spins(&self, psi: &[c64]) -> Vec<[f64; 3]>
pub fn spins(&self, psi: &[c64]) -> Vec<[f64; 3]>
Spin expectation (⟨X⟩, ⟨Y⟩, ⟨Z⟩) of every edge (Z = +1 for spin up).
Sourcepub fn walker_density(&self, psi: &[c64]) -> CMat
pub fn walker_density(&self, psi: &[c64]) -> CMat
Gram matrix of the half-edge rows, G[h, h'] = Σ_s ψ(h, s) ψ*(h', s): the reduced
density matrix of the walker (position and color).
Sourcepub fn position_density(&self, psi: &[c64]) -> CMat
pub fn position_density(&self, psi: &[c64]) -> CMat
Reduced density matrix of the position, colors padded to the largest degree.
Sourcepub fn color_density(&self, psi: &[c64]) -> CMat
pub fn color_density(&self, psi: &[c64]) -> CMat
Reduced density matrix of the color, padded to the largest degree.
Sourcepub fn entropies(&self, psi: &[c64]) -> [f64; 3]
pub fn entropies(&self, psi: &[c64]) -> [f64; 3]
Entropies (S_x, S_c, S_s) of the position, the color and all the spins; S_s is that of
the walker (position and color together), the state being pure.
Sourcepub fn spin_density(&self, psi: &[c64], edges: &[usize]) -> CMat
pub fn spin_density(&self, psi: &[c64], edges: &[usize]) -> CMat
Reduced density matrix of the spins of edges: basis index Σ_k bit(edges[k]) 2^k.
Sourcepub fn spin_entropy(&self, psi: &[c64], edges: &[usize]) -> f64
pub fn spin_entropy(&self, psi: &[c64], edges: &[usize]) -> f64
Entanglement entropy S_A of the spins of edges with the rest of the system.
Sourcepub fn concurrence(&self, psi: &[c64], e1: usize, e2: usize) -> f64
pub fn concurrence(&self, psi: &[c64], e1: usize, e2: usize) -> f64
Concurrence of the spins of edges e1, e2 (Wootters).
Source§impl SpinWalk
impl SpinWalk
Sourcepub fn accumulate_node_probabilities(&self, psi: &[c64], acc: &mut [f64])
pub fn accumulate_node_probabilities(&self, psi: &[c64], acc: &mut [f64])
Adds p(x) to acc on the calling thread (for runs side by side, see
SpinWalk::step_serial).
Source§impl SpinWalk
impl SpinWalk
Sourcepub fn new(graph: Graph, coins: Vec<CMat>, j: f64) -> Self
pub fn new(graph: Graph, coins: Vec<CMat>, j: f64) -> Self
Walk with one coin per node (a d_x × d_x unitary) and coupling j.
Sourcepub fn ring(n: usize, theta: f64, j: f64) -> Self
pub fn ring(n: usize, theta: f64, j: f64) -> Self
The one-dimensional lattice of the paper: a ring of n nodes, coin R(θ) everywhere.
Sourcepub fn exchange(&self) -> (c64, c64, c64)
pub fn exchange(&self) -> (c64, c64, c64)
The edge part V(J) M on the four amplitudes (a0, a1, b0, b1) of an edge: half-edges
a, b, edge spin 0 or 1. Returns (p, α, β) such that
a0' = p b0, a1' = α b1 + β a0, b0' = β b1 + α a0, b1' = p a1.
Sourcepub fn step<T: Real>(&self, psi: &mut [Complex<T>])
pub fn step<T: Real>(&self, psi: &mut [Complex<T>])
One step ψ ← U ψ, on all the threads of the rayon pool (f64 or f32 state).
§Panics
If psi.len() is not Self::dimension, as every method that takes a state.
Sourcepub fn step_serial<T: Real>(&self, psi: &mut [Complex<T>])
pub fn step_serial<T: Real>(&self, psi: &mut [Complex<T>])
One step on the calling thread only: for many small walks run side by side (a scan of parameters), each state staying in its core’s cache.
Sourcepub fn steps_serial<T: Real>(&self, psi: &mut [Complex<T>], steps: usize)
pub fn steps_serial<T: Real>(&self, psi: &mut [Complex<T>], steps: usize)
steps steps on the calling thread only.
Sourcepub fn edge_pass<T: Real>(&self, psi: &mut [Complex<T>])
pub fn edge_pass<T: Real>(&self, psi: &mut [Complex<T>])
ψ ← V(J) M ψ, the motion and interaction part of a step.
Sourcepub fn step_serial_accumulate<T: Real>(
&self,
psi: &mut [Complex<T>],
acc: &mut [f64],
)
pub fn step_serial_accumulate<T: Real>( &self, psi: &mut [Complex<T>], acc: &mut [f64], )
One step on the calling thread, adding the probability of every half-edge after the step
to acc (Σ_s |ψ(h, s)|², one entry per half-edge) at no extra sweep over memory: for
time averages in scans of parameters.
§Panics
If psi.len() is not Self::dimension or acc.len() is not the number of half-edges.
Sourcepub fn matrix(&self) -> SparseMatrix
pub fn matrix(&self) -> SparseMatrix
The one-step operator U as a sparse matrix (at most 2 d_max entries per column).
Sourcepub fn product_state(&self, walker: &[c64], spins: &[[c64; 2]]) -> Vec<c64> ⓘ
pub fn product_state(&self, walker: &[c64], spins: &[[c64; 2]]) -> Vec<c64> ⓘ
The product state walker ⊗ spins[0] ⊗ … ⊗ spins[|E| − 1], with walker the amplitude
on each half-edge and spins[e] the (up, down) amplitudes of spin e.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for SpinWalk
impl RefUnwindSafe for SpinWalk
impl Send for SpinWalk
impl Sync for SpinWalk
impl Unpin for SpinWalk
impl UnsafeUnpin for SpinWalk
impl UnwindSafe for SpinWalk
Blanket Implementations§
impl<T> AutoreleaseSafe for Twhere
T: ?Sized,
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T, U> Imply<T> for U
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more