-
Notifications
You must be signed in to change notification settings - Fork 47
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Feature Request: Any amount of control Qbits #30
Comments
@tjf801 thank you! Added to our list. |
@tjf801 by the way, I guess you already know that, but just in case to say that workaround is:
|
Workaround until we implement it natively. |
Would love to see this natively, has there been any updates? |
You deserved it after 2 years of waiting! :) Added to dev pipeline. |
basic support for multi-controlled gates and inverted controls is now added to v0.9.186. Only Usage:Multi-controlled var circuit = new QuantumCircuit();
// register controlled u1 gate with 3 controls
circuit.registerGate("mcu1_3", circuit.MCU1Circuit(3).save(true));
// And now you can add it anywhere into your circuit (with lamda of your choice)
circuit.appendGate("mcu1_3", [0, 1, 2, 3], { params: { lambda: "pi/3" } });
circuit.appendGate("mcu1_3", [2, 3, 0, 1], { params: { lambda: "pi/2" } });
console.log(circuit.exportQASM()); Output is:
Multi-controlled var circuit = new QuantumCircuit();
// Register controlled x gate with 4 controls
circuit.registerGate("mcx_4", circuit.MCXCircuit(4).save(true));
// And use it in your circuit
circuit.appendGate("mcx_4", [0, 1, 2, 3, 4]);
circuit.appendGate("mcx_4", [2, 3, 0, 1, 4]);
console.log(circuit.exportQASM()); Output is:
Inverted controls When creating gate, instead of simply providing number of control wires, you can provide array of boolean values where Example: 3-controlled var circuit = new QuantumCircuit();
// Register controlled x gate with 3 controls. Second control is inverted:
circuit.registerGate("mcx_3_101", circuit.MCXCircuit([true, false, true]).save(true));
// And use it in your circuit
circuit.appendGate("mcx_3_101", [0, 1, 2, 3]);
circuit.appendGate("mcx_3_101", [2, 3, 0, 1]);
console.log(circuit.exportQASM()); Output is:
Warning! Achtung! |
Now this works in GUI as well: https://youtu.be/0ujizq7iat0 |
it would be nice to be able to add any amount of "control points" to any gate, and if you have time, an inverted "control point" would be nice also.
The text was updated successfully, but these errors were encountered: