pub struct QuditCircuitTensorNetworkBuilder { /* private fields */ }Implementations§
Source§impl QuditCircuitTensorNetworkBuilder
impl QuditCircuitTensorNetworkBuilder
pub fn new( radices: Radices, expressions: Option<Arc<Mutex<ExpressionCache>>>, ) -> Self
Sourcepub fn open_output_indices(&self) -> Vec<usize>
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.
Sourcepub fn open_input_indices(&self) -> Vec<usize>
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.
pub fn num_open_output_indices(&self) -> usize
pub fn num_open_input_indices(&self) -> usize
pub fn expression_get(&mut self, expression: TensorExpression) -> ExpressionId
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
Sourcepub fn prepend(
self,
tensor: QuditTensor,
input_index_map: Vec<usize>,
output_index_map: Vec<usize>,
batch_index_map: Vec<String>,
) -> Self
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_idimplies thattensor.input_indices()[i]will be connected to thefront[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_idimplies thattensor.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_idsreferenced 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.
pub fn prepend_unitary<C: ComplexScalar>( self, utry: UnitaryMatrix<C>, qudits: Vec<usize>, ) -> Self
pub fn trace_wire(self, front_qudit: usize, rear_qudit: usize) -> Self
pub fn trace_all_open_wires(self) -> Self
pub fn build(self) -> QuditTensorNetwork
Auto Trait Implementations§
impl Freeze for QuditCircuitTensorNetworkBuilder
impl RefUnwindSafe for QuditCircuitTensorNetworkBuilder
impl Send for QuditCircuitTensorNetworkBuilder
impl Sync for QuditCircuitTensorNetworkBuilder
impl Unpin for QuditCircuitTensorNetworkBuilder
impl UnwindSafe for QuditCircuitTensorNetworkBuilder
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
Source§impl<T> DistributionExt for Twhere
T: ?Sized,
impl<T> DistributionExt for Twhere
T: ?Sized,
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>
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>
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