-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
31 changed files
with
476 additions
and
2,146 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,41 +1,8 @@ | ||
mod classical; | ||
pub mod hybrid; | ||
pub mod phir_engine; | ||
pub mod quantum; | ||
|
||
pub use crate::channels::{CommandChannel, MeasurementChannel}; | ||
pub use crate::errors::QueueError; | ||
use parking_lot::RwLock; | ||
pub use pecos_core::types::{CommandBatch, MeasurementResult, QuantumCommand, ShotResult}; | ||
use pecos_noise::noise::NoiseModel; | ||
use std::sync::Arc; | ||
|
||
/// Classical engine that processes programs and handles measurements | ||
pub trait ClassicalEngine: Send + Sync { | ||
fn process_program(&mut self) -> Result<CommandBatch, QueueError>; | ||
fn handle_measurement(&mut self, measurement: MeasurementResult) -> Result<(), QueueError>; | ||
fn get_results(&self) -> Result<ShotResult, QueueError>; | ||
fn compile(&self) -> Result<(), Box<dyn std::error::Error>>; | ||
} | ||
|
||
/// Quantum engine that processes commands and generates measurements | ||
pub trait QuantumEngine: Send + Sync { | ||
fn process_command( | ||
&mut self, | ||
cmd: &QuantumCommand, | ||
) -> Result<Option<MeasurementResult>, QueueError>; | ||
|
||
fn reset_state(&mut self) -> Result<(), QueueError>; | ||
} | ||
|
||
// Base implementation of Hybrid Engine | ||
pub struct HybridEngine<C, M> | ||
where | ||
C: CommandChannel + Send + Sync + 'static, | ||
M: MeasurementChannel + Send + Sync + 'static, | ||
{ | ||
classical: Arc<RwLock<Box<dyn ClassicalEngine>>>, | ||
quantum: Arc<RwLock<Box<dyn QuantumEngine>>>, | ||
cmd_channel: Arc<RwLock<C>>, | ||
meas_channel: Arc<RwLock<M>>, | ||
noise_model: Arc<RwLock<Option<Box<dyn NoiseModel>>>>, | ||
} | ||
pub use classical::ClassicalEngine; | ||
pub use hybrid::HybridEngine; | ||
pub use quantum::QuantumEngine; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
use crate::channels::Message; | ||
use crate::errors::QueueError; | ||
use pecos_core::types::{CommandBatch, ShotResult}; | ||
|
||
/// Classical engine that processes programs and handles measurements | ||
pub trait ClassicalEngine: Send + Sync { | ||
fn process_program(&mut self) -> Result<CommandBatch, QueueError>; | ||
fn handle_measurement(&mut self, measurement: Message) -> Result<(), QueueError>; | ||
fn get_results(&self) -> Result<ShotResult, QueueError>; | ||
fn compile(&self) -> Result<(), Box<dyn std::error::Error>>; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.