pub struct ContractionTree { /* private fields */ }Expand description
Struct representing the full contraction path of a given Tensor object.
Implementations§
Source§impl ContractionTree
impl ContractionTree
Sourcepub fn node(&self, node_id: usize) -> Ref<'_, Node>
pub fn node(&self, node_id: usize) -> Ref<'_, Node>
Returns a reference to the node with the given node_id.
pub const fn partitions(&self) -> &FxHashMap<usize, Vec<usize>>
Sourcepub fn from_contraction_path(tensor: &Tensor, path: &ContractionPath) -> Self
pub fn from_contraction_path(tensor: &Tensor, path: &ContractionPath) -> Self
Creates a ContractionTree from tensor and contract path. The tree
represents all intermediate tensors and costs of given contraction path and
tensor network.
Sourcepub fn leaf_ids(&self, node_id: usize) -> Vec<usize>
pub fn leaf_ids(&self, node_id: usize) -> Vec<usize>
Returns the id of all leaf nodes in subtree with root at node_id.
Sourcepub fn tree_weights(
&self,
node_id: usize,
tn: &Tensor,
cost_function: fn(&Tensor, &Tensor) -> f64,
) -> FxHashMap<usize, f64>
pub fn tree_weights( &self, node_id: usize, tn: &Tensor, cost_function: fn(&Tensor, &Tensor) -> f64, ) -> FxHashMap<usize, f64>
Returns HashMap storing resultant tensor and its respective contraction costs calculated via cost_function.
§Arguments
node_id- root of Node to start calculating contraction coststn-Tensorobject containing bond dimension and leaf node informationcost_function- cost function returning contraction cost
Sourcepub fn to_flat_contraction_path(
&self,
node_id: usize,
replace: bool,
) -> SimplePath
pub fn to_flat_contraction_path( &self, node_id: usize, replace: bool, ) -> SimplePath
Populates given vector with contractions path of contraction tree starting at node_id.
§Arguments
node- pointer to Node objectreplace- if set totruereturns replace path, otherwise, returns in SSA format
Trait Implementations§
Source§impl Clone for ContractionTree
impl Clone for ContractionTree
Source§fn clone(&self) -> ContractionTree
fn clone(&self) -> ContractionTree
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for ContractionTree
impl Debug for ContractionTree
Source§impl Default for ContractionTree
impl Default for ContractionTree
Source§fn default() -> ContractionTree
fn default() -> ContractionTree
Returns the “default value” for a type. Read more
Auto Trait Implementations§
impl Freeze for ContractionTree
impl !RefUnwindSafe for ContractionTree
impl !Send for ContractionTree
impl !Sync for ContractionTree
impl Unpin for ContractionTree
impl !UnwindSafe for ContractionTree
Blanket Implementations§
§impl<T> AnyExt for T
impl<T> AnyExt for T
§fn downcast_ref<T>(this: &Self) -> Option<&T>where
T: Any,
fn downcast_ref<T>(this: &Self) -> Option<&T>where
T: Any,
Attempts to downcast this to
T behind reference§fn downcast_mut<T>(this: &mut Self) -> Option<&mut T>where
T: Any,
fn downcast_mut<T>(this: &mut Self) -> Option<&mut T>where
T: Any,
Attempts to downcast this to
T behind mutable reference§fn downcast_rc<T>(this: Rc<Self>) -> Result<Rc<T>, Rc<Self>>where
T: Any,
fn downcast_rc<T>(this: Rc<Self>) -> Result<Rc<T>, Rc<Self>>where
T: Any,
Attempts to downcast this to
T behind Rc pointer§fn downcast_arc<T>(this: Arc<Self>) -> Result<Arc<T>, Arc<Self>>where
T: Any,
fn downcast_arc<T>(this: Arc<Self>) -> Result<Arc<T>, Arc<Self>>where
T: Any,
Attempts to downcast this to
T behind Arc pointer§fn downcast_box<T>(this: Box<Self>) -> Result<Box<T>, Box<Self>>where
T: Any,
fn downcast_box<T>(this: Box<Self>) -> Result<Box<T>, Box<Self>>where
T: Any,
Attempts to downcast this to
T behind Box pointer§fn downcast_move<T>(this: Self) -> Option<T>
fn downcast_move<T>(this: Self) -> Option<T>
Attempts to downcast owned
Self to T,
useful only in generic context as a workaround for specialization§impl<Src, Scheme> ApproxFrom<Src, Scheme> for Srcwhere
Scheme: ApproxScheme,
impl<Src, Scheme> ApproxFrom<Src, Scheme> for Srcwhere
Scheme: ApproxScheme,
§fn approx_from(src: Src) -> Result<Src, <Src as ApproxFrom<Src, Scheme>>::Err>
fn approx_from(src: Src) -> Result<Src, <Src as ApproxFrom<Src, Scheme>>::Err>
Convert the given value into an approximately equivalent representation.
§impl<Dst, Src, Scheme> ApproxInto<Dst, Scheme> for Srcwhere
Dst: ApproxFrom<Src, Scheme>,
Scheme: ApproxScheme,
impl<Dst, Src, Scheme> ApproxInto<Dst, Scheme> for Srcwhere
Dst: ApproxFrom<Src, Scheme>,
Scheme: ApproxScheme,
§fn approx_into(self) -> Result<Dst, <Src as ApproxInto<Dst, Scheme>>::Err>
fn approx_into(self) -> Result<Dst, <Src as ApproxInto<Dst, Scheme>>::Err>
Convert the subject into an approximately equivalent representation.
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,
§impl<T, X> CoerceTo<T> for Xwhere
T: CoerceFrom<X> + ?Sized,
impl<T, X> CoerceTo<T> for Xwhere
T: CoerceFrom<X> + ?Sized,
fn coerce_rc_to(self: Rc<X>) -> Rc<T>
fn coerce_box_to(self: Box<X>) -> Box<T>
fn coerce_ref_to(&self) -> &T
fn coerce_mut_to(&mut self) -> &mut T
§impl<T, Dst> ConvAsUtil<Dst> for T
impl<T, Dst> ConvAsUtil<Dst> for T
§impl<T> ConvUtil for T
impl<T> ConvUtil for T
§fn approx_as<Dst>(self) -> Result<Dst, Self::Err>where
Self: Sized + ApproxInto<Dst>,
fn approx_as<Dst>(self) -> Result<Dst, Self::Err>where
Self: Sized + ApproxInto<Dst>,
Approximate the subject to a given type with the default scheme.
§fn approx_as_by<Dst, Scheme>(self) -> Result<Dst, Self::Err>where
Self: Sized + ApproxInto<Dst, Scheme>,
Scheme: ApproxScheme,
fn approx_as_by<Dst, Scheme>(self) -> Result<Dst, Self::Err>where
Self: Sized + ApproxInto<Dst, Scheme>,
Scheme: ApproxScheme,
Approximate the subject to a given type with a specific scheme.
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 more§impl<T> Pointable for T
impl<T> Pointable for T
§impl<Src> TryFrom<Src> for Src
impl<Src> TryFrom<Src> for Src
§impl<Src, Dst> TryInto<Dst> for Srcwhere
Dst: TryFrom<Src>,
impl<Src, Dst> TryInto<Dst> for Srcwhere
Dst: TryFrom<Src>,
§impl<Src> ValueFrom<Src> for Src
impl<Src> ValueFrom<Src> for Src
§fn value_from(src: Src) -> Result<Src, <Src as ValueFrom<Src>>::Err>
fn value_from(src: Src) -> Result<Src, <Src as ValueFrom<Src>>::Err>
Convert the given value into an exactly equivalent representation.