Repository navigation
Conversation
|
david-pl
left a comment
There was a problem hiding this comment.
I think the RotationTwo impl could be much simpler. Other than that, I think it's good.
| } | ||
|
|
||
| #[inline] | ||
| fn rxx(&mut self, a: usize, b: usize, theta: A) { |
There was a problem hiding this comment.
Why do we need these overrides? Shouldn't the generic rotate_2 method be enough here?
| // |1><1| ⊗ X = (IX - ZX)/2. The two generators commute. | ||
| // Loss follows the constituent rotations' surviving-site convention. | ||
| let half = theta * 0.5; | ||
| self.rx(target, half.clone()); |
There was a problem hiding this comment.
This is always executed on the target. If the control is lost or |0>, rounding errors could still lead to small branching. Probably not much of an issue in practice, but this could also be bad for performance since you'd have to do a branch -> truncate pass in order to get rid of that.
| impl<S: Support, P, A> RotXY<S::Coeff, A> for Sum<S, P> | ||
| where | ||
| Self: RotationOne<S::Coeff, A>, | ||
| A: Angle<S::Coeff> + Clone + std::ops::Neg<Output = A>, |
There was a problem hiding this comment.
Can you remove Neg here? Current symbolic angles don't have it implemented.
| impl<S: Support, P, A> CRx<S::Coeff, A> for Sum<S, P> | ||
| where | ||
| Self: RotationOne<S::Coeff, A> + RotationTwo<S::Coeff, A>, | ||
| A: Angle<S::Coeff> + Clone + std::ops::Mul<f64, Output = A> + std::ops::Neg<Output = A>, |
There was a problem hiding this comment.
Hm, okay, we may need some follow-up work on ppvm-sym-2. I don't think we can currently represent theta * 0.5 with symbolic angles. Let's keep that out of this PR though.
There was a problem hiding this comment.
Do you think it might make sense to immediately use the Halvable trait here? I can have a look at what the ppvm-sym-2 changes have to be after, but it is probably easier if the angle just needs to support .half().
(
There was a problem hiding this comment.
I thought about it but Halvable is not implemented for angles, but for Coefficient. But essentially, yes, it might be re-used. We basically need some symbolic representation of a half-angle, I think.
|
|
||
| [dev-dependencies] | ||
| ppvm-pauli-sum = { path = "../ppvm-pauli-sum" } | ||
| criterion = "0.8.2" |
Adds rotation support to
Sumusing buffered accumulation: update all original coefficients before merging generated terms, so collisions cannot cause contributions to be processed twice.T,T†,U3,RotXY, andCRx.RXX,RYY, andRZZfor performance.