pub trait OperateSingleQubitGate: Operate + OperateGate + InvolveQubits + Substitute + OperateSingleQubit + Clone + PartialEq + OperateSingleQubit + Debug {
    fn alpha_r(&self) -> CalculatorFloat;
fn alpha_i(&self) -> CalculatorFloat;
fn beta_r(&self) -> CalculatorFloat;
fn beta_i(&self) -> CalculatorFloat;
fn global_phase(&self) -> CalculatorFloat; fn mul<T>(&self, other: &T) -> Result<SingleQubitGate, RoqoqoError>
    where
        T: OperateSingleQubitGate
, { ... } }
Expand description

Trait for unitary operations acting on exactly one qubit.

Implements the general single qubit unitary gates that can be brought into the form:

$$ U =e^{i \phi}\begin{pmatrix} \alpha_r+i \alpha_i & -\beta_r+i \beta_i \\ \beta_r+i \beta_i & \alpha_r-i\alpha_i \end{pmatrix} $$

These gates can be parametrized by five real parameters:

  • alpha_r - The real part $ \alpha_r $ of the on-diagonal elements of the single-qubit unitary.
  • alpha_i - The imaginary part $ \alpha_i $ of the on-diagonal elements of the single-qubit unitary.
  • beta_r - The real part $ \beta_r $ of the off-diagonal elements of the single-qubit unitary.
  • beta_i - The imaginary part $ \beta_i $ of the off-diagonal elements of the single-qubit unitary.
  • global_phase - The global phase $ \phi $ of the single-qubit unitary.

These are the single qubit gates that are performed in the Circuit(), and are then translated to quantum hardware through the relevant backend. Two-qubit gates are also available (see roqoqo/src/operations/two_qubit_gate_operations.rs).

Example

use qoqo_calculator::CalculatorFloat;
use roqoqo::operations::{OperateSingleQubitGate, PauliX};
use std::f64::consts::PI;

let paulix = PauliX::new(0);

assert_eq!(paulix.alpha_r(), 0.0.into());
assert_eq!(paulix.alpha_i(), 0.0.into());
assert_eq!(paulix.beta_r(), 0.0.into());
assert_eq!(paulix.beta_i(), CalculatorFloat::from(-1.0));
assert_eq!(paulix.global_phase(), ((PI) / 2.0).into());

Required methods

Returns alpha_r parameter of operation.

Returns
  • alpha_r - The real part $\alpha_r$ of the on-diagonal elements of the single-qubit unitary matrix.

Returns alpha_i parameter of operation.

Returns
  • alpha_i - The imaginary part $ \alpha_i $ of the on-diagonal elements of the single-qubit unitary matrix.

Returns beta_r parameter of operation.

Returns
  • beta_r - The real part $ \beta_r $ of the off-diagonal elements of the single-qubit unitary matrix.

Returns beta_i parameter of operation.

Returns
  • beta_i - imaginary part $ \beta_i $ of the off-diagonal elements of the single-qubit unitary matrix.

Returns global_phase parameter of operation.

Returns
  • global_phase - The global phase phi $ \phi $ of the single-qubit unitary.

Provided methods

Multiplies two compatible operations implementing OperateSingleQubitGate.

Does not consume the two operations being multiplied. Only Operations

Arguments:
Example
use roqoqo::operations::{RotateZ, RotateX};
use roqoqo::prelude::*;
use qoqo_calculator::CalculatorFloat;

let gate1 =  RotateZ::new(0, CalculatorFloat::from(1));
let gate2 =  RotateX::new(0, CalculatorFloat::from(1));
let multiplied = gate1.mul(&gate2).unwrap();

Implementors

Trait for unitary operations acting on exactly one qubit.

Trait for unitary operations acting on exactly one qubit.

Trait for unitary operations acting on exactly one qubit.

Trait for unitary operations acting on exactly one qubit.

Trait for unitary operations acting on exactly one qubit.

Trait for unitary operations acting on exactly one qubit.

Trait for unitary operations acting on exactly one qubit.

Trait for unitary operations acting on exactly one qubit.

Trait for unitary operations acting on exactly one qubit.

Trait for unitary operations acting on exactly one qubit.

Trait for unitary operations acting on exactly one qubit.

Trait for unitary operations acting on exactly one qubit.

Trait for unitary operations acting on exactly one qubit.

Trait for unitary operations acting on exactly one qubit.

Trait for unitary operations acting on exactly one qubit.