boschmitt / tweedledum

C++17 Library for analysis, compilation/synthesis, and optimization of quantum circuits
MIT License
98 stars 36 forks source link

Expr variables order #146

Closed boschmitt closed 3 years ago

boschmitt commented 3 years ago

Description

Allow users to define variable order when parsing expressions for oracles. For example:

ExpressionParser("((A & C) | (B & D)) & ~(C & D)", var_order=["A", "B", "C", "D"])

Variables A, B, C, and D will be placed on qubits 0, 1, 2, and 3, respectively. If this was called without an order:

ExpressionParser("((A & C) | (B & D)) & ~(C & D)")

Then variables will be placed on qubits in order of appearance. That is, A, B, C, and D will be placed on qubits 0, 2, 1, and 3, respectively.

Suggested changelog entry:

Specify variable order for expressions parser
codecov-commenter commented 3 years ago

Codecov Report

Merging #146 (63e54b8) into master (d90cad5) will decrease coverage by 28.60%. The diff coverage is n/a.

Impacted file tree graph

@@             Coverage Diff             @@
##           master     #146       +/-   ##
===========================================
- Coverage   73.47%   44.86%   -28.61%     
===========================================
  Files          98       45       -53     
  Lines        5183     1197     -3986     
===========================================
- Hits         3808      537     -3271     
+ Misses       1375      660      -715     
Impacted Files Coverage Δ
include/tweedledum/Target/Mapping.h 0.00% <0.00%> (-100.00%) :arrow_down:
include/tweedledum/Operators/Standard/H.h 0.00% <0.00%> (-100.00%) :arrow_down:
include/tweedledum/Operators/Standard/X.h 0.00% <0.00%> (-100.00%) :arrow_down:
include/tweedledum/Operators/Standard/Y.h 0.00% <0.00%> (-100.00%) :arrow_down:
include/tweedledum/Operators/Standard/Swap.h 0.00% <0.00%> (-100.00%) :arrow_down:
include/tweedledum/Operators/Extension/Parity.h 0.00% <0.00%> (-100.00%) :arrow_down:
...lude/tweedledum/Passes/Utility/shallow_duplicate.h 0.00% <0.00%> (-100.00%) :arrow_down:
include/tweedledum/IR/Qubit.h 7.69% <0.00%> (-92.31%) :arrow_down:
include/tweedledum/Operators/Extension/Unitary.h 0.00% <0.00%> (-90.08%) :arrow_down:
include/tweedledum/Operators/Standard/Rx.h 0.00% <0.00%> (-86.67%) :arrow_down:
... and 90 more

Continue to review full report at Codecov.

Legend - Click here to learn more Δ = absolute <relative> (impact), ø = not affected, ? = missing data Powered by Codecov. Last update 5d545f8...63e54b8. Read the comment docs.