public static void Hadamard(this QuantumComputer comp, RegisterRef target, RegisterRef?control = null) { if (control.HasValue) { Register root = comp.GetRootRegister(control.Value, target); int c = control.Value.OffsetToRoot; int t = target.OffsetToRoot; root.Hadamard(t, c); } else { Register root = comp.GetRootRegister(target); int t = target.OffsetToRoot; root.Hadamard(t); } }
public static void Gate1(this QuantumComputer comp, Complex[,] matrix, RegisterRef target, RegisterRef?control = null) { if (control.HasValue) { Register root = comp.GetRootRegister(control.Value, target); int c = control.Value.OffsetToRoot; int t = target.OffsetToRoot; root.Gate1(matrix, t, c); } else { Register root = comp.GetRootRegister(target); int t = target.OffsetToRoot; root.Gate1(matrix, t); } }
public static void RotateZ(this QuantumComputer comp, double gamma, RegisterRef target, RegisterRef?control = null) { if (control.HasValue) { Register root = comp.GetRootRegister(control.Value, target); int c = control.Value.OffsetToRoot; int t = target.OffsetToRoot; root.RotateZ(gamma, t, c); } else { Register root = comp.GetRootRegister(target); int t = target.OffsetToRoot; root.RotateZ(gamma, t); } }