Example #1
0
        public void Initialize()
        {
            this.width = Utils.CalculateRegisterWidth((ulong)N);
            this.kMax = Math.Log(2 * width, 2);

            this.comp = QuantumComputer.GetInstance();

            regX = comp.NewRegister(0, 2 * width/*, (int)(Math.Pow(2, 2 * width))*/);
            regX1 = comp.NewRegister(1, width + 1);
            rega = comp.NewRegister(0, regX1.Width - 1);
            regb = comp.NewRegister(0, regX1.Width);
            regc = comp.NewRegister(0, regX1.Width);
            regN = comp.NewRegister((ulong)N, regX1.Width - 1);

            //result = new byte[width];
            //expTab = new ulong[width];
        }
Example #2
0
        public void Initialize()
        {
            this.width = Utils.CalculateRegisterWidth((ulong)N);
            L = 2 * width;

            this.comp = QuantumComputer.GetInstance();

            Register regTemp = comp.NewRegister(1, 4 * width + 2, (int)(Math.Pow(2, 2 * (width + 1))));

            this.regX = regTemp[0, width];
            this.reg0 = regTemp[width, width + 1];
            this.regC = regTemp[2 * width + 1, 2 * width];
            this.ctrl = regTemp[4 * width + 1, 1];

            //this.regX = comp.NewRegister(1, width);
            //this.regC = comp.NewRegister(0, 1);

            //this.ctrl = comp.NewRegister(0, 1);
            //this.reg0 = comp.NewRegister(0, width + 1);
            //this.reg0 = comp.NewRegister(0, width);
            //this.reg0 = comp.NewRegister(0, width + 1, (int)(Math.Pow(2, 2 * (width + 1))));

            result = new byte[L];
            expTab = new ulong[L];
        }
 public static void Reset(this QuantumComputer comp, Register register, ulong newValue = 0)
 {
     register.Reset(newValue);
 }