QuTech-Delft / qx-simulator

QX Simulator
Other
16 stars 12 forks source link

Allow multiple qubit/bit (register) definitions and mid-circuit measurements #150

Closed rturrado closed 6 months ago

rturrado commented 6 months ago

Update libqasm version to 0.6.6.

A Circuit has a Program and a RegisterManager. A GateConvertor receives a Circuit upon construction. A GateConvertor passes a RegisterManager to an OperandsHelper. RegisterManager's constructor:

Add integration tests. Add range-v3 dependency.

Fix Conan test profiles so that they do not skip tests.

Move GateConvertor to a separate file. Move OperandsHelper to a separate file. Move SimulationError to a separate file. Move cqasm::v3x and cqasm::tree aliases to V3xLibqasmInterface.hpp.

Remove V3xLibqasmInterface.cpp.

Note that this PR:

rturrado commented 6 months ago

Unfortunately, I won't be able to judge whether the all changes are oke, but if ALL tests still run fine, then it should be oke.

We should consider adding more tests to QX (later), specifically when we fully decouple the qubit register from the bit register, because as I believe the output of QX is now still a bit string, with the position of the bit corresponding with the index of the qubit register. (eventhough the user may have done things like b[1] = measure q[0] and b[0] = measure q[1], then this should output differently.

That's it. I've just updated the current tests to the new syntax, and added a few tests: for identity, multiple qubit and bit registers, and mid-circuit measurements.

And you're right. In the future, the output should be something like breg="001", a="1", or "001" but then you would have to say to which bit variable is associated each position in the virtual bit register. Something like that.

Thanks!