Exemplo n.º 1
0
 public void AddQubits(Qubit[] qubits)
 {
     for (var i = 0; i < qubits.Length; i++)
     {
         this.matrix = ComplexMatrix.TensorProduct(this.matrix, qubits[i].Matrix);
         this.register = new Qubit[this.register.Length + 1];
     }
 }
Exemplo n.º 2
0
        public Register(Qubit[] qubits)
        {
            this.register = qubits;
            this.matrix = this.register[0].Matrix;

            for (var i = 1; i < this.register.Length; i++)
            {
                this.matrix = ComplexMatrix.TensorProduct(this.matrix, this.register[i].Matrix);
            }

            random = new Random();
        }
Exemplo n.º 3
0
        private static Qubit[] GetQubitArray(int length)
        {
            var array = new Qubit[length];
            for (var i = 0; i < array.Length; i++)
            {
                array[i] = new Qubit();
            }

            return array;
        }