pub struct CVGateSequence {
pub gates: Vec<(CVGateType, CVGateParams)>,
pub num_modes: usize,
}Expand description
Sequence of CV gates forming a quantum program
Fields§
§gates: Vec<(CVGateType, CVGateParams)>Gates in the sequence
num_modes: usizeTotal number of modes required
Implementations§
Source§impl CVGateSequence
impl CVGateSequence
Sourcepub fn displacement(
&mut self,
mode: usize,
amplitude: Complex,
) -> DeviceResult<()>
pub fn displacement( &mut self, mode: usize, amplitude: Complex, ) -> DeviceResult<()>
Add a displacement gate
Sourcepub fn squeezing(
&mut self,
mode: usize,
parameter: f64,
phase: f64,
) -> DeviceResult<()>
pub fn squeezing( &mut self, mode: usize, parameter: f64, phase: f64, ) -> DeviceResult<()>
Add a squeezing gate
Sourcepub fn two_mode_squeezing(
&mut self,
mode1: usize,
mode2: usize,
parameter: f64,
phase: f64,
) -> DeviceResult<()>
pub fn two_mode_squeezing( &mut self, mode1: usize, mode2: usize, parameter: f64, phase: f64, ) -> DeviceResult<()>
Add a two-mode squeezing gate
Sourcepub fn beamsplitter(
&mut self,
mode1: usize,
mode2: usize,
transmittance: f64,
phase: f64,
) -> DeviceResult<()>
pub fn beamsplitter( &mut self, mode1: usize, mode2: usize, transmittance: f64, phase: f64, ) -> DeviceResult<()>
Add a beamsplitter gate
Sourcepub fn phase_rotation(&mut self, mode: usize, phase: f64) -> DeviceResult<()>
pub fn phase_rotation(&mut self, mode: usize, phase: f64) -> DeviceResult<()>
Add a phase rotation gate
Sourcepub fn controlled_displacement(
&mut self,
control_mode: usize,
target_mode: usize,
amplitude: Complex,
) -> DeviceResult<()>
pub fn controlled_displacement( &mut self, control_mode: usize, target_mode: usize, amplitude: Complex, ) -> DeviceResult<()>
Add a controlled displacement gate
Sourcepub fn controlled_phase(
&mut self,
control_mode: usize,
target_mode: usize,
parameter: f64,
) -> DeviceResult<()>
pub fn controlled_phase( &mut self, control_mode: usize, target_mode: usize, parameter: f64, ) -> DeviceResult<()>
Add a controlled phase gate
Sourcepub fn cross_kerr(
&mut self,
mode1: usize,
mode2: usize,
parameter: f64,
) -> DeviceResult<()>
pub fn cross_kerr( &mut self, mode1: usize, mode2: usize, parameter: f64, ) -> DeviceResult<()>
Add a cross-Kerr gate
Sourcepub fn cubic_phase(&mut self, mode: usize, parameter: f64) -> DeviceResult<()>
pub fn cubic_phase(&mut self, mode: usize, parameter: f64) -> DeviceResult<()>
Add a cubic phase gate (non-Gaussian)
Sourcepub fn gate_count(&self) -> usize
pub fn gate_count(&self) -> usize
Get the number of gates in the sequence
Sourcepub fn depth(&self) -> usize
pub fn depth(&self) -> usize
Get the depth of the sequence (maximum number of gates on any mode)
Sourcepub fn is_gaussian(&self) -> bool
pub fn is_gaussian(&self) -> bool
Check if the sequence contains only Gaussian operations
Sourcepub fn execute_on_state(&self, state: &mut GaussianState) -> DeviceResult<()>
pub fn execute_on_state(&self, state: &mut GaussianState) -> DeviceResult<()>
Execute the gate sequence on a Gaussian state
Trait Implementations§
Source§impl Clone for CVGateSequence
impl Clone for CVGateSequence
Source§fn clone(&self) -> CVGateSequence
fn clone(&self) -> CVGateSequence
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 CVGateSequence
impl Debug for CVGateSequence
Source§impl<'de> Deserialize<'de> for CVGateSequence
impl<'de> Deserialize<'de> for CVGateSequence
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Auto Trait Implementations§
impl Freeze for CVGateSequence
impl RefUnwindSafe for CVGateSequence
impl Send for CVGateSequence
impl Sync for CVGateSequence
impl Unpin for CVGateSequence
impl UnwindSafe for CVGateSequence
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> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
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 moreSource§impl<T> Pointable for T
impl<T> Pointable for T
Source§impl<T> PolicyExt for Twhere
T: ?Sized,
impl<T> PolicyExt for Twhere
T: ?Sized,
Source§impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
Source§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
The inverse inclusion map: attempts to construct
self from the equivalent element of its
superset. Read moreSource§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
Checks if
self is actually part of its subset T (and can be converted to it).Source§fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
Use with care! Same as
self.to_subset but without any property checks. Always succeeds.Source§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
The inclusion map: converts
self to the equivalent element of its superset.Source§impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
Source§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
The inverse inclusion map: attempts to construct
self from the equivalent element of its
superset. Read moreSource§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
Checks if
self is actually part of its subset T (and can be converted to it).Source§fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
Use with care! Same as
self.to_subset but without any property checks. Always succeeds.Source§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
The inclusion map: converts
self to the equivalent element of its superset.