pub struct LocalUpdateSweepPlan<V> {
pub steps: Vec<LocalUpdateStep<V>>,
pub nsite: usize,
}Expand description
A complete sweep plan for local updates.
Generated from an Euler tour, this plan specifies the sequence of local update operations for algorithms like truncation and fitting.
§Sweep Direction
The sweep follows an Euler tour starting from the root, visiting each edge twice (forward and backward). This ensures all bonds are updated in both directions, which is essential for algorithms like DMRG/TEBD.
§nsite Parameter
nsite=1: Single-site updates. Each step extracts one node.nsite=2: Two-site updates. Each step extracts two adjacent nodes (an edge).
Two-site updates are more expensive but can change bond dimensions and are necessary for algorithms like TDVP-2 or two-site DMRG.
Fields§
§steps: Vec<LocalUpdateStep<V>>The sequence of update steps.
nsite: usizeNumber of sites per update (1 or 2).
Implementations§
Source§impl<V> LocalUpdateSweepPlan<V>
impl<V> LocalUpdateSweepPlan<V>
Sourcepub fn from_treetn<T>(
treetn: &TreeTN<T, V>,
root: &V,
nsite: usize,
) -> Option<Self>where
T: TensorLike,
pub fn from_treetn<T>(
treetn: &TreeTN<T, V>,
root: &V,
nsite: usize,
) -> Option<Self>where
T: TensorLike,
Generate a sweep plan from a TreeTN’s topology.
Convenience method that extracts the NodeNameNetwork topology from a TreeTN.
Sourcepub fn new(network: &NodeNameNetwork<V>, root: &V, nsite: usize) -> Option<Self>
pub fn new(network: &NodeNameNetwork<V>, root: &V, nsite: usize) -> Option<Self>
Generate a sweep plan from a NodeNameNetwork.
Uses Euler tour traversal to visit all edges in both directions.
§Arguments
network- The network topologyroot- The starting node for the sweepnsite- Number of sites per update (1 or 2)
§Returns
A sweep plan, or None if the root doesn’t exist or nsite is invalid.
§Example
For nsite=1 on chain A-B-C with root B:
- Euler tour vertices: [B, A, B, C, B]
- Steps: [(B, B), (A, A), (B, B), (C, C)] (each vertex except last)
For nsite=2 on chain A-B-C with root B:
- Euler tour edges: [(B,A), (A,B), (B,C), (C,B)]
- Steps: [({B,A}, A), ({A,B}, B), ({B,C}, C), ({C,B}, B)]
Sourcepub fn iter(&self) -> impl Iterator<Item = &LocalUpdateStep<V>>
pub fn iter(&self) -> impl Iterator<Item = &LocalUpdateStep<V>>
Iterate over the steps.
Trait Implementations§
Source§impl<V: Clone> Clone for LocalUpdateSweepPlan<V>
impl<V: Clone> Clone for LocalUpdateSweepPlan<V>
Source§fn clone(&self) -> LocalUpdateSweepPlan<V>
fn clone(&self) -> LocalUpdateSweepPlan<V>
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreAuto Trait Implementations§
impl<V> Freeze for LocalUpdateSweepPlan<V>
impl<V> RefUnwindSafe for LocalUpdateSweepPlan<V>where
V: RefUnwindSafe,
impl<V> Send for LocalUpdateSweepPlan<V>where
V: Send,
impl<V> Sync for LocalUpdateSweepPlan<V>where
V: Sync,
impl<V> Unpin for LocalUpdateSweepPlan<V>where
V: Unpin,
impl<V> UnsafeUnpin for LocalUpdateSweepPlan<V>
impl<V> UnwindSafe for LocalUpdateSweepPlan<V>where
V: UnwindSafe,
Blanket Implementations§
§impl<U> As for U
impl<U> As for U
§fn as_<T>(self) -> Twhere
T: CastFrom<U>,
fn as_<T>(self) -> Twhere
T: CastFrom<U>,
self to type T. The semantics of numeric casting with the as operator are followed, so <T as As>::as_::<U> can be used in the same way as T as U for numeric conversions. Read moreSource§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> DistributionExt for Twhere
T: ?Sized,
impl<T> DistributionExt for Twhere
T: ?Sized,
fn rand<T>(&self, rng: &mut (impl Rng + ?Sized)) -> Twhere
Self: Distribution<T>,
§impl<T> DistributionExt for Twhere
T: ?Sized,
impl<T> DistributionExt for Twhere
T: ?Sized,
fn rand<T>(&self, rng: &mut (impl Rng + ?Sized)) -> Twhere
Self: Distribution<T>,
§impl<T> DistributionExt for Twhere
T: ?Sized,
impl<T> DistributionExt for Twhere
T: ?Sized,
fn rand<T>(&self, rng: &mut (impl Rng + ?Sized)) -> Twhere
Self: Distribution<T>,
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