Open IsolatedMy opened 1 month ago
If I only need valid transformations, which can optimize quantum gate count, does it mean I only need to read
XX_complete_ECC_set.json
file?
Correct.
Nam_2_3_pruning_unverified.json
is the intermediate output of the final iteration of the RepGen algorithm, before the verifier in the final iteration. This is only useful for generating Nam_2_3_representative_set.json
(otherwise Quartz could output Nam_2_3_pruning.json
directly) because the verifier in the final iteration takes a long time.Nam_2_3_pruning.json
is the output of the RepGen algorithm (after verifier).Nam_2_3_complete_ECC_set.json
is the output of the RepGen algorithm with additional pruning like common subcircuit pruning and removing unused qubits, and is the ECC set you should use.Nam_2_3_representative_set.json
is the representative set, containing circuits with all possible unitaries for up to 2 gates and 3 qubits.Besides, I wonder what the decimals in the header of Nam_2_3_complete_ECC_set.json file used for.
The decimals are generated from here:
They specify the parameter expressions used in the ECC set. For example, ["add", ["P2"], ["P0", "P0"]]
means that the parameter P2 is equal to 2 * P0. If this is removed, Quartz will treat P2 as an input parameter instead of an expression.
The decimal numbers at the end are the random floating point values used for generating the fingerprint (hash value) of the circuits. This is recorded to avoid different behavior if the hash value is recalculated each time we read an ECC set.
Thanks for your patience. I still have some questions.
[["rz", ["Q1"], ["Q1", "P0"]]
, I think ["Q1"]
represents the operator qubit. But I wonder what ["Q1", "P0"]
stands for.["cx", ["Q1", "Q0"], ["Q1", "Q0"]]
, I wonder why ["Q1", "Q0"]
appear twice.
"0_2": [
[[2,2], [["x", ["Q0"], ["Q0"]], ["cx", ["Q0", "Q1"], ["Q0", "Q1"]]]]
,[[2,3], [["x", ["Q1"], ["Q1"]], ["cx", ["Q0", "Q1"], ["Q0", "Q1"]], ["x", ["Q0"], ["Q0"]]]]
]
,"1_2": [
[[2,2], [["rz", ["Q1"], ["Q1", "P0"]], ["cx", ["Q1", "Q0"], ["Q1", "Q0"]]]]
,[[2,2], [["cx", ["Q1", "Q0"], ["Q1", "Q0"]], ["rz", ["Q1"], ["Q1", "P0"]]]]
]
- For
[["rz", ["Q1"], ["Q1", "P0"]]
, I think["Q1"]
represents the operator qubit. But I wonder what["Q1", "P0"]
stands for.
P0
is the parameter input to the rz gate, and P0
represents the 0-th parameter (both qubits and parameters are 0-indexed). You can view this as Q1 := rz(Q1, P0)
where :=
means assignment in this pseudocode.
- And for
["cx", ["Q1", "Q0"], ["Q1", "Q0"]]
, I wonder why["Q1", "Q0"]
appear twice.
Similar to [Q1, Q0] := cx(Q1, Q0)
, the first ["Q1", "Q0"]
is the output, and the second ["Q1", "Q0"]
is the input. This design is for potential extension of gates that do not preserve the qubit order. For example, if you swap Q0
and Q1
physically without using a SWAP gate during the cx
operation, you can write ["cx", ["Q0", "Q1"], ["Q1", "Q0"]]
.
Hi. I notice in the given H_CZ_2_2_complete_ECC_set_modified.json
, it seems that some transformations are actually unnecessary. For example, we can use a symbolic qubit parameter to generalize the first two transformations into one [[2,2], [["h", ["Q"], ["Q"]], ["h", ["Q"], ["Q"]]]
. I wonder if you have thought this.
[
[[0], [0]],
{
"0_5": [
[[2,0], []]
,[[2,2], [["h", ["Q0"], ["Q0"]], ["h", ["Q0"], ["Q0"]]]]
,[[2,2], [["h", ["Q1"], ["Q1"]], ["h", ["Q1"], ["Q1"]]]]
,[[2,2], [["cz", ["Q0", "Q1"], ["Q0", "Q1"]], ["cz", ["Q0", "Q1"], ["Q0", "Q1"]]]]
,[[2,2], [["cz", ["Q0", "Q1"], ["Q0", "Q1"]], ["cz", ["Q1", "Q0"], ["Q1", "Q0"]]]]
]
}
]
Yeah, simplifying the ECC Sets is something on my TODO list for years but I've never got the time to do it.
For this example, because all qubits in ECC Sets are actually symbolic, you can actually only keep [[2,2], [["h", ["Q0"], ["Q0"]], ["h", ["Q0"], ["Q0"]]]]
(removing [[2,2], [["h", ["Q1"], ["Q1"]], ["h", ["Q1"], ["Q1"]]]]
) and it should not affect the result. If, for example, we need to replace ["cz", ["Q0", "Q1"], ["Q0", "Q1"]], ["cz", ["Q0", "Q1"], ["Q0", "Q1"]]
with ["h", ["Q1"], ["Q1"]], ["h", ["Q1"], ["Q1"]]
in a circuit, we can replace it with []
first, and then do a pattern matching with a different qubit mapping where the symbolic Q0
points to Q1
, and then do the replacement to ["h", ["Q1"], ["Q1"]], ["h", ["Q1"], ["Q1"]]
.
If you want to start a research project to do the simplification more systematically, we can chat through email. My email is mingkuan@cmu.edu.
Hi. I wonder what the information in each file stands for. For example, I generate transformations for "Nam_2_3", and there are 4 files generated.
Nam_2_3_complete_ECC_set.json
Nam_2_3_pruning_unverified.json
Nam_2_3_pruning.json
Nam_2_3_representative_set.json
If I only need valid transformations, which can optimize quantum gate count, does it mean I only need to read
XX_complete_ECC_set.json
file? Besides, I wonder what the decimals in the header ofNam_2_3_complete_ECC_set.json
file used for.Thanks.