Exemple #1
0
 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);
     }
 }
Exemple #2
0
 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);
     }
 }
Exemple #3
0
 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);
     }
 }