Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
bd9b0f1
:sparkles: added PassBy operation for flying ancillae
lsschmid Aug 8, 2024
fa45fb0
✨ allow passby to have multiple targets.
lsschmid Aug 13, 2024
566d996
Merge branch 'main' into na-hybrid-extension
lsschmid Jan 20, 2025
99afdb0
✨ added passby operation.
lsschmid Jan 20, 2025
5b93fd0
✨ added qasm string for passby operation.
lsschmid Jan 20, 2025
d85d0a1
✨ Changed passby to two-target operation
lsschmid Jan 21, 2025
e0ea685
✨ Added Bridge Gate as Standard Operation
lsschmid Jan 23, 2025
b3735bd
✨ Added qasm output for bridge gate.
lsschmid Jan 23, 2025
ae59dce
🐛 Removed underbar from passBy string
lsschmid Feb 3, 2025
fdf59c5
🔥 removed again passby
lsschmid Feb 4, 2025
3dd3edc
✨ Added getEuclideanDistanceFp method to calculate Euclidean distance…
lsschmid Feb 4, 2025
4c499ad
🐛 Fixed aod qasm output
lsschmid Feb 5, 2025
d54342f
🔀 merge main
lsschmid Sep 18, 2025
b65026b
🐛 Fixed typo in op type number
lsschmid Sep 18, 2025
3df8ebe
🐛 Fixed typo in qasm output
lsschmid Sep 18, 2025
06930b4
Merge remote-tracking branch 'origin/main' into na-hybrid-extension
lsschmid Nov 5, 2025
061c377
🐛 Fixed double assigned type values
lsschmid Nov 5, 2025
1e1476c
✅ Fixed wrong test
lsschmid Nov 5, 2025
869f0b4
✅ added test to cover all bridge and move
lsschmid Nov 5, 2025
59efb37
🚨 Fixed linter warnings
lsschmid Nov 5, 2025
8336894
Merge remote-tracking branch 'origin/main' into na-hybrid-extension
lsschmid Nov 5, 2025
bb69232
🎨 improved qasm dump for aod operation
lsschmid Nov 5, 2025
9428d93
Revert enum values to previous definition.
lsschmid Nov 10, 2025
fd40f5e
Merge branch 'main' into na-hybrid-extension
lsschmid Nov 10, 2025
834b3df
🎨 reworked qasm output to avoid pointer comparison.
lsschmid Nov 10, 2025
bbceb09
📝 updated CHANGELOG.md
lsschmid Nov 10, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,10 @@ This project adheres to [Semantic Versioning], with the exception that minor rel

## [Unreleased]

### Added

- ✨ Add support for bridge gates for the neutral atom hybrid mapper ([#1293]) ([**@lsschmid**])

## [3.3.2] - 2025-11-04

### Added
Expand Down Expand Up @@ -227,6 +231,7 @@ _📚 Refer to the [GitHub Release Notes](https://github.com/munich-quantum-tool

<!-- PR links -->

[#1293]: https://github.com/munich-quantum-toolkit/core/pull/1293
[#1287]: https://github.com/munich-quantum-toolkit/core/pull/1287
[#1283]: https://github.com/munich-quantum-toolkit/core/pull/1283
[#1279]: https://github.com/munich-quantum-toolkit/core/pull/1279
Expand Down Expand Up @@ -351,6 +356,7 @@ _📚 Refer to the [GitHub Release Notes](https://github.com/munich-quantum-tool
[**@lavanya-m-k**]: https://github.com/lavanya-m-k
[**@taminob**]: https://github.com/taminob
[**@jannikpflieger**]: https://github.com/jannikpflieger
[**@lsschmid**]: https://github.com/lsschmid

<!-- General links -->

Expand Down
2 changes: 2 additions & 0 deletions include/mqt-core/ir/QuantumComputation.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -328,6 +328,8 @@ class QuantumComputation {
*/
void measureAll(bool addBits = true);

void bridge(const Targets& targets);

void reset(Qubit target);
void reset(const Targets& targets);

Expand Down
3 changes: 2 additions & 1 deletion include/mqt-core/ir/operations/OpType.inc
Original file line number Diff line number Diff line change
Expand Up @@ -65,11 +65,12 @@ HANDLE_OP_TYPE(36, MultiAFalse, 0, "multi_a_false")

// Neutral atom shuttling operations
HANDLE_OP_TYPE(37, Move, 0, "move")
HANDLE_OP_TYPE(42, Bridge, 0, "bridge")
HANDLE_OP_TYPE(38, AodActivate, 0, "aod_activate")
HANDLE_OP_TYPE(39, AodDeactivate, 0, "aod_deactivate")
HANDLE_OP_TYPE(40, AodMove, 0, "aod_move")

LAST_OP_TYPE(42)
LAST_OP_TYPE(43)


#undef OpTypeInv
Expand Down
5 changes: 5 additions & 0 deletions src/ir/QuantumComputation.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1566,6 +1566,11 @@ void QuantumComputation::measureAll(const bool addBits) {
}
}

void QuantumComputation::bridge(const Targets& targets) {
checkQubitRange(targets);
emplace_back<StandardOperation>(targets, Bridge);
}

void QuantumComputation::reset(const Qubit target) {
checkQubitRange(target);
emplace_back<NonUnitaryOperation>(std::vector<Qubit>{target}, Reset);
Expand Down
35 changes: 23 additions & 12 deletions src/ir/operations/AodOperation.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@
#include <cstddef>
#include <cstdint>
#include <iomanip>
#include <ios>
#include <limits>
#include <ostream>
#include <sstream>
Expand All @@ -42,6 +41,7 @@ std::string SingleOperation::toQASMString() const {
ss << static_cast<std::size_t>(dir) << ", " << start << ", " << end << "; ";
return ss.str();
}

std::vector<Dimension>
AodOperation::convertToDimension(const std::vector<uint32_t>& dirs) {
std::vector<Dimension> dirsEnum(dirs.size());
Expand Down Expand Up @@ -102,6 +102,7 @@ std::vector<qc::fp> AodOperation::getEnds(const Dimension dir) const {
}
return ends;
}

std::vector<qc::fp> AodOperation::getStarts(const Dimension dir) const {
std::vector<qc::fp> starts;
for (const auto& op : operations) {
Expand All @@ -111,13 +112,15 @@ std::vector<qc::fp> AodOperation::getStarts(const Dimension dir) const {
}
return starts;
}

qc::fp AodOperation::getMaxDistance(const Dimension dir) const {
const auto distances = getDistances(dir);
if (distances.empty()) {
return 0;
}
return *std::ranges::max_element(distances);
}

std::vector<qc::fp> AodOperation::getDistances(const Dimension dir) const {
std::vector<qc::fp> params;
for (const auto& op : operations) {
Expand All @@ -127,26 +130,35 @@ std::vector<qc::fp> AodOperation::getDistances(const Dimension dir) const {
}
return params;
}

void AodOperation::dumpOpenQASM(
std::ostream& of, const qc::QubitIndexToRegisterMap& qubitMap,
[[maybe_unused]] const qc::BitIndexToRegisterMap& bitMap,
const size_t indent, bool /*openQASM3*/) const {
of << std::setprecision(std::numeric_limits<qc::fp>::digits10);
of << std::string(indent * OUTPUT_INDENT_SIZE, ' ');
of << name;
// write AOD operations
of << " (";
of << std::string(indent * OUTPUT_INDENT_SIZE, ' ') << name << " (";

// Write AOD operations with separator logic
bool first = true;
for (const auto& op : operations) {
of << op.toQASMString();
if (!first) {
of << "; ";
}
first = false;
of << static_cast<std::size_t>(op.dir) << ", " << op.start << ", "
<< op.end;
}
// remove last semicolon
of.seekp(-1, std::ios_base::end);
of << ")";
// write qubit start

// Write qubits with separator logic
bool firstQubit = true;
for (const auto& qubit : targets) {
of << " " << qubitMap.at(qubit).second << ",";
if (!firstQubit) {
of << ",";
}
firstQubit = false;
of << " " << qubitMap.at(qubit).second;
}
of.seekp(-1, std::ios_base::end);
of << ";\n";
}

Expand All @@ -161,5 +173,4 @@ void AodOperation::invert() {
type = qc::OpType::AodActivate;
}
}

} // namespace na
3 changes: 3 additions & 0 deletions src/ir/operations/StandardOperation.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -457,6 +457,9 @@ void StandardOperation::dumpGateType(
case iSWAPdg:
op << "iswapdg";
break;
case Bridge:
op << "bridge";
break;
case Move:
op << "move";
break;
Expand Down
30 changes: 29 additions & 1 deletion test/ir/test_operation.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -257,6 +257,34 @@ TEST(StandardOperation, Move) {
const qc::StandardOperation moveOp({0, 1}, qc::OpType::Move);
EXPECT_EQ(moveOp.getTargets().size(), 2);
EXPECT_EQ(moveOp.getNqubits(), 2);

// QASM dump verification
std::stringstream ss;
qc::QuantumRegister qreg(0, 2, "q");
qc::QubitIndexToRegisterMap qubitToReg{};
qubitToReg.try_emplace(0, qreg, qreg.toString(0));
qubitToReg.try_emplace(1, qreg, qreg.toString(1));
moveOp.dumpOpenQASM(ss, qubitToReg, {}, 0, false);
EXPECT_EQ(ss.str(), "move q[0], q[1];\n");
}

TEST(StandardOperation, Bridge) {
const qc::StandardOperation bridgeOp({0, 1, 2}, qc::OpType::Bridge);
EXPECT_EQ(bridgeOp.getTargets().size(), 3);
EXPECT_EQ(bridgeOp.getNqubits(), 3);

// QASM dump verification
std::stringstream ss;
qc::QuantumRegister qreg(0, 3, "q");
qc::QubitIndexToRegisterMap qubitToReg{};
qubitToReg.try_emplace(0, qreg, qreg.toString(0));
qubitToReg.try_emplace(1, qreg, qreg.toString(1));
qubitToReg.try_emplace(2, qreg, qreg.toString(2));
bridgeOp.dumpOpenQASM(ss, qubitToReg, {}, 0, false);
EXPECT_EQ(ss.str(), "bridge q[0], q[1], q[2];\n");

qc::QuantumComputation qc(3);
EXPECT_NO_THROW(qc.bridge({0, 1, 2}));
}

TEST(AodOperation, Activate) {
Expand Down Expand Up @@ -309,7 +337,7 @@ TEST(AodOperation, Qasm) {
qubitToReg.try_emplace(1, qreg, qreg.toString(1));
move.dumpOpenQASM(ss, qubitToReg, {}, 0, false);

EXPECT_EQ(ss.str(), "aod_move (0, 0, 1; 1, 1, 3;) q[0], q[1];\n");
EXPECT_EQ(ss.str(), "aod_move (0, 0, 1; 1, 1, 3) q[0], q[1];\n");
}

TEST(AodOperation, Constructors) {
Expand Down
Loading