Version 1.1.0 of Quantum.NET has been released today. It introduces several new features aimed at facilitating the building of more complex quantum circuits and the obtaining of the results they yield.
First is the introduction of identity gates:
While useless in themselves, they become very powerful when combined with another new feature, quantum gate stacking, or the creation of quantum gates from other, smaller quantum gates (variadic constructor, also works with
QuantumGate quantumGate = new QuantumGate(QuantumGate.PauliZGate, QuantumGate.IdentityGate); // This gate will apply the Pauli-Z gate to the first qubit and leave the second one unchanged
This allows to apply a gate to a subsection of a quantum register, leaving the rest unchanged while preserving entanglement.
Another new feature is the reading of the values contained in pure-state quantum registers. Once an algorithm is run, we will be left with a register to observe which, once collapsed, will contain the data we need. Optional offset and length parameters can be used to read a subsection of the quantum register only, as often required.
QuantumRegister quantumRegister = new QuantumRegister(27); // |11011>
int a = quantumRegister.GetValue(); // 27 (0b11011)
int b = quantumRegister.GetValue(1); // 11 (0b1011)
int c = quantumRegister.GetValue(1, 3); // 5 (0b101)
int d = Qubit.EPRPair.GetValue(); // cannot be used on a mixed state; throws System.SystemException
Quantum.NET is available as a NuGet package under Lachesis.QuantumComputing, and the source code can be found on GitHub at phbaudin/quantum-computing.