Skip to content

Commit

Permalink
🎨 pre-commit fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
pre-commit-ci[bot] committed Jan 21, 2024
1 parent 114a028 commit 14378dd
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 7 deletions.
15 changes: 10 additions & 5 deletions include/dd/Package.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -870,7 +870,8 @@ template <class Config> class Package {
// controls are 0.
auto e = makeGateDD(rxMat(PI_2), n, qc::Controls{}, target0, start);
e = multiply(e, makeGateDD(rxMat(PI_2), n, qc::Controls{}, target1, start));
e = multiply(e, makeTwoQubitGateDD(rzzMat(theta), n, controls, target0, target1, start));
e = multiply(e, makeTwoQubitGateDD(rzzMat(theta), n, controls, target0,
target1, start));
e = multiply(e,
makeGateDD(rxMat(-PI_2), n, qc::Controls{}, target1, start));
e = multiply(e,
Expand All @@ -885,7 +886,8 @@ template <class Config> class Package {
// controls are 0.
auto e = makeGateDD(H_MAT, n, qc::Controls{}, target0, start);
e = multiply(e, makeGateDD(H_MAT, n, qc::Controls{}, target1, start));
e = multiply(e, makeTwoQubitGateDD(rzzMat(theta), n, controls, target0, target1, start));
e = multiply(e, makeTwoQubitGateDD(rzzMat(theta), n, controls, target0,
target1, start));
e = multiply(e, makeGateDD(H_MAT, n, qc::Controls{}, target1, start));
e = multiply(e, makeGateDD(H_MAT, n, qc::Controls{}, target0, start));
return e;
Expand All @@ -897,17 +899,20 @@ template <class Config> class Package {
// no controls are necessary on the H gates since they cancel if the
// controls are 0.
auto e = makeGateDD(H_MAT, n, qc::Controls{}, target1, start);
e = multiply(e, makeTwoQubitGateDD(rzzMat(theta), n, controls, target0, target1, start));
e = multiply(e, makeTwoQubitGateDD(rzzMat(theta), n, controls, target0,
target1, start));
e = multiply(e, makeGateDD(H_MAT, n, qc::Controls{}, target1, start));
return e;
}

mEdge makeECRDD(const std::size_t n, const qc::Controls& controls,
const qc::Qubit target0, const qc::Qubit target1,
const std::size_t start = 0) {
auto e = makeTwoQubitGateDD(rzxMat(-PI_4), n, controls, target0, target1, start);
auto e =
makeTwoQubitGateDD(rzxMat(-PI_4), n, controls, target0, target1, start);
e = multiply(e, makeGateDD(X_MAT, n, controls, target0, start));
e = multiply(e, makeTwoQubitGateDD(rzxMat(PI_4), n, controls, target0, target1, start));
e = multiply(e, makeTwoQubitGateDD(rzxMat(PI_4), n, controls, target0,
target1, start));
return e;
}

Expand Down
5 changes: 3 additions & 2 deletions test/dd/test_dd_functionality.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -202,8 +202,9 @@ TEST_F(DDFunctionality, twoTargetControlledGateDDEdgeCases) {
{ e = newDD->multiply(getDD(&op, *newDD), getInverseDD(&op, *newDD)); });
newDD->incRef(e);

ASSERT_NO_THROW(
{ d = newDD->multiply(getDD(&op_neg, *newDD), getInverseDD(&op_neg, *newDD)); });
ASSERT_NO_THROW({
d = newDD->multiply(getDD(&op_neg, *newDD), getInverseDD(&op_neg, *newDD));
});
newDD->incRef(d);

// the DD of the identity needs to be reconstructed as well
Expand Down

0 comments on commit 14378dd

Please sign in to comment.