Replies: 1 comment 2 replies
-
@zazabap Currently not. However, #include <iostream>
#include "qpp.h"
int main() {
using namespace qpp;
// parametrized gate
auto param_gate = [](realT theta) { return gt.RX(theta); };
for (idx i = 0; i < 10; ++i) {
realT angle = 0 + 0.05 * i; // this is the variable we want to vary
QCircuit qc{2, 2};
qc.gate(gt.X, 0);
// qc.gate(param_gate(angle), 0);
// or can use directly a lambda as below
qc.CTRL([](realT theta) { return gt.RX(theta); }(angle), 0, 1);
qc.measure_all();
QEngine qeng{qc};
qeng.execute(1000);
std::cout << qeng << "\n\n";
}
} There's virtually no overhead comparing to the cost of executing the circuit on an engine. However, we will consider in the future allowing parametrized circuits. |
Beta Was this translation helpful? Give feedback.
2 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
If I have a rotational matrix and hope to control the rotation base on Rz(\theta), is it possible to implement the Rz(\theta) directly into the QCircuit with some possibility to customize the output?
Beta Was this translation helpful? Give feedback.
All reactions