pub struct TensorNetwork { /* private fields */ }Expand description
Tensor network for contraction operations
Implementations§
Source§impl TensorNetwork
impl TensorNetwork
Sourcepub fn add_node(
&mut self,
data: Vec<f64>,
leg_dims: Vec<usize>,
leg_labels: Vec<String>,
) -> usize
pub fn add_node( &mut self, data: Vec<f64>, leg_dims: Vec<usize>, leg_labels: Vec<String>, ) -> usize
Add a tensor node
Sourcepub fn get_node(&self, id: usize) -> Option<&TensorNode>
pub fn get_node(&self, id: usize) -> Option<&TensorNode>
Get node by ID
Sourcepub fn contract(&mut self, id1: usize, id2: usize) -> Option<usize>
pub fn contract(&mut self, id1: usize, id2: usize) -> Option<usize>
Contract two nodes on matching labels
Sourcepub fn contract_all(&mut self) -> Option<f64>
pub fn contract_all(&mut self) -> Option<f64>
Contract entire network to scalar (if possible)
Trait Implementations§
Source§impl Clone for TensorNetwork
impl Clone for TensorNetwork
Source§fn clone(&self) -> TensorNetwork
fn clone(&self) -> TensorNetwork
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 TensorNetwork
impl Debug for TensorNetwork
Auto Trait Implementations§
impl Freeze for TensorNetwork
impl RefUnwindSafe for TensorNetwork
impl Send for TensorNetwork
impl Sync for TensorNetwork
impl Unpin for TensorNetwork
impl UnwindSafe for TensorNetwork
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