Skip to content

Commit

Permalink
add superoperator noise to density matrix qasm controller
Browse files Browse the repository at this point in the history
  • Loading branch information
chriseclectic committed Aug 1, 2019
1 parent c4c87ca commit b59e13b
Showing 1 changed file with 20 additions and 10 deletions.
30 changes: 20 additions & 10 deletions src/simulators/qasm/qasm_controller.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -654,16 +654,26 @@ void QasmController::run_circuit_with_noise(const Circuit &circ,
const Method method,
OutputData &data,
RngEngine &rng) const {
// TODO: noise sampling for density matrix method
// Sample a new noise circuit and optimize for each shot
while(shots-- > 0) {
Circuit noise_circ = noise.sample_noise(circ, rng);
if (noise_circ.num_qubits > circuit_opt_noise_threshold_) {
Noise::NoiseModel dummy;
optimize_circuit(noise_circ, dummy, state, data);
}
run_single_shot(noise_circ, state, initial_state, data, rng);
}
if (method == Method::density_matrix) {
// Special case for density matrix simulation
// We insert noise directly into circuit as superoperators
Noise::NoiseModel noise_cpy = noise;
noise_cpy.activate_superop_method();
Circuit noise_circ = noise_cpy.sample_noise(circ, rng);
// Run the without_noise routine on the circuit with noise superops
// already inserted
run_circuit_without_noise(noise_circ, shots, state, initial_state, method, data, rng);
} else {
// Sample a new noise circuit and optimize for each shot
while(shots-- > 0) {
Circuit noise_circ = noise.sample_noise(circ, rng);
if (noise_circ.num_qubits > circuit_opt_noise_threshold_) {
Noise::NoiseModel dummy;
optimize_circuit(noise_circ, dummy, state, data);
}
run_single_shot(noise_circ, state, initial_state, data, rng);
}
}
}


Expand Down

0 comments on commit b59e13b

Please sign in to comment.