Skip to content

Commit

Permalink
Add store, load and CZ operations for qubit and resonator (#544)
Browse files Browse the repository at this point in the history
* Add laod store cz operations

* fix import and typos

* Apply suggestions from code review

Co-authored-by: kbarkhqs <[email protected]>

* Some changes from review

* changes from review

---------

Co-authored-by: kbarkhqs <[email protected]>
  • Loading branch information
rreiner-hqs and kbarkhqs authored Feb 5, 2024
1 parent a2766c1 commit e6b07d4
Show file tree
Hide file tree
Showing 6 changed files with 734 additions and 35 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,9 @@ use test_roqoqo_1_9;
// #[test_case(test_roqoqo_1_9::operations::QuantumRabi::new(0, 1, 0.1.into()).into(); "QuantumRabi")]
// #[test_case(test_roqoqo_1_9::operations::LongitudinalCoupling::new(0, 1, 0.1.into()).into(); "LongitudinalCoupling")]
// #[test_case(test_roqoqo_1_9::operations::JaynesCummings::new(0, 1, 0.1.into()).into(); "JaynesCummings")]
// #[test_case(test_roqoqo_1_9::operations::SingleExcitationLoad::new(0, 1).into(); "SingleExcitationLoad")]
// #[test_case(test_roqoqo_1_9::operations::SingleExcitationStore::new(0, 1).into(); "SingleExcitationStore")]
// #[test_case(test_roqoqo_1_9::operations::CZQubitResonator::new(0, 1).into(); "CZQubitResonator")]
fn test_bincode_compatibility_1_9(operation: test_roqoqo_1_9::operations::Operation) {
let mut test_circuit = test_roqoqo_1_9::Circuit::new();
test_circuit += operation;
Expand Down
74 changes: 71 additions & 3 deletions qoqo/src/operations/spin_boson_operations.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ use roqoqo::operations::*;
use roqoqo::ROQOQO_VERSION;
use std::collections::HashMap;

/// The quantum Rabi interaction exp(-i * θ * X * (b^{dagger} + b))
/// The quantum Rabi interaction exp(-i * θ * X * (b^ + b))
///
/// Args:
/// qubit (int): The qubit the gate is applied to.
Expand All @@ -43,7 +43,7 @@ pub struct QuantumRabi {
theta: CalculatorFloat,
}

/// Longitudinal coupling gate exp(-i * θ * Z * (b^{dagger} + b))
/// Longitudinal coupling gate exp(-i * θ * Z * (b^ + b))
///
/// Args:
/// qubit (int): The qubit the gate is applied to.
Expand All @@ -65,7 +65,7 @@ pub struct LongitudinalCoupling {
theta: CalculatorFloat,
}

/// The Jaynes-Cummings gate exp(-i * θ * (σ^- * b^{dagger} + σ^+ * b))
/// The Jaynes-Cummings gate exp(-i * θ * (σ^- * b^ + σ^+ * b))
///
/// Args:
/// qubit (int): The qubit the gate is applied to.
Expand All @@ -86,3 +86,71 @@ pub struct JaynesCummings {
mode: usize,
theta: CalculatorFloat,
}

/// Loads a single excitation from a bosonic mode into a qubit as follows
/// (c1 |0⟩_B + c2 |1⟩_B) ⨂ |0⟩_Q -> |0⟩_B ⨂ (c1 |0⟩_Q + c2 |1⟩_Q)
///
/// Note: if the initial qubit state is |1⟩_Q the operation is only defined if c2 = 0
///
/// Args:
/// qubit (int): The qubit the gate is applied to.
/// mode (int): The mode the gate is applied to.
#[wrap(
Operate,
Substitute,
OperateSingleMode,
SubstituteModes,
InvolveModes,
OperateSingleQubit,
InvolveQubits,
JsonSchema
)]
pub struct SingleExcitationLoad {
qubit: usize,
mode: usize,
}

/// Stores a single excitation from the involved qubit into the involved bosonic mode as follows
/// |0⟩_B ⨂ (a |0⟩_Q + b |1⟩_Q) -> (a|0⟩_B + b |1⟩_B ) ⨂ |0⟩_Q
///
/// Note: not defined if the bosonic mode is in a state |n⟩ with n != 0
///
/// Args:
/// qubit (int): The qubit the gate is applied to.
/// mode (int): The mode the gate is applied to.
#[wrap(
Operate,
Substitute,
OperateSingleMode,
SubstituteModes,
InvolveModes,
OperateSingleQubit,
InvolveQubits,
JsonSchema
)]
pub struct SingleExcitationStore {
qubit: usize,
mode: usize,
}

/// Controlled-Z operation between a qubit and a bosonic mode, where the two-dimensional subspace of
/// the bosonic mode spanned by the occupation number states |0⟩_B and |1⟩_B is considered
/// as the second qubit involved in the CZ operation.
///
/// Args:
/// qubit (int): The qubit the gate is applied to.
/// mode (int): The mode the gate is applied to.
#[wrap(
Operate,
Substitute,
OperateSingleMode,
SubstituteModes,
InvolveModes,
OperateSingleQubit,
InvolveQubits,
JsonSchema
)]
pub struct CZQubitResonator {
qubit: usize,
mode: usize,
}
Loading

0 comments on commit e6b07d4

Please sign in to comment.