use crate::char::Pauli;
use crate::config::Config;
pub trait RotationOne<T: Config> {
fn rotate_1(&mut self, axis: Pauli, addr0: usize, theta: T::Coeff);
fn rx(&mut self, addr0: usize, theta: impl Into<T::Coeff>) {
self.rotate_1(Pauli::X, addr0, theta.into())
}
fn ry(&mut self, addr0: usize, theta: impl Into<T::Coeff>) {
self.rotate_1(Pauli::Y, addr0, theta.into())
}
fn rz(&mut self, addr0: usize, theta: impl Into<T::Coeff>) {
self.rotate_1(Pauli::Z, addr0, theta.into())
}
fn rx_many(&mut self, targets: &[usize], theta: impl Into<T::Coeff>) {
let theta = theta.into();
for &q in targets {
self.rx(q, theta.clone())
}
}
fn ry_many(&mut self, targets: &[usize], theta: impl Into<T::Coeff>) {
let theta = theta.into();
for &q in targets {
self.ry(q, theta.clone())
}
}
fn rz_many(&mut self, targets: &[usize], theta: impl Into<T::Coeff>) {
let theta = theta.into();
for &q in targets {
self.rz(q, theta.clone())
}
}
}
pub trait RotXY<T: Config> {
fn r(&mut self, addr0: usize, axis_angle: T::Coeff, theta: T::Coeff);
}