Pure states visualized with BraKetVue
We start with a 3-qubit state:
Now, let’s apply Hadamard gate to the first qubit. Here is the resulting sta
Now, let’s apply CNOT gate to the first two qubits:
Finally, we apply Toffoli gate to all three qubits:
Or, if you prefer to have all operations in one place:
And if you wonder, JavaScript code to make the computation is as simple as:
const { Circuit } = QuantumTensors;
const circuitHistory = [];
Circuit.qubits(3)
.saveTo(circuitHistory)
.H(0)
.saveTo(circuitHistory)
.CNOT(0, 1)
.saveTo(circuitHistory)
.TOFFOLI(0, 1, 2)
.saveTo(circuitHistory);
Full documentation is in https://github.com/Quantum-Game/quantum-tensors/. For quantum circuits, see: https://quantum-game.github.io/quantum-tensors/classes/_circuit_.circuit.html.
If you’ve ever wondered how does the Hadamard matrix look like, here’s one:
If we have three qubits, the operator acting on them is \(H \otimes I \otimes I\), that is: