Skip to main content

SquareLinsolveUpdater

Struct SquareLinsolveUpdater 

Source
pub struct SquareLinsolveUpdater<T, V>
where T: TensorLike, V: Clone + Hash + Eq + Send + Sync + Debug,
{ pub projected_operator: Arc<RwLock<ProjectedOperator<T, V>>>, pub projected_state: ProjectedState<T, V>, pub options: LinsolveOptions, /* private fields */ }
Expand description

SquareLinsolveUpdater: Implements LocalUpdater for the square linsolve algorithm.

At each sweep step:

  1. Compute local operator (from ProjectedOperator environments)
  2. Compute local RHS (from ProjectedState environments)
  3. Solve local linear system using GMRES
  4. Factorize the result and update the state

This is the V_in = V_out specialized version. The current solution x is used with a separate reference state (with different bond indices) for stable environment computation.

Fields§

§projected_operator: Arc<RwLock<ProjectedOperator<T, V>>>

Projected operator (3-chain), wrapped in Arc<RwLock> for GMRES.

§projected_state: ProjectedState<T, V>

Projected state for RHS (2-chain)

§options: LinsolveOptions

Solver options

Implementations§

Source§

impl<T, V> SquareLinsolveUpdater<T, V>
where T: TensorLike + 'static, T::Index: IndexLike, <T::Index as IndexLike>::Id: Clone + Hash + Eq + Ord + Debug + Send + Sync + 'static, V: Clone + Hash + Eq + Ord + Send + Sync + Debug + 'static,

Source

pub fn new( operator: TreeTN<T, V>, rhs: TreeTN<T, V>, options: LinsolveOptions, ) -> Self

Create a new SquareLinsolveUpdater.

The reference_state will be initialized lazily on the first before_step call.

Source

pub fn with_index_mappings( operator: TreeTN<T, V>, input_mapping: HashMap<V, IndexMapping<T::Index>>, output_mapping: HashMap<V, IndexMapping<T::Index>>, rhs: TreeTN<T, V>, options: LinsolveOptions, ) -> Self

Create a new SquareLinsolveUpdater with index mappings for correct index handling.

Use this when the MPO uses internal indices (s_in_tmp, s_out_tmp) that differ from the state’s site indices. The mappings define how to translate between them.

The reference_state will be initialized lazily on the first before_step call.

§Arguments
  • operator - The MPO with internal index IDs
  • input_mapping - Mapping from true input indices to MPO’s internal indices
  • output_mapping - Mapping from true output indices to MPO’s internal indices
  • rhs - The RHS b
  • options - Solver options
Source

pub fn verify(&self, state: &TreeTN<T, V>) -> Result<LinsolveVerifyReport<V>>

Verify internal data consistency between operator, RHS, and state.

This function checks that:

  1. The operator’s site space structure is compatible with the state
  2. The operator’s input indices can match the state’s site indices
  3. Environment computation requirements are satisfiable

Returns a detailed report of any inconsistencies found.

Trait Implementations§

Source§

impl<T, V> LocalUpdater<T, V> for SquareLinsolveUpdater<T, V>
where T: TensorLike + 'static, T::Index: IndexLike, <T::Index as IndexLike>::Id: Clone + Hash + Eq + Ord + Debug + Send + Sync + 'static, V: Clone + Hash + Eq + Ord + Send + Sync + Debug + 'static,

Source§

fn before_step( &mut self, step: &LocalUpdateStep<V>, full_treetn_before: &TreeTN<T, V>, ) -> Result<()>

Optional hook called before performing an update step. Read more
Source§

fn update( &mut self, subtree: TreeTN<T, V>, step: &LocalUpdateStep<V>, full_treetn: &TreeTN<T, V>, ) -> Result<TreeTN<T, V>>

Update a local subtree. Read more
Source§

fn after_step( &mut self, step: &LocalUpdateStep<V>, full_treetn_after: &TreeTN<T, V>, ) -> Result<()>

Optional hook called after an update step has been applied to the full TreeTN. Read more

Auto Trait Implementations§

§

impl<T, V> Freeze for SquareLinsolveUpdater<T, V>

§

impl<T, V> RefUnwindSafe for SquareLinsolveUpdater<T, V>
where <T as TensorIndex>::Index: RefUnwindSafe, V: RefUnwindSafe, T: RefUnwindSafe, <<T as TensorIndex>::Index as IndexLike>::Id: RefUnwindSafe,

§

impl<T, V> Send for SquareLinsolveUpdater<T, V>

§

impl<T, V> Sync for SquareLinsolveUpdater<T, V>

§

impl<T, V> Unpin for SquareLinsolveUpdater<T, V>
where <T as TensorIndex>::Index: Unpin, V: Unpin, T: Unpin, <<T as TensorIndex>::Index as IndexLike>::Id: Unpin,

§

impl<T, V> UnsafeUnpin for SquareLinsolveUpdater<T, V>

§

impl<T, V> UnwindSafe for SquareLinsolveUpdater<T, V>
where <T as TensorIndex>::Index: UnwindSafe, V: UnwindSafe, T: UnwindSafe, <<T as TensorIndex>::Index as IndexLike>::Id: 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

§

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, 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