Skip to main content

LocalUpdateSweepPlan

Struct LocalUpdateSweepPlan 

Source
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: usize

Number of sites per update (1 or 2).

Implementations§

Source§

impl<V> LocalUpdateSweepPlan<V>
where V: Clone + Hash + Eq + Send + Sync + Debug,

Source

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.

Source

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 topology
  • root - The starting node for the sweep
  • nsite - 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)]
Source

pub fn empty(nsite: usize) -> Self

Create an empty sweep plan.

Source

pub fn is_empty(&self) -> bool

Check if the plan is empty.

Source

pub fn len(&self) -> usize

Number of update steps.

Source

pub fn iter(&self) -> impl Iterator<Item = &LocalUpdateStep<V>>

Iterate over the steps.

Trait Implementations§

Source§

impl<V: Clone> Clone for LocalUpdateSweepPlan<V>

Source§

fn clone(&self) -> LocalUpdateSweepPlan<V>

Returns a duplicate of the value. Read more
1.0.0 · Source§

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

Performs copy-assignment from source. Read more
Source§

impl<V: Debug> Debug for LocalUpdateSweepPlan<V>

Source§

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

Formats the value using the given formatter. Read more

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

Source§

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

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
§

impl<U> As for U

§

fn as_<T>(self) -> T
where T: CastFrom<U>,

Casts 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 more
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

§

impl<T> ByRef<T> for T

§

fn by_ref(&self) -> &T

§

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
§

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

§

fn rand<T>(&self, rng: &mut (impl Rng + ?Sized)) -> T
where Self: Distribution<T>,

§

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

§

fn rand<T>(&self, rng: &mut (impl Rng + ?Sized)) -> T
where Self: Distribution<T>,

§

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

§

fn rand<T>(&self, rng: &mut (impl Rng + ?Sized)) -> T
where Self: Distribution<T>,

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

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

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

§

fn vzip(self) -> V

§

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

§

impl<T> MaybeSend for T

§

impl<T> MaybeSendSync for T

§

impl<T> MaybeSync for T