Skip to content

Commit

Permalink
Move invoke up so it's next to eval_fragments
Browse files Browse the repository at this point in the history
  • Loading branch information
swernli committed Dec 11, 2024
1 parent e41ecdd commit fad5d4a
Showing 1 changed file with 16 additions and 15 deletions.
31 changes: 16 additions & 15 deletions compiler/qsc/src/interpret.rs
Original file line number Diff line number Diff line change
Expand Up @@ -536,21 +536,6 @@ impl Interpreter {
)
}

/// Runs the given entry expression on a new instance of the environment and simulator,
/// but using the current compilation.
pub fn run(
&mut self,
receiver: &mut impl Receiver,
expr: Option<&str>,
noise: Option<PauliNoise>,
) -> InterpretResult {
let mut sim = match noise {
Some(noise) => SparseSim::new_with_noise(&noise),
None => SparseSim::new(),
};
self.run_with_sim(&mut sim, receiver, expr)
}

/// Invokes the given callable with the given arguments using the current environment, simlator, and compilation.
pub fn invoke(
&mut self,
Expand All @@ -577,6 +562,22 @@ impl Interpreter {
)
})
}

/// Runs the given entry expression on a new instance of the environment and simulator,
/// but using the current compilation.
pub fn run(
&mut self,
receiver: &mut impl Receiver,
expr: Option<&str>,
noise: Option<PauliNoise>,
) -> InterpretResult {
let mut sim = match noise {
Some(noise) => SparseSim::new_with_noise(&noise),
None => SparseSim::new(),
};
self.run_with_sim(&mut sim, receiver, expr)
}

/// Gets the current quantum state of the simulator.
pub fn get_quantum_state(&mut self) -> (Vec<(BigUint, Complex<f64>)>, usize) {
self.sim.capture_quantum_state()
Expand Down

0 comments on commit fad5d4a

Please sign in to comment.