Function spinoza::gates::c_apply

source ·
pub fn c_apply(gate: Gate, state: &mut State, control: usize, target: usize)
Expand description

Apply a transformation to a single target qubit, with a single control.

Examples

use spinoza::{gates::{c_apply, Gate}, core::State};

let n = 3;
let mut state = State::new(n);

let pairs: Vec<(usize, usize)> = (0..n).map(|i| (i, (i +1) % n)).collect();
for (control, target) in pairs.iter() {
    c_apply(Gate::H, &mut state, *control, *target);
}