Skip to content

Commit

Permalink
Some QASM parsing updates (#112)
Browse files Browse the repository at this point in the history
  • Loading branch information
tylerrleblond committed May 31, 2024
1 parent 5eac2e9 commit a7d3908
Show file tree
Hide file tree
Showing 13 changed files with 46,630 additions and 5,034 deletions.
2 changes: 1 addition & 1 deletion examples/qasm/compact_layout_demo.qasm
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,4 @@ cx q[0],q[10];
s q[1];
cx q[1],q[3];
cx q[5],q[7];
t q[2];s
t q[2];
11 changes: 11 additions & 0 deletions include/lsqecc/gates/gates.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ struct BasicSingleQubitGate{
enum class Type : uint8_t
{
X = static_cast<uint8_t>(PauliOperator::X),
Y = static_cast<uint8_t>(PauliOperator::Y),
Z = static_cast<uint8_t>(PauliOperator::Z),
S,
T,
Expand Down Expand Up @@ -103,6 +104,7 @@ inline constexpr BasicSingleQubitGate G(QubitNum target_qubit){\
}

MAKE_BASIC_GATE(X);
MAKE_BASIC_GATE(Y);
MAKE_BASIC_GATE(Z);
MAKE_BASIC_GATE(S);
MAKE_BASIC_GATE(T);
Expand All @@ -122,6 +124,15 @@ inline constexpr ControlledGate CNOT(
return {control_qubit, X(target_qubit), cnot_type, cnot_ancilla_placement};
}

inline constexpr ControlledGate CZ(
QubitNum target_qubit,
QubitNum control_qubit,
CNOTType cnot_type = CNOTType::ZX_WITH_MBM_CONTROL_FIRST,
CNOTAncillaPlacement cnot_ancilla_placement = CNOTAncillaPlacement::ANCILLA_NEXT_TO_CONTROL
){
return {control_qubit, Z(target_qubit), cnot_type, cnot_ancilla_placement};
}

inline constexpr ControlledGate CRZ(
QubitNum target_qubit, QubitNum control_qubit, Fraction pi_fraction, CNOTType cnot_type, CNOTAncillaPlacement cnot_ancilla_placement){
return {control_qubit, RZ{target_qubit, pi_fraction}, cnot_type, cnot_ancilla_placement};
Expand Down
2 changes: 2 additions & 0 deletions include/lsqecc/ls_instructions/ls_instructions.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,7 @@ struct SingleQubitOp {

enum class Operator : uint8_t {
X = static_cast<uint8_t>(PauliOperator::X),
Y = static_cast<uint8_t>(PauliOperator::Y),
Z = static_cast<uint8_t>(PauliOperator::Z),
H,
S
Expand Down Expand Up @@ -277,6 +278,7 @@ static inline std::string_view SingleQuibitOperatorName_to_string(SingleQubitOp:
switch(op)
{
case SingleQubitOp::Operator::X: return "X"sv;
case SingleQubitOp::Operator::Y: return "Y"sv;
case SingleQubitOp::Operator::Z: return "Z"sv;
case SingleQubitOp::Operator::H: return "H"sv;
case SingleQubitOp::Operator::S: return "S"sv;
Expand Down
2 changes: 2 additions & 0 deletions regression_tests/cases/edpc_layout_tests/1.case.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ qreg q[4];
h q[0];
s q[0];
t q[0];
y q[1];
cz q[2],q[3]; // %BellBased
cx q[0],q[1]; // %BellBased
"
echo "$INPUT" | lsqecc_slicer -q -L edpc --nostagger --local
Expand Down
Loading

0 comments on commit a7d3908

Please sign in to comment.