-
Notifications
You must be signed in to change notification settings - Fork 0
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
1 parent
db647c4
commit efb6992
Showing
2 changed files
with
31 additions
and
2 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
use crate::gate::Gate; | ||
|
||
/// A discrete gate-based representation of a quantum computation. | ||
/// | ||
/// The circuit is represented as an unstrtuctured set of gates, with their connectivity separately | ||
/// recorded by an adjacency list. | ||
/// Moreover, a circuit is not a random graph, but rather a set of wires, with possible links | ||
/// across them. This is represented by recording the circuit ends, where it is possible to append | ||
/// further gates, including measurements. They identify the quantum elements (local subsystem) | ||
/// where the gates are acting on. | ||
#[derive(Debug)] | ||
pub struct Circuit { | ||
/// Set of gates | ||
gates: Vec<Gate>, | ||
/// Gates connectivity | ||
edges: Vec<(usize, usize)>, | ||
/// Current final gates of each wire | ||
ends: Vec<Option<usize>>, | ||
} | ||
|
||
impl Circuit { | ||
pub fn new(elements: i32) -> Self { | ||
Circuit { | ||
gates: vec![], | ||
edges: vec![], | ||
ends: vec![None; qubits], | ||
} | ||
} | ||
} |