Uni20
Asynchronous tensor and runtime library.
Loading...
Searching...
No Matches
Public Types | Public Member Functions | List of all members
uni20::tensor_network::MpoEnvironmentCache< MpsChain, MpoChain, EnvironmentStorage > Class Template Reference

Directional MPO environment cache borrowed from finite MPS and MPO owners. More...

#include <environment_cache.hpp>

Public Types

using auxiliary_space_type = typename mpo_type::auxiliary_space_type
 
using bond_space_type = typename mps_type::bond_space_type
 
using environment_type = MpoEnvironment< value_type, bond_space_type, auxiliary_space_type, bond_space_type, EnvironmentStorage >
 
using mpo_block_type = block_tensor_const_block_t< typename mpo_type::site_type >
 
using mpo_type = std::remove_cvref_t< MpoChain >
 
using mps_type = std::remove_cvref_t< MpsChain >
 
using value_type = typename mps_type::value_type
 

Public Member Functions

void build_all ()
 Build every left and right environment entry.
 
auto is_attached_to (mps_type const &mps, mpo_type const &mpo) const noexcept -> bool
 Return whether this cache observes the supplied chain objects.
 
auto left_cached (std::size_t bond) -> bool
 Return whether the left environment at a bond is currently cached.
 
auto left_environment (std::size_t bond) -> environment_type const &
 Build and return the left environment at one bond.
 
 MpoEnvironmentCache (mps_type const &mps, mpo_type const &mpo, std::size_t left_auxiliary_index, std::size_t right_auxiliary_index)
 Construct boundary entries and validate the coupled chains.
 
auto right_cached (std::size_t bond) -> bool
 Return whether the right environment at a bond is currently cached.
 
auto right_environment (std::size_t bond) -> environment_type const &
 Build and return the right environment at one bond.
 
auto size () const noexcept -> std::size_t
 Return the number of physical sites.
 

Detailed Description

template<class MpsChain, class MpoChain, SparseBlockStorage EnvironmentStorage = SeparateSparseBlockStorage<>>
class uni20::tensor_network::MpoEnvironmentCache< MpsChain, MpoChain, EnvironmentStorage >

Directional MPO environment cache borrowed from finite MPS and MPO owners.

The cache stores one left and one right environment at every bond. Entries are built lazily or with build_all(). Site revisions automatically invalidate the exact directional suffix or prefix that depends on a replacement.

Warning
The referenced owners must outlive the cache, remain at their original addresses, and be mutated only through their replacement members while the cache exists.
Template Parameters
MpsChainConcrete FiniteMps type.
MpoChainConcrete FiniteMpo type.
EnvironmentStorageSparse local storage for cached values.

Member Typedef Documentation

◆ auxiliary_space_type

template<class MpsChain , class MpoChain , SparseBlockStorage EnvironmentStorage = SeparateSparseBlockStorage<>>
using uni20::tensor_network::MpoEnvironmentCache< MpsChain, MpoChain, EnvironmentStorage >::auxiliary_space_type = typename mpo_type::auxiliary_space_type

◆ bond_space_type

template<class MpsChain , class MpoChain , SparseBlockStorage EnvironmentStorage = SeparateSparseBlockStorage<>>
using uni20::tensor_network::MpoEnvironmentCache< MpsChain, MpoChain, EnvironmentStorage >::bond_space_type = typename mps_type::bond_space_type

◆ environment_type

template<class MpsChain , class MpoChain , SparseBlockStorage EnvironmentStorage = SeparateSparseBlockStorage<>>
using uni20::tensor_network::MpoEnvironmentCache< MpsChain, MpoChain, EnvironmentStorage >::environment_type = MpoEnvironment<value_type, bond_space_type, auxiliary_space_type, bond_space_type, EnvironmentStorage>

◆ mpo_block_type

template<class MpsChain , class MpoChain , SparseBlockStorage EnvironmentStorage = SeparateSparseBlockStorage<>>
using uni20::tensor_network::MpoEnvironmentCache< MpsChain, MpoChain, EnvironmentStorage >::mpo_block_type = block_tensor_const_block_t<typename mpo_type::site_type>

◆ mpo_type

template<class MpsChain , class MpoChain , SparseBlockStorage EnvironmentStorage = SeparateSparseBlockStorage<>>
using uni20::tensor_network::MpoEnvironmentCache< MpsChain, MpoChain, EnvironmentStorage >::mpo_type = std::remove_cvref_t<MpoChain>

◆ mps_type

template<class MpsChain , class MpoChain , SparseBlockStorage EnvironmentStorage = SeparateSparseBlockStorage<>>
using uni20::tensor_network::MpoEnvironmentCache< MpsChain, MpoChain, EnvironmentStorage >::mps_type = std::remove_cvref_t<MpsChain>

◆ value_type

template<class MpsChain , class MpoChain , SparseBlockStorage EnvironmentStorage = SeparateSparseBlockStorage<>>
using uni20::tensor_network::MpoEnvironmentCache< MpsChain, MpoChain, EnvironmentStorage >::value_type = typename mps_type::value_type

Constructor & Destructor Documentation

◆ MpoEnvironmentCache()

template<class MpsChain , class MpoChain , SparseBlockStorage EnvironmentStorage = SeparateSparseBlockStorage<>>
uni20::tensor_network::MpoEnvironmentCache< MpsChain, MpoChain, EnvironmentStorage >::MpoEnvironmentCache ( mps_type const &  mps,
mpo_type const &  mpo,
std::size_t  left_auxiliary_index,
std::size_t  right_auxiliary_index 
)
inline

Construct boundary entries and validate the coupled chains.

Parameters
mpsBorrowed finite MPS owner.
mpoBorrowed finite MPO owner of the same length.
left_auxiliary_indexIdentity-charge state at the left MPO boundary.
right_auxiliary_indexIdentity-charge state at the right MPO boundary.
Exceptions
std::invalid_argumentIf chain sizes, symmetries, or physical spaces differ, or either boundary state is invalid.

Member Function Documentation

◆ build_all()

template<class MpsChain , class MpoChain , SparseBlockStorage EnvironmentStorage = SeparateSparseBlockStorage<>>
void uni20::tensor_network::MpoEnvironmentCache< MpsChain, MpoChain, EnvironmentStorage >::build_all ( )
inline

Build every left and right environment entry.

◆ is_attached_to()

template<class MpsChain , class MpoChain , SparseBlockStorage EnvironmentStorage = SeparateSparseBlockStorage<>>
auto uni20::tensor_network::MpoEnvironmentCache< MpsChain, MpoChain, EnvironmentStorage >::is_attached_to ( mps_type const &  mps,
mpo_type const &  mpo 
) const -> bool
inlinenoexcept

Return whether this cache observes the supplied chain objects.

This identity check lets compound algorithms reject a cache constructed for different owners of the same concrete types.

Parameters
mpsCandidate finite MPS owner.
mpoCandidate finite MPO owner.

◆ left_cached()

template<class MpsChain , class MpoChain , SparseBlockStorage EnvironmentStorage = SeparateSparseBlockStorage<>>
auto uni20::tensor_network::MpoEnvironmentCache< MpsChain, MpoChain, EnvironmentStorage >::left_cached ( std::size_t  bond) -> bool
inline

Return whether the left environment at a bond is currently cached.

Parameters
bondBond index in [0, size()].
Exceptions
std::out_of_rangeIf bond is invalid.

◆ left_environment()

template<class MpsChain , class MpoChain , SparseBlockStorage EnvironmentStorage = SeparateSparseBlockStorage<>>
auto uni20::tensor_network::MpoEnvironmentCache< MpsChain, MpoChain, EnvironmentStorage >::left_environment ( std::size_t  bond) -> environment_type const&
inline

Build and return the left environment at one bond.

Bond zero is the left identity boundary. Bond i+1 extends bond i across site i.

Warning
The returned reference is invalidated when a later cache observation detects a replacement on which this entry depends.
Parameters
bondBond index in [0, size()].
Exceptions
std::out_of_rangeIf bond is invalid.

◆ right_cached()

template<class MpsChain , class MpoChain , SparseBlockStorage EnvironmentStorage = SeparateSparseBlockStorage<>>
auto uni20::tensor_network::MpoEnvironmentCache< MpsChain, MpoChain, EnvironmentStorage >::right_cached ( std::size_t  bond) -> bool
inline

Return whether the right environment at a bond is currently cached.

Parameters
bondBond index in [0, size()].
Exceptions
std::out_of_rangeIf bond is invalid.

◆ right_environment()

template<class MpsChain , class MpoChain , SparseBlockStorage EnvironmentStorage = SeparateSparseBlockStorage<>>
auto uni20::tensor_network::MpoEnvironmentCache< MpsChain, MpoChain, EnvironmentStorage >::right_environment ( std::size_t  bond) -> environment_type const&
inline

Build and return the right environment at one bond.

Bond size() is the right identity boundary. Bond i extends bond i+1 across site i from right to left.

Warning
The returned reference is invalidated when a later cache observation detects a replacement on which this entry depends.
Parameters
bondBond index in [0, size()].
Exceptions
std::out_of_rangeIf bond is invalid.

◆ size()

template<class MpsChain , class MpoChain , SparseBlockStorage EnvironmentStorage = SeparateSparseBlockStorage<>>
auto uni20::tensor_network::MpoEnvironmentCache< MpsChain, MpoChain, EnvironmentStorage >::size ( ) const -> std::size_t
inlinenoexcept

Return the number of physical sites.


The documentation for this class was generated from the following file: