QuditCircuitTensorNetworkBuilder

Struct QuditCircuitTensorNetworkBuilder 

Source
pub struct QuditCircuitTensorNetworkBuilder { /* private fields */ }

Implementations§

Source§

impl QuditCircuitTensorNetworkBuilder

Source

pub fn new( radices: Radices, expressions: Option<Arc<Mutex<ExpressionCache>>>, ) -> Self

Source

pub fn open_output_indices(&self) -> Vec<usize>

Output indices stick out from the front of the Circuit Tensor Network.

These correspond to wires exiting a circuit in a normal circuit diagram.

Source

pub fn open_input_indices(&self) -> Vec<usize>

Input indices stick out from the rear of the Circuit Tensor Network.

These correspond to wires entering a circuit in a normal circuit diagram.

Source

pub fn num_open_output_indices(&self) -> usize

Source

pub fn num_open_input_indices(&self) -> usize

Source

pub fn expression_get(&mut self, expression: TensorExpression) -> ExpressionId

Source

pub fn prepend_expression( self, expression: TensorExpression, param_info: ParamInfo, input_index_map: Vec<usize>, output_index_map: Vec<usize>, batch_index_map: Vec<String>, ) -> Self

Source

pub fn prepend( self, tensor: QuditTensor, input_index_map: Vec<usize>, output_index_map: Vec<usize>, batch_index_map: Vec<String>, ) -> Self

Prepend a tensor onto the circuit network.

§Arguments
  • tensor - The tensor to prepend

  • input_qudit_map - An array of qudit ids. It maps the tensors input indices to the qudits at the front of the network that will be connected. input_qudit_map[i] == qudit_id implies that tensor.input_indices()[i] will be connected to the front[qudit_id] edge.

  • output_qudit_map - An array of qudit ids. It maps the tensors output indices to the qudits at the front of the network which will become the new open edges for the network front. output_qudit_map[i] == qudit_id implies that tensor.output_tensor_indices()[i] will be the open edge on qudit_id after the operation.

  • batch_index_map - An array of strings. It provides names for the tensors batch indices. All batch indices in the network with the same name identify the same network indices. These indices can appear on both sides of a pairwise contraction without being contracted over.

§Panics
  • If the length of an index map doesn’t match the number of indices the tensor has in that direction.

  • If any of the qudit_ids referenced by the index maps are invalid or out of bounds.

  • If the size of a tensor’s index doesn’t match the radix of the qudit it’s mapped to.

  • If a batch index with the same name exists in the network, they must have the same dimension.

Source

pub fn prepend_unitary<C: ComplexScalar>( self, utry: UnitaryMatrix<C>, qudits: Vec<usize>, ) -> Self

Source

pub fn trace_wire(self, front_qudit: usize, rear_qudit: usize) -> Self

Source

pub fn trace_all_open_wires(self) -> Self

Source

pub fn build(self) -> QuditTensorNetwork

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> ByRef<T> for T

Source§

fn by_ref(&self) -> &T

Source§

impl<T> DistributionExt for T
where T: ?Sized,

Source§

fn rand<T>(&self, rng: &mut (impl Rng + ?Sized)) -> T
where Self: Distribution<T>,

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

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
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V