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