예제 #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];
     }
 }
예제 #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();
        }
예제 #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;
        }