public static void AddQFT(this QuantumComputer comp, ulong a, Register b, params RegisterRef[] controls) { Validate(a, b); comp.QFT(b); comp.AddQFTPhi(a, b, controls); comp.InverseQFT(b); }
public static void AddModuloQFTPhi(this QuantumComputer comp, ulong a, ulong N, RegisterRef ctrl, Register b, params RegisterRef[] controls) { if (comp.Group) { object[] parameters = new object[] { comp, a, N, ctrl, b, controls }; comp.AddParametricGate("AddModuloQFTPhi", parameters); return; } else { comp.Group = true; } comp.AddQFTPhi(a, b, controls); comp.InverseAddQFTPhi(N, b); comp.InverseQFT(b); comp.CNot(ctrl, b[b.Width - 1]); comp.QFT(b); comp.AddQFTPhi(N, b, ctrl); comp.InverseAddQFTPhi(a, b, controls); comp.InverseQFT(b); comp.SigmaX(b[b.Width - 1]); comp.CNot(ctrl, b[b.Width - 1]); comp.SigmaX(b[b.Width - 1]); comp.QFT(b); comp.AddQFTPhi(a, b, controls); }
public static void AddModuloQFTPhi(this QuantumComputer comp, ulong a, ulong N, RegisterRef ctrl, Register b, params RegisterRef[] controls) { comp.AddQFTPhi(a, b, controls); comp.InverseAddQFTPhi(N, b); comp.InverseQFT(b); comp.CNot(ctrl, b[b.Width - 1]); comp.QFT(b); comp.AddQFTPhi(N, b, ctrl); comp.InverseAddQFTPhi(a, b, controls); comp.InverseQFT(b); comp.SigmaX(b[b.Width - 1]); comp.CNot(ctrl, b[b.Width - 1]); comp.SigmaX(b[b.Width - 1]); comp.QFT(b); comp.AddQFTPhi(a, b, controls); }
public static void AddQFT(this QuantumComputer comp, ulong a, Register b, params RegisterRef[] controls) { if (comp.Group) { object[] parameters = new object[] { comp, a, b, controls }; comp.AddParametricGate("AddQFT", parameters); return; } else { comp.Group = true; } Validate(a, b); comp.QFT(b); comp.AddQFTPhi(a, b, controls); comp.InverseQFT(b); }