Skip to content

Commit

Permalink
feat: Start designing circuits
Browse files Browse the repository at this point in the history
  • Loading branch information
alecandido committed Apr 8, 2024
1 parent db647c4 commit efb6992
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 2 deletions.
4 changes: 2 additions & 2 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

29 changes: 29 additions & 0 deletions src/circuit.rs
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],
}
}
}

0 comments on commit efb6992

Please sign in to comment.