[][src]Struct dqcsim::common::types::Gate

pub struct Gate {
    pub data: ArbData,
    // some fields omitted
}

Represents a type of quantum or mixed quantum-classical gate.

Fields

data: ArbData

User-defined classical data to pass along with the gate.

Implementations

impl Gate[src]

pub fn new_unitary(
    targets: impl IntoIterator<Item = QubitRef>,
    controls: impl IntoIterator<Item = QubitRef>,
    matrix: impl IntoIterator<Item = Complex64>
) -> Result<Gate>
[src]

Constructs a new unitary gate.

pub fn new_measurement(
    qubits: impl IntoIterator<Item = QubitRef>,
    basis: impl IntoIterator<Item = Complex64>
) -> Result<Gate>
[src]

Constructs a new measurement gate.

pub fn new_prep(
    qubits: impl IntoIterator<Item = QubitRef>,
    matrix: impl IntoIterator<Item = Complex64>
) -> Result<Gate>
[src]

Constructs a new prep gate.

pub fn new_custom(
    name: impl Into<String>,
    targets: impl IntoIterator<Item = QubitRef>,
    controls: impl IntoIterator<Item = QubitRef>,
    measures: impl IntoIterator<Item = QubitRef>,
    matrix: Option<impl IntoIterator<Item = Complex64>>,
    data: impl Into<ArbData>
) -> Result<Gate>
[src]

Constructs a new implementation-defined gate.

pub fn get_type(&self) -> &GateType[src]

Returns the gate type.

pub fn get_name(&self) -> Option<&str>[src]

Returns the name of the gate, if any.

pub fn get_targets(&self) -> &[QubitRef][src]

Returns the list of target qubits.

pub fn get_controls(&self) -> &[QubitRef][src]

Returns the list of control qubits.

pub fn get_measures(&self) -> &[QubitRef][src]

Returns the list of measured qubits.

pub fn get_matrix(&self) -> Option<&Matrix>[src]

Returns the gate matrix.

pub fn with_matrix_controls(&self) -> Self[src]

Returns a new Gate with its controls moved to the matrix.

pub fn with_gate_controls(
    &self,
    epsilon: f64,
    ignore_global_phase: bool
) -> Self
[src]

Returns a new Gate with controls encoded in the matrix moved to the Gate controls field. Forwards the epsilon and ignore_global_phase args to the Matrix::strip_control method.

pub fn without_qubit_refs(&self) -> Self[src]

Replaces all qubit references in the gate with undefined qubits. This is used as a gate detector cache preprocessing step when the detector functions do not depend on which qubits are bound to the gate, only the amount of each kind,

Trait Implementations

impl Clone for Gate[src]

impl Debug for Gate[src]

impl<'de> Deserialize<'de> for Gate[src]

impl Eq for Gate[src]

impl<'_, '_> From<BoundUnitaryGate<'_, '_>> for Gate[src]

impl Hash for Gate[src]

impl PartialEq<Gate> for Gate[src]

impl Serialize for Gate[src]

impl StructuralEq for Gate[src]

impl StructuralPartialEq for Gate[src]

Auto Trait Implementations

impl RefUnwindSafe for Gate

impl Send for Gate

impl Sync for Gate

impl Unpin for Gate

impl UnwindSafe for Gate

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> DeserializeOwned for T where
    T: for<'de> Deserialize<'de>, 
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

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

The type returned in the event of a conversion error.

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