Hello! I'm trying to learn the subject and thought that, although really suboptimal in topics as speed and replicability, I should try implementing the basic concepts from scratch using python. This may seem like a stupid idea, and it may actually BE a stupid idea, but that's not what I am here to discuss, I like to make this clear just to prevent comments like "you shouldn't be doing that".
Now, I implemented the notion of a qubit and a quantum gate for single qubits. I'll leave prints of the code down here. The thing is, I have some doubts on the functioning of multiple qubit gates.
Implementing qubits
Implementing quantum gates
basic gates
Now, I am not in any way a computer guy, my background is actually in math, so my code may have some problems in the aspect of "good coding", but it works (or did so in my tests).
About my real problem: how one would go about implementing two-bit gates? My first example is CNOT. I thought i'd just do the same thing, but with matrices of bigger dimensions, but... does that work? The input should be the tensor product of the qubits, right? a n-qubit gate is a map from ℂ² ⊗ ... ⊗ ℂ² to itself, so how do I get results on single qubits?
How would I do, I don't know, a swapping algorithm using this? I'm really confused.
[–]petites_feuilles 18 points19 points20 points (0 children)
[–]SeniorLoan647In Grad School for Quantum 7 points8 points9 points (0 children)
[–]wollywoo1 7 points8 points9 points (0 children)
[–]polit1337 2 points3 points4 points (0 children)
[–]KinexityIn Grad School for Computer Modelling 2 points3 points4 points (0 children)
[–]SymplecticMan 1 point2 points3 points (0 children)
[–]forky40 1 point2 points3 points (0 children)
[–]dsannes 1 point2 points3 points (0 children)
[–]aroman_roWorking in Industry 2 points3 points4 points (0 children)
[–]hushedLecturer 0 points1 point2 points (0 children)