pub enum MatrixOp<P> {
Matrix(Vec<usize>, Vec<P>),
SparseMatrix(Vec<usize>, Vec<Vec<(usize, P)>>),
Swap(Vec<usize>, Vec<usize>),
Control(Vec<usize>, Vec<usize>, Box<MatrixOp<P>>),
}Expand description
Ops which can be applied to quantum states.
Variants§
Matrix(Vec<usize>, Vec<P>)
Indices, Matrix data
SparseMatrix(Vec<usize>, Vec<Vec<(usize, P)>>)
Indices, per row [(col, value)]
Swap(Vec<usize>, Vec<usize>)
A indices, B indices
Control(Vec<usize>, Vec<usize>, Box<MatrixOp<P>>)
Control indices, Op indices, Op
Implementations§
Source§impl<P> MatrixOp<P>
impl<P> MatrixOp<P>
Sourcepub fn num_indices(&self) -> usize
pub fn num_indices(&self) -> usize
Get the number of indices represented by op
Sourcepub fn new_matrix<Indx, Dat>(indices: Indx, data: Dat) -> Self
pub fn new_matrix<Indx, Dat>(indices: Indx, data: Dat) -> Self
Make a new dense matrix op
Sourcepub fn new_sparse<Indx, Dat>(indices: Indx, data: Dat) -> Self
pub fn new_sparse<Indx, Dat>(indices: Indx, data: Dat) -> Self
Make a new sparse matrix op
Trait Implementations§
Auto Trait Implementations§
impl<P> Freeze for MatrixOp<P>
impl<P> RefUnwindSafe for MatrixOp<P>where
P: RefUnwindSafe,
impl<P> Send for MatrixOp<P>where
P: Send,
impl<P> Sync for MatrixOp<P>where
P: Sync,
impl<P> Unpin for MatrixOp<P>where
P: Unpin,
impl<P> UnwindSafe for MatrixOp<P>where
P: UnwindSafe,
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 more