Skip to main content

SpinWalk

Struct SpinWalk 

Source
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 C applies coins[x] to the colors of each node x;
  • the motion M swaps 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

Source

pub fn half_edge_probabilities(&self, psi: &[c64]) -> Vec<f64>

Probability on each half-edge, Σ_s |ψ(h, s)|².

Source

pub fn node_probabilities(&self, psi: &[c64]) -> Vec<f64>

Particle distribution p(x) = Σ_{c,s} |ψ(x, c, s)|².

Source

pub fn spins(&self, psi: &[c64]) -> Vec<[f64; 3]>

Spin expectation (⟨X⟩, ⟨Y⟩, ⟨Z⟩) of every edge (Z = +1 for spin up).

Source

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).

Source

pub fn position_density(&self, psi: &[c64]) -> CMat

Reduced density matrix of the position, colors padded to the largest degree.

Source

pub fn color_density(&self, psi: &[c64]) -> CMat

Reduced density matrix of the color, padded to the largest degree.

Source

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.

Source

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.

Source

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.

Source

pub fn concurrence(&self, psi: &[c64], e1: usize, e2: usize) -> f64

Concurrence of the spins of edges e1, e2 (Wootters).

Source§

impl SpinWalk

Source

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

Source

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.

Source

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.

Source

pub fn graph(&self) -> &Graph

The graph of the walk; edge e carries spin e.

Source

pub fn coins(&self) -> &[CMat] ⓘ

The coin of each node x (d_x × d_x, on its colors).

Source

pub fn coupling(&self) -> f64

Particle–spin coupling J.

Source

pub fn row_len(&self) -> usize

Spin configurations per half-edge, 2^|E|.

Source

pub fn dimension(&self) -> usize

Dimension of the Hilbert space, 2|E| · 2^|E|.

Source

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.

Source

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.

Source

pub fn steps<T: Real>(&self, psi: &mut [Complex<T>], steps: usize)

steps steps.

Source

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.

Source

pub fn steps_serial<T: Real>(&self, psi: &mut [Complex<T>], steps: usize)

steps steps on the calling thread only.

Source

pub fn coin_pass<T: Real>(&self, psi: &mut [Complex<T>])

ψ ← C ψ, the coin part of a step.

Source

pub fn edge_pass<T: Real>(&self, psi: &mut [Complex<T>])

ψ ← V(J) M ψ, the motion and interaction part of a step.

Source

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.

Source

pub fn matrix(&self) -> SparseMatrix

The one-step operator U as a sparse matrix (at most 2 d_max entries per column).

Source

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.

Source

pub fn localized(&self, x: usize, c: usize) -> Vec<c64> ⓘ

Walker on color c of node x (a half-edge), as the walker of Self::product_state.

Trait Implementations§

Source§

impl Clone for SpinWalk

Source§

fn clone(&self) -> SpinWalk

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for SpinWalk

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> AutoreleaseSafe for T
where T: ?Sized,

Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
§

impl<T> ByRef<T> for T

§

fn by_ref(&self) -> &T

Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<T, U> Imply<T> for U
where T: ?Sized, U: ?Sized,

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts 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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts 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
§

impl<T> Pointable for T

§

const ALIGN: usize

The alignment of pointer.
§

type Init = T

The type for initializers.
§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.