pub struct SquareLinsolveUpdater<T, V>{
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:
- Compute local operator (from ProjectedOperator environments)
- Compute local RHS (from ProjectedState environments)
- Solve local linear system using GMRES
- 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: LinsolveOptionsSolver options
Implementations§
Source§impl<T, V> SquareLinsolveUpdater<T, V>
impl<T, V> SquareLinsolveUpdater<T, V>
Sourcepub fn new(
operator: TreeTN<T, V>,
rhs: TreeTN<T, V>,
options: LinsolveOptions,
) -> Self
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.
Sourcepub 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
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 IDsinput_mapping- Mapping from true input indices to MPO’s internal indicesoutput_mapping- Mapping from true output indices to MPO’s internal indicesrhs- The RHS boptions- Solver options
Sourcepub fn verify(&self, state: &TreeTN<T, V>) -> Result<LinsolveVerifyReport<V>>
pub fn verify(&self, state: &TreeTN<T, V>) -> Result<LinsolveVerifyReport<V>>
Verify internal data consistency between operator, RHS, and state.
This function checks that:
- The operator’s site space structure is compatible with the state
- The operator’s input indices can match the state’s site indices
- 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>
impl<T, V> LocalUpdater<T, V> for SquareLinsolveUpdater<T, V>
Source§fn before_step(
&mut self,
step: &LocalUpdateStep<V>,
full_treetn_before: &TreeTN<T, V>,
) -> Result<()>
fn before_step( &mut self, step: &LocalUpdateStep<V>, full_treetn_before: &TreeTN<T, V>, ) -> Result<()>
Source§fn update(
&mut self,
subtree: TreeTN<T, V>,
step: &LocalUpdateStep<V>,
full_treetn: &TreeTN<T, V>,
) -> Result<TreeTN<T, V>>
fn update( &mut self, subtree: TreeTN<T, V>, step: &LocalUpdateStep<V>, full_treetn: &TreeTN<T, V>, ) -> Result<TreeTN<T, V>>
Source§fn after_step(
&mut self,
step: &LocalUpdateStep<V>,
full_treetn_after: &TreeTN<T, V>,
) -> Result<()>
fn after_step( &mut self, step: &LocalUpdateStep<V>, full_treetn_after: &TreeTN<T, V>, ) -> Result<()>
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>
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§
§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
§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