Skip to main content

apply_gate_2x2_simd

Function apply_gate_2x2_simd 

Source
pub fn apply_gate_2x2_simd(
    state: &mut Vec<Complex64>,
    matrix: [[Complex64; 2]; 2],
    target: usize,
    n_qubits: usize,
)
Expand description

Apply a generic 2×2 unitary gate to qubit target using SIMD acceleration.

matrix is given as [[a, b], [c, d]] where the new amplitudes are:

  • new_|0⟩ = a·old_|0⟩ + b·old_|1⟩
  • new_|1⟩ = c·old_|0⟩ + d·old_|1⟩

Falls back to scalar arithmetic for state.len() < 256.