Struct qoqo::operations::HadamardWrapper
source · pub struct HadamardWrapper {
pub internal: Hadamard,
}
Expand description
The Hadamard gate.
.. math:: U = \frac{1}{\sqrt{2}} \begin{pmatrix} 1 & 1 \\ 1 & -1 \end{pmatrix}
Args: qubit (int): The qubit the unitary gate is applied to.
Fields§
§internal: Hadamard
Internal storage of Hadamard object
Implementations§
source§impl HadamardWrapper
impl HadamardWrapper
sourcepub fn global_phase(&self) -> CalculatorFloatWrapper
pub fn global_phase(&self) -> CalculatorFloatWrapper
Return the global phase :math:g
of a unitary gate acting on one qubit
Here global_phase is defined by
.. math:: U =e^{i \cdot g}\begin{pmatrix} \alpha_r+i \alpha_i & -\beta_r+i \beta_i \\ \beta_r+i \beta_i & \alpha_r-i\alpha_i \end{pmatrix}
Returns: CalculatorFloat
sourcepub fn alpha_r(&self) -> CalculatorFloatWrapper
pub fn alpha_r(&self) -> CalculatorFloatWrapper
Return the property alpha_r :math:\alpha_r
of a unitary gate acting on one qubit
Here alpha_r is defined by
.. math:: U =e^{i \cdot g}\begin{pmatrix} \alpha_r+i \alpha_i & -\beta_r+i \beta_i \\ \beta_r+i \beta_i & \alpha_r-i\alpha_i \end{pmatrix}
Returns: CalculatorFloat
sourcepub fn alpha_i(&self) -> CalculatorFloatWrapper
pub fn alpha_i(&self) -> CalculatorFloatWrapper
Return the property alpha_i :math:\alpha_i
of a unitary gate acting on one qubit
.. math:: U =e^{i \cdot g}\begin{pmatrix} \alpha_r+i \alpha_i & -\beta_r+i \beta_i \\ \beta_r+i \beta_i & \alpha_r-i\alpha_i \end{pmatrix}
Returns: CalculatorFloat
sourcepub fn beta_r(&self) -> CalculatorFloatWrapper
pub fn beta_r(&self) -> CalculatorFloatWrapper
Return the property beta_r :math:\beta_r
of a unitary gate acting on one qubit
Here beta_r is defined by
.. math:: U =e^{i \cdot g}\begin{pmatrix} \alpha_r+i \alpha_i & -\beta_r+i \beta_i \\ \beta_r+i \beta_i & \alpha_r-i\alpha_i \end{pmatrix}
Returns: CalculatorFloat
sourcepub fn beta_i(&self) -> CalculatorFloatWrapper
pub fn beta_i(&self) -> CalculatorFloatWrapper
Returns the property beta_i :math:\beta_i
of a unitary gate acting on one qubit
Here beta_i is defined by
.. math:: U =e^{i \cdot g}\begin{pmatrix} \alpha_r+i \alpha_i & -\beta_r+i \beta_i \\ \beta_r+i \beta_i & \alpha_r-i\alpha_i \end{pmatrix}
Returns: CalculatorFloat
sourcepub fn mul(&self, other: &Bound<'_, PyAny>) -> PyResult<SingleQubitGateWrapper>
pub fn mul(&self, other: &Bound<'_, PyAny>) -> PyResult<SingleQubitGateWrapper>
Multiplies two compatible operations implementing OperateSingleQubitGate.
Does not consume the two operations being multiplied. Only Operations
Args:
other
- An Operation implementing OperateSingleQubitGate.
Returns: PyResult: Result of the multiplication, i.e. the multiplied single qubit gate.
Example:
from qoqo.operations import RotateZ, RotateX
gate1 = RotateZ(qubit=0, theta=1)
gate2 = RotateX(qubit=0, theta=1)
multiplied = gate1.mul(gate2)
print("Multiplied gate: ", multiplied)
Trait Implementations§
source§impl Clone for HadamardWrapper
impl Clone for HadamardWrapper
source§fn clone(&self) -> HadamardWrapper
fn clone(&self) -> HadamardWrapper
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moresource§impl Debug for HadamardWrapper
impl Debug for HadamardWrapper
source§impl HasPyGilRef for HadamardWrapper
impl HasPyGilRef for HadamardWrapper
§type AsRefTarget = PyCell<HadamardWrapper>
type AsRefTarget = PyCell<HadamardWrapper>
source§impl PartialEq for HadamardWrapper
impl PartialEq for HadamardWrapper
source§fn eq(&self, other: &HadamardWrapper) -> bool
fn eq(&self, other: &HadamardWrapper) -> bool
self
and other
values to be equal, and is used
by ==
.source§impl PyClassImpl for HadamardWrapper
impl PyClassImpl for HadamardWrapper
source§const IS_BASETYPE: bool = false
const IS_BASETYPE: bool = false
source§const IS_SUBCLASS: bool = false
const IS_SUBCLASS: bool = false
source§const IS_MAPPING: bool = false
const IS_MAPPING: bool = false
source§const IS_SEQUENCE: bool = false
const IS_SEQUENCE: bool = false
§type ThreadChecker = SendablePyClass<HadamardWrapper>
type ThreadChecker = SendablePyClass<HadamardWrapper>
type Inventory = Pyo3MethodsInventoryForHadamardWrapper
§type PyClassMutability = <<PyAny as PyClassBaseType>::PyClassMutability as PyClassMutability>::MutableChild
type PyClassMutability = <<PyAny as PyClassBaseType>::PyClassMutability as PyClassMutability>::MutableChild
§type BaseNativeType = PyAny
type BaseNativeType = PyAny
PyAny
by default, and when you declare
#[pyclass(extends=PyDict)]
, it’s PyDict
.fn items_iter() -> PyClassItemsIter
fn lazy_type_object() -> &'static LazyTypeObject<Self>
fn dict_offset() -> Option<isize>
fn weaklist_offset() -> Option<isize>
source§impl PyClassNewTextSignature<HadamardWrapper> for PyClassImplCollector<HadamardWrapper>
impl PyClassNewTextSignature<HadamardWrapper> for PyClassImplCollector<HadamardWrapper>
fn new_text_signature(self) -> Option<&'static str>
source§impl<'a, 'py> PyFunctionArgument<'a, 'py> for &'a HadamardWrapper
impl<'a, 'py> PyFunctionArgument<'a, 'py> for &'a HadamardWrapper
source§impl<'a, 'py> PyFunctionArgument<'a, 'py> for &'a mut HadamardWrapper
impl<'a, 'py> PyFunctionArgument<'a, 'py> for &'a mut HadamardWrapper
source§impl PyTypeInfo for HadamardWrapper
impl PyTypeInfo for HadamardWrapper
source§fn type_object_raw(py: Python<'_>) -> *mut PyTypeObject
fn type_object_raw(py: Python<'_>) -> *mut PyTypeObject
source§fn type_object(py: Python<'_>) -> &PyType
fn type_object(py: Python<'_>) -> &PyType
PyTypeInfo::type_object
will be replaced by PyTypeInfo::type_object_bound
in a future PyO3 versionsource§fn type_object_bound(py: Python<'_>) -> Bound<'_, PyType>
fn type_object_bound(py: Python<'_>) -> Bound<'_, PyType>
source§fn is_type_of(object: &PyAny) -> bool
fn is_type_of(object: &PyAny) -> bool
PyTypeInfo::is_type_of
will be replaced by PyTypeInfo::is_type_of_bound
in a future PyO3 versionobject
is an instance of this type or a subclass of this type.source§fn is_type_of_bound(object: &Bound<'_, PyAny>) -> bool
fn is_type_of_bound(object: &Bound<'_, PyAny>) -> bool
object
is an instance of this type or a subclass of this type.source§fn is_exact_type_of(object: &PyAny) -> bool
fn is_exact_type_of(object: &PyAny) -> bool
PyTypeInfo::is_exact_type_of
will be replaced by PyTypeInfo::is_exact_type_of_bound
in a future PyO3 versionobject
is an instance of this type.impl DerefToPyAny for HadamardWrapper
impl Eq for HadamardWrapper
impl StructuralPartialEq for HadamardWrapper
Auto Trait Implementations§
impl Freeze for HadamardWrapper
impl RefUnwindSafe for HadamardWrapper
impl Send for HadamardWrapper
impl Sync for HadamardWrapper
impl Unpin for HadamardWrapper
impl UnwindSafe for HadamardWrapper
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<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key
and return true
if they are equal.source§impl<T> FromPyObject<'_> for T
impl<T> FromPyObject<'_> for T
source§impl<'py, T> FromPyObjectBound<'_, 'py> for Twhere
T: FromPyObject<'py>,
impl<'py, T> FromPyObjectBound<'_, 'py> for Twhere
T: FromPyObject<'py>,
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 moresource§impl<T> PyErrArguments for T
impl<T> PyErrArguments for T
source§impl<T> PyTypeCheck for Twhere
T: PyTypeInfo,
impl<T> PyTypeCheck for Twhere
T: PyTypeInfo,
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>
self
from the equivalent element of its
superset. Read moresource§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
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
self.to_subset
but without any property checks. Always succeeds.source§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
self
to the equivalent element of its superset.