public virtual void ControlledR(IQArray <Qubit> controls, Pauli axis, double theta, Qubit qubit) { throw new NotImplementedException(); }
public virtual void RFrac(Pauli axis, long numerator, long power, Qubit qubit) { throw new NotImplementedException(); }
public virtual void ControlledRFrac(IQArray <Qubit> controls, Pauli axis, long numerator, long power, Qubit qubit) { throw new UnsupportedOperationException(); }
public virtual void R(Pauli axis, double theta, Qubit qubit) { throw new NotImplementedException(); }
Qubit?f(Pauli p, Qubit q) => p switch {
/// <summary> /// The implementation of the controlled adjoint specialization of the operation. /// For the Toffoli simulator *only*, the controlled specialization is self-adjoint. /// </summary> void IIntrinsicR.ControlledAdjointBody(IQArray <Qubit> controls, Pauli pauli, double angle, Qubit target) => ((IIntrinsicR)this).ControlledBody(controls, pauli, angle, target);
public virtual void R__ControlledAdjointBody(IQArray <Qubit> controls, Pauli pauli, double angle, Qubit target) { R__ControlledBody(controls, pauli, -angle, target); }
private void Clifford(long id, Pauli pauli, Qubit target) { DoPrimitiveOperation(PrimitiveOperationsGroups.QubitClifford, new QArray <Qubit>(target)); }
private static extern void MCR(uint id, Pauli basis, double angle, uint count, uint[] ctrls, uint qubit);
public virtual void R__AdjointBody(Pauli pauli, double angle, Qubit target) { R__Body(pauli, -angle, target); }
/// <summary> /// The implementation of the adjoint specialization of the operation. /// For the Toffoli simulator *only*, this operation is self-adjoint. /// </summary> public void R__AdjointBody(Pauli pauli, double angle, Qubit target) => R__Body(pauli, angle, target);
public override void RFrac(Pauli axis, long numerator, long power, Qubit qubit) => throw new UnsupportedOperationException("This operation is not supported in the CHP Stabilizer formalism.");
public override void R(Pauli axis, double theta, Qubit qubit) => throw new UnsupportedOperationException("This operation is not supported in the CHP Stabilizer formalism.");
public virtual void ControlledRFrac(IQArray <Qubit> controls, Pauli axis, long numerator, long power, Qubit qubit) { throw new NotImplementedException(); }
public virtual void R(Pauli axis, double theta, Qubit qubit) { throw new UnsupportedOperationException(); }
internal static (bool, bool) CheckRotation(Pauli axis, long numerator, long power) { // Rotations around X of odd multiples of pi/2 are X (up to global phase). // Rotations around any axis of multiples of pi are I (up to global phase). // Rotations of any angle around I are I. // Rotations around any axis of even multiples of pi are safe to control. // The angle here is pi*numerator/(2^power). // The sign of the numerator doesn't matter. // Reduce the numerator and power in case there are factors of 2 in the numerator. numerator = Abs(numerator); while ((power > 0) && (numerator % 2 == 0)) { numerator /= 2; power--; } bool equivalentToX = false; bool safeToControl = false; // If the power < 0, we're guaranteed to be a multiple of 2*pi, so exactly the identity. if (power < 0) { equivalentToX = false; safeToControl = true; } // If power > 1, then we're an odd multiple of pi/4, so illegal else if (power > 1) { throw new InvalidOperationException($"The Toffoli simulator can only perform rotations of multiples of pi/2."); } // If power == 1, then we're an odd multiple of pi/2, so X if the axis is X, // I if the axis is I, and illegal otherwise. else if (power == 1) { switch (axis) { case Pauli.PauliI: equivalentToX = false; safeToControl = false; break; case Pauli.PauliX: equivalentToX = true; safeToControl = false; break; case Pauli.PauliY: case Pauli.PauliZ: throw new InvalidOperationException($"The Toffoli simulator can only perform non-identity rotations around the X axis."); } } // If power == 0, then we're a multiple of pi, possible an even multiple. else { equivalentToX = false; safeToControl = (numerator % 2 == 0); } return(equivalentToX, safeToControl); }
public virtual void ControlledR(IQArray <Qubit> controls, Pauli axis, double theta, Qubit qubit) { throw new UnsupportedOperationException(); }
private void R(Pauli pauli, double angle, Qubit target) { DoPrimitiveOperation(PrimitiveOperationsGroups.R, new QArray <Qubit>(target)); }
public virtual void RFrac(Pauli axis, long numerator, long power, Qubit qubit) { throw new UnsupportedOperationException(); }
private static extern void R(uint id, Pauli basis, double angle, uint qubit);
/// <summary> /// The implementation of the adjoint specialization of the operation. /// For the Toffoli simulator *only*, this operation is self-adjoint. /// </summary> void IIntrinsicR.AdjointBody(Pauli pauli, double angle, Qubit target) => ((IIntrinsicR)this).Body(pauli, angle, target);