4 ms·
On a mobile device so hard to write out proper code, but basically as I understand it, for an n-qubit system, you could imitate this with a class containing -
by throwaway080383 9y ago
On a mobile device so hard to write out proper code, but basically as I understand it, for an n-qubit system, you could imitate this with a class containing
- A length 2^n array of complex numbers, such that the sum of the norms of those numbers is always 1. Each element represent a possible length n bit string.
- An "observe" method, which returns a given length n bit string with probability equal to the norm of the corresponding complex number in the array.
- Various "transform" methods. These are all linear unitary operators (matrices with special properties) on the array, but I think you can't pick and choose them arbitrarily; see https://en.m.wikipedia.org/wiki/Quantum_gate https://en.m.wikipedia.org/wiki/Quantum_gate
All the usual bit operations are valid, but there are operations which don't have classical analogs, like this one in a 2-qbit system: "Maintain the probabilities of 00 or 11, but average the respective probabilities of 01 and 10".
The fact that you're working with complex numbers and not just probabilities is mathematically how entanglement can play a role, but I don't have a good minimal example of how this is helpful.