ppvm_traits/traits/branch/
rot1.rs1use crate::char::Pauli;
5use crate::config::Config;
6
7pub trait RotationOne<T: Config> {
9 fn rotate_1(&mut self, axis: Pauli, addr0: usize, theta: T::Coeff);
11 fn rx(&mut self, addr0: usize, theta: impl Into<T::Coeff>) {
13 self.rotate_1(Pauli::X, addr0, theta.into())
14 }
15 fn ry(&mut self, addr0: usize, theta: impl Into<T::Coeff>) {
17 self.rotate_1(Pauli::Y, addr0, theta.into())
18 }
19 fn rz(&mut self, addr0: usize, theta: impl Into<T::Coeff>) {
21 self.rotate_1(Pauli::Z, addr0, theta.into())
22 }
23
24 fn rx_many(&mut self, targets: &[usize], theta: impl Into<T::Coeff>) {
26 let theta = theta.into();
27 for &q in targets {
28 self.rx(q, theta.clone())
29 }
30 }
31 fn ry_many(&mut self, targets: &[usize], theta: impl Into<T::Coeff>) {
33 let theta = theta.into();
34 for &q in targets {
35 self.ry(q, theta.clone())
36 }
37 }
38 fn rz_many(&mut self, targets: &[usize], theta: impl Into<T::Coeff>) {
40 let theta = theta.into();
41 for &q in targets {
42 self.rz(q, theta.clone())
43 }
44 }
45}
46
47pub trait RotXY<T: Config> {
53 fn r(&mut self, addr0: usize, axis_angle: T::Coeff, theta: T::Coeff);
55}