pub struct MPS {
pub tensors: Vec<Tensor>,
pub n_sites: usize,
pub phys_dim: usize,
pub max_bond_dim: usize,
}Expand description
Matrix Product State (MPS) representation.
Each tensor at site i has shape [bond_left, phys_dim, bond_right].
At the boundaries: bond_left = 1 at site 0, bond_right = 1 at site n-1.
Fields§
§tensors: Vec<Tensor>Site tensors: tensors[i] has shape [D_l, d, D_r]
n_sites: usizeNumber of sites
phys_dim: usizePhysical dimension (e.g. 2 for a spin-1/2 chain)
max_bond_dim: usizeMaximum allowed bond dimension (for compression)
Implementations§
Source§impl MPS
impl MPS
Sourcepub fn product_state(values: &[usize], phys_dim: usize) -> QcResult<Self>
pub fn product_state(values: &[usize], phys_dim: usize) -> QcResult<Self>
Create an MPS for a computational basis product state |v_1 v_2 … v_n⟩.
Each site tensor has shape [1, phys_dim, 1] with a single non-zero entry.
Sourcepub fn bond_dim_left(&self, site: usize) -> usize
pub fn bond_dim_left(&self, site: usize) -> usize
Left bond dimension at site i (= tensors[i].shape[0])
Sourcepub fn bond_dim_right(&self, site: usize) -> usize
pub fn bond_dim_right(&self, site: usize) -> usize
Right bond dimension at site i (= tensors[i].shape[2])
Trait Implementations§
Auto Trait Implementations§
impl Freeze for MPS
impl RefUnwindSafe for MPS
impl Send for MPS
impl Sync for MPS
impl Unpin for MPS
impl UnsafeUnpin for MPS
impl UnwindSafe for MPS
Blanket Implementations§
Source§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
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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>
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 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>
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 moreSource§impl<T> Pointable for T
impl<T> Pointable for T
Source§impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
Source§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
The inverse inclusion map: attempts to construct
self from the equivalent element of its
superset. Read moreSource§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
Checks if
self is actually part of its subset T (and can be converted to it).Source§fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
Use with care! Same as
self.to_subset but without any property checks. Always succeeds.Source§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
The inclusion map: converts
self to the equivalent element of its superset.