Skip to content

Commit

Permalink
Fix: support running programs that use zero qubits
Browse files Browse the repository at this point in the history
  • Loading branch information
notmgsk committed Jul 13, 2021
1 parent 7162ba3 commit 577aaa7
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,10 @@ fn run(cli: Cli) -> Result<()> {
};
let program = Program::from_str(&quil).expect("bad program");
let used_qubits = qubits_in_program(&program);
let max_qubits_needed = used_qubits.iter().max().unwrap() + 1;
let max_qubits_needed = match used_qubits.iter().max() {
None => 0,
Some(n) => *n + 1,
};

let mut vm = VM::new(max_qubits_needed, program);

Expand Down

0 comments on commit 577aaa7

Please sign in to comment.