pub trait OperateSingleQubitGate: Operate + OperateGate + InvolveQubits + Substitute + OperateSingleQubit + Clone + PartialEq + SupportedVersion + Debug {
    // Required methods
    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;

    // Provided methods
    fn mul<T>(&self, other: &T) -> Result<SingleQubitGate, RoqoqoError>
       where T: OperateSingleQubitGate { ... }
    fn to_single_qubit_gate(&self) -> SingleQubitGate { ... }
}
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 =exp(i * φ) * [[Re(α)+i * Im(α), -Re(β) + i * Im(β)], [Re(β) + i * Im(β) , Re(α) - i * Im(α) ]].

These gates can be parametrized by five real parameters:

  • alpha_r - The real part Re(α) of the on-diagonal elements of the single-qubit unitary.
  • alpha_i - The imaginary part Im(α) of the on-diagonal elements of the single-qubit unitary.
  • beta_r - The real part Re(β) of the off-diagonal elements of the single-qubit unitary.
  • beta_i - The imaginary part Im(β) of the off-diagonal elements of the single-qubit unitary.
  • global_phase - The global phase φ 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§

source

fn alpha_r(&self) -> CalculatorFloat

Returns alpha_r parameter of operation.

§Returns
  • alpha_r - The real part Re(α) of the on-diagonal elements of the single-qubit unitary matrix.
source

fn alpha_i(&self) -> CalculatorFloat

Returns alpha_i parameter of operation.

§Returns
  • alpha_i - The imaginary part Im(α) of the on-diagonal elements of the single-qubit unitary matrix.
source

fn beta_r(&self) -> CalculatorFloat

Returns beta_r parameter of operation.

§Returns
  • beta_r - The real part Re(β) of the off-diagonal elements of the single-qubit unitary matrix.
source

fn beta_i(&self) -> CalculatorFloat

Returns beta_i parameter of operation.

§Returns
  • beta_i - imaginary part Im(β) of the off-diagonal elements of the single-qubit unitary matrix.
source

fn global_phase(&self) -> CalculatorFloat

Returns global_phase parameter of operation.

§Returns
  • global_phase - The global phase phi φ of the single-qubit unitary.

Provided Methods§

source

fn mul<T>(&self, other: &T) -> Result<SingleQubitGate, RoqoqoError>

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();
source

fn to_single_qubit_gate(&self) -> SingleQubitGate

Returns equivalent SingleQubitGate.

Converts Operation implementing OperateSingleQubitGate Trait into SingleQubitGate.

Object Safety§

This trait is not object safe.

Implementors§

source§

impl OperateSingleQubitGate for SingleQubitGateOperation

source§

impl OperateSingleQubitGate for GPi2

Trait for unitary operations acting on exactly one qubit.

source§

impl OperateSingleQubitGate for GPi

Trait for unitary operations acting on exactly one qubit.

source§

impl OperateSingleQubitGate for Hadamard

Trait for unitary operations acting on exactly one qubit.

source§

impl OperateSingleQubitGate for Identity

Trait for unitary operations acting on exactly one qubit.

source§

impl OperateSingleQubitGate for InvSqrtPauliX

Trait for unitary operations acting on exactly one qubit.

source§

impl OperateSingleQubitGate for PauliX

Trait for unitary operations acting on exactly one qubit.

source§

impl OperateSingleQubitGate for PauliY

Trait for unitary operations acting on exactly one qubit.

source§

impl OperateSingleQubitGate for PauliZ

Trait for unitary operations acting on exactly one qubit.

source§

impl OperateSingleQubitGate for PhaseShiftState0

Trait for unitary operations acting on exactly one qubit.

source§

impl OperateSingleQubitGate for PhaseShiftState1

Trait for unitary operations acting on exactly one qubit.

source§

impl OperateSingleQubitGate for RotateAroundSphericalAxis

Trait for unitary operations acting on exactly one qubit.

source§

impl OperateSingleQubitGate for RotateX

Trait for unitary operations acting on exactly one qubit.

source§

impl OperateSingleQubitGate for RotateXY

Trait for unitary operations acting on exactly one qubit.

source§

impl OperateSingleQubitGate for RotateY

Trait for unitary operations acting on exactly one qubit.

source§

impl OperateSingleQubitGate for RotateZ

Trait for unitary operations acting on exactly one qubit.

source§

impl OperateSingleQubitGate for SGate

Trait for unitary operations acting on exactly one qubit.

source§

impl OperateSingleQubitGate for SingleQubitGate

Trait for unitary operations acting on exactly one qubit.

source§

impl OperateSingleQubitGate for SqrtPauliX

Trait for unitary operations acting on exactly one qubit.

source§

impl OperateSingleQubitGate for TGate

Trait for unitary operations acting on exactly one qubit.