-
Notifications
You must be signed in to change notification settings - Fork 42
Open
Description
Not a problem with the code examples.
I was referring back to the book to see the explanation there for ancilla qubits and reversibility.
One entry in table 7.3 doesn't appear correct.
It shows |101> resulting in |100> but without both control bits flipped there should be no change?
import org.redfx.strange.Program;
import org.redfx.strange.Qubit;
import org.redfx.strange.QuantumExecutionEnvironment;
import org.redfx.strange.local.SimpleQuantumExecutionEnvironment;
import org.redfx.strange.Result;
import org.redfx.strange.Step;
import org.redfx.strange.gate.Toffoli;
import org.redfx.strange.gate.X;
public class ToffoliTest {
public static void main(String... args) {
QuantumExecutionEnvironment simulator = new SimpleQuantumExecutionEnvironment();
System.out.println("|101> -> |101>");
Program p = new Program(3,
new Step(new X(2),new X(0)),
new Step(new Toffoli(2,1,0)));
Result res = simulator.runProgram(p);
Qubit[] qubits = res.getQubits();
for (int i=0; i<qubits.length; i++) {
System.out.println(i + " " + qubits[i].measure());
}
}
}
ToffoliTest
|101> -> |101>
0 1
1 0
2 1
(base) mjh@MacBook-Pro-2 quantumjava
Metadata
Metadata
Assignees
Labels
No labels