Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/master' into satelite-msm
Browse files Browse the repository at this point in the history
  • Loading branch information
zigen committed Apr 24, 2024
2 parents c2570a2 + 5a1dcd7 commit e1798fa
Show file tree
Hide file tree
Showing 13 changed files with 196 additions and 169 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/doc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ jobs:
- name: Generate doxygen
uses: mattnotmitt/doxygen-action@v1
- name: Deploy to github pages
uses: peaceiris/actions-gh-pages@v3
uses: peaceiris/actions-gh-pages@v4
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./doc/html
Expand Down
44 changes: 22 additions & 22 deletions quisp/modules/QRSA/ConnectionManager/ConnectionManager.cc
Original file line number Diff line number Diff line change
Expand Up @@ -127,38 +127,38 @@ void ConnectionManager::handleMessage(cMessage *msg) {
}

PurType ConnectionManager::parsePurType(const std::string &pur_type) {
if (pur_type == "SINGLE_X") {
return PurType::SINGLE_X;
if (pur_type == "SINGLE_SELECTION_X_PURIFICATION") {
return PurType::SINGLE_SELECTION_X_PURIFICATION;
}
if (pur_type == "SINGLE_Z") {
return PurType::SINGLE_Z;
if (pur_type == "SINGLE_SELECTION_Z_PURIFICATION") {
return PurType::SINGLE_SELECTION_Z_PURIFICATION;
}
if (pur_type == "SINGLE_Y") {
return PurType::SINGLE_Y;
if (pur_type == "SINGLE_SELECTION_Y_PURIFICATION") {
return PurType::SINGLE_SELECTION_Y_PURIFICATION;
}
if (pur_type == "DOUBLE") {
return PurType::DOUBLE;
if (pur_type == "SINGLE_SELECTION_XZ_PURIFICATION") {
return PurType::SINGLE_SELECTION_XZ_PURIFICATION;
}
if (pur_type == "DOUBLE_INV") {
return PurType::DOUBLE_INV;
if (pur_type == "SINGLE_SELECTION_ZX_PURIFICATION") {
return PurType::SINGLE_SELECTION_ZX_PURIFICATION;
}
if (pur_type == "DSSA") {
return PurType::DSSA;
if (pur_type == "DOUBLE_SELECTION_X_PURIFICATION") {
return PurType::DOUBLE_SELECTION_X_PURIFICATION;
}
if (pur_type == "DSSA_INV") {
return PurType::DSSA_INV;
if (pur_type == "DOUBLE_SELECTION_Z_PURIFICATION") {
return PurType::DOUBLE_SELECTION_Z_PURIFICATION;
}
if (pur_type == "DSDA") {
return PurType::DSDA;
if (pur_type == "DOUBLE_SELECTION_XZ_PURIFICATION") {
return PurType::DOUBLE_SELECTION_XZ_PURIFICATION;
}
if (pur_type == "DSDA_INV") {
return PurType::DSDA_INV;
if (pur_type == "DOUBLE_SELECTION_ZX_PURIFICATION") {
return PurType::DOUBLE_SELECTION_ZX_PURIFICATION;
}
if (pur_type == "DSDA_SECOND") {
return PurType::DSDA_SECOND;
if (pur_type == "DOUBLE_SELECTION_X_PURIFICATION_SINGLE_SELECTION_Z_PURIFICATION") {
return PurType::DOUBLE_SELECTION_X_PURIFICATION_SINGLE_SELECTION_Z_PURIFICATION;
}
if (pur_type == "DSDA_SECOND_INV") {
return PurType::DSDA_SECOND_INV;
if (pur_type == "DOUBLE_SELECTION_Z_PURIFICATION_SINGLE_SELECTION_X_PURIFICATION") {
return PurType::DOUBLE_SELECTION_Z_PURIFICATION_SINGLE_SELECTION_X_PURIFICATION;
}
return PurType::INVALID;
}
Expand Down
2 changes: 1 addition & 1 deletion quisp/modules/QRSA/ConnectionManager/ConnectionManager.ned
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ simple ConnectionManager
int total_number_of_qnics;
int num_remote_purification = default(1);
bool simultaneous_es_enabled = default(false);
string purification_type_cm = default("SINGLE_X");
string purification_type_cm = default("SINGLE_SELECTION_X_PURIFICATION");
double threshold_fidelity = default(0);
int seed_cm = default(0);

Expand Down
46 changes: 23 additions & 23 deletions quisp/modules/QRSA/ConnectionManager/ConnectionManager_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ class ConnectionManagerTestTarget : public quisp::modules::ConnectionManager {
setParBool(this, "simultaneous_es_enabled", false);
setParBool(this, "entanglement_swapping_with_purification", false);
setParInt(this, "num_remote_purification", 1);
setParStr(this, "purification_type_cm", "SINGLE_X");
setParStr(this, "purification_type_cm", "SINGLE_SELECTION_X_PURIFICATION");
setParDouble(this, "threshold_fidelity", 0);
setParInt(this, "seed_cm", 0);

Expand Down Expand Up @@ -90,28 +90,28 @@ TEST(ConnectionManagerTest, parsePurType) {
auto *hardware_monitor = new MockHardwareMonitor();
auto *connection_manager = new ConnectionManagerTestTarget(routing_daemon, hardware_monitor);

auto pur_type = connection_manager->parsePurType("SINGLE_X");
EXPECT_EQ(pur_type, PurType::SINGLE_X);
pur_type = connection_manager->parsePurType("SINGLE_Y");
EXPECT_EQ(pur_type, PurType::SINGLE_Y);
pur_type = connection_manager->parsePurType("SINGLE_Z");
EXPECT_EQ(pur_type, PurType::SINGLE_Z);
pur_type = connection_manager->parsePurType("DOUBLE");
EXPECT_EQ(pur_type, PurType::DOUBLE);
pur_type = connection_manager->parsePurType("DOUBLE_INV");
EXPECT_EQ(pur_type, PurType::DOUBLE_INV);
pur_type = connection_manager->parsePurType("DSSA");
EXPECT_EQ(pur_type, PurType::DSSA);
pur_type = connection_manager->parsePurType("DSSA_INV");
EXPECT_EQ(pur_type, PurType::DSSA_INV);
pur_type = connection_manager->parsePurType("DSDA");
EXPECT_EQ(pur_type, PurType::DSDA);
pur_type = connection_manager->parsePurType("DSDA_INV");
EXPECT_EQ(pur_type, PurType::DSDA_INV);
pur_type = connection_manager->parsePurType("DSDA_SECOND");
EXPECT_EQ(pur_type, PurType::DSDA_SECOND);
pur_type = connection_manager->parsePurType("DSDA_SECOND_INV");
EXPECT_EQ(pur_type, PurType::DSDA_SECOND_INV);
auto pur_type = connection_manager->parsePurType("SINGLE_SELECTION_X_PURIFICATION");
EXPECT_EQ(pur_type, PurType::SINGLE_SELECTION_X_PURIFICATION);
pur_type = connection_manager->parsePurType("SINGLE_SELECTION_Y_PURIFICATION");
EXPECT_EQ(pur_type, PurType::SINGLE_SELECTION_Y_PURIFICATION);
pur_type = connection_manager->parsePurType("SINGLE_SELECTION_Z_PURIFICATION");
EXPECT_EQ(pur_type, PurType::SINGLE_SELECTION_Z_PURIFICATION);
pur_type = connection_manager->parsePurType("SINGLE_SELECTION_XZ_PURIFICATION");
EXPECT_EQ(pur_type, PurType::SINGLE_SELECTION_XZ_PURIFICATION);
pur_type = connection_manager->parsePurType("SINGLE_SELECTION_ZX_PURIFICATION");
EXPECT_EQ(pur_type, PurType::SINGLE_SELECTION_ZX_PURIFICATION);
pur_type = connection_manager->parsePurType("DOUBLE_SELECTION_X_PURIFICATION");
EXPECT_EQ(pur_type, PurType::DOUBLE_SELECTION_X_PURIFICATION);
pur_type = connection_manager->parsePurType("DOUBLE_SELECTION_Z_PURIFICATION");
EXPECT_EQ(pur_type, PurType::DOUBLE_SELECTION_Z_PURIFICATION);
pur_type = connection_manager->parsePurType("DOUBLE_SELECTION_XZ_PURIFICATION");
EXPECT_EQ(pur_type, PurType::DOUBLE_SELECTION_XZ_PURIFICATION);
pur_type = connection_manager->parsePurType("DOUBLE_SELECTION_ZX_PURIFICATION");
EXPECT_EQ(pur_type, PurType::DOUBLE_SELECTION_ZX_PURIFICATION);
pur_type = connection_manager->parsePurType("DOUBLE_SELECTION_X_PURIFICATION_SINGLE_SELECTION_Z_PURIFICATION");
EXPECT_EQ(pur_type, PurType::DOUBLE_SELECTION_X_PURIFICATION_SINGLE_SELECTION_Z_PURIFICATION);
pur_type = connection_manager->parsePurType("DOUBLE_SELECTION_Z_PURIFICATION_SINGLE_SELECTION_X_PURIFICATION");
EXPECT_EQ(pur_type, PurType::DOUBLE_SELECTION_Z_PURIFICATION_SINGLE_SELECTION_X_PURIFICATION);
// unknown purification name
pur_type = connection_manager->parsePurType("DSDA_SECOND_INV_T");
EXPECT_EQ(pur_type, PurType::INVALID);
Expand Down
27 changes: 15 additions & 12 deletions quisp/modules/QRSA/ConnectionManager/RuleSetGenerator.cc
Original file line number Diff line number Diff line change
Expand Up @@ -45,15 +45,15 @@ std::map<int, json> RuleSetGenerator::generateRuleSets(messages::ConnectionSetup
// // if you want to do e2e purification before tomography do it here
// int left_addr = path.front();
// int right_addr = path.back();
// rules_map[left_addr].emplace_back(purifyRule(right_addr, PurType::SINGLE_X, ++shared_rule_tag));
// rules_map[right_addr].emplace_back(purifyRule(left_addr, PurType::SINGLE_X, shared_rule_tag));
// rules_map[left_addr].emplace_back(purificationCorrelationRule(right_addr, PurType::SINGLE_X, shared_rule_tag));
// rules_map[right_addr].emplace_back(purificationCorrelationRule(left_addr, PurType::SINGLE_X, shared_rule_tag));
// rules_map[left_addr].emplace_back(purifyRule(right_addr, PurType::SINGLE_SELECTION_X_PURIFICATION, ++shared_rule_tag));
// rules_map[right_addr].emplace_back(purifyRule(left_addr, PurType::SINGLE_SELECTION_X_PURIFICATION, shared_rule_tag));
// rules_map[left_addr].emplace_back(purificationCorrelationRule(right_addr, PurType::SINGLE_SELECTION_X_PURIFICATION, shared_rule_tag));
// rules_map[right_addr].emplace_back(purificationCorrelationRule(left_addr, PurType::SINGLE_SELECTION_X_PURIFICATION, shared_rule_tag));

// rules_map[left_addr].emplace_back(purifyRule(right_addr, PurType::SINGLE_Z, ++shared_rule_tag));
// rules_map[right_addr].emplace_back(purifyRule(left_addr, PurType::SINGLE_Z, shared_rule_tag));
// rules_map[left_addr].emplace_back(purificationCorrelationRule(right_addr, PurType::SINGLE_Z, shared_rule_tag));
// rules_map[right_addr].emplace_back(purificationCorrelationRule(left_addr, PurType::SINGLE_Z, shared_rule_tag));
// rules_map[left_addr].emplace_back(purifyRule(right_addr, PurType::SINGLE_SELECTION_Z_PURIFICATION, ++shared_rule_tag));
// rules_map[right_addr].emplace_back(purifyRule(left_addr, PurType::SINGLE_SELECTION_Z_PURIFICATION, shared_rule_tag));
// rules_map[left_addr].emplace_back(purificationCorrelationRule(right_addr, PurType::SINGLE_SELECTION_Z_PURIFICATION, shared_rule_tag));
// rules_map[right_addr].emplace_back(purificationCorrelationRule(left_addr, PurType::SINGLE_SELECTION_Z_PURIFICATION, shared_rule_tag));

// add tomography rules
auto initiator_addr = path.front();
Expand Down Expand Up @@ -113,13 +113,16 @@ std::unique_ptr<Rule> RuleSetGenerator::purifyRule(int partner_address, PurType

// decide how many Bell pairs are required
int num_resource;
if (purification_type == PurType::SINGLE_X || purification_type == PurType::SINGLE_Z || purification_type == PurType::SINGLE_Y) {
if (purification_type == PurType::SINGLE_SELECTION_X_PURIFICATION || purification_type == PurType::SINGLE_SELECTION_Z_PURIFICATION ||
purification_type == PurType::SINGLE_SELECTION_Y_PURIFICATION) {
num_resource = 2;
} else if (purification_type == PurType::DOUBLE || purification_type == PurType::DOUBLE_INV || purification_type == PurType::DSSA || purification_type == PurType::DSSA_INV) {
} else if (purification_type == PurType::SINGLE_SELECTION_XZ_PURIFICATION || purification_type == PurType::SINGLE_SELECTION_ZX_PURIFICATION ||
purification_type == PurType::DOUBLE_SELECTION_X_PURIFICATION || purification_type == PurType::DOUBLE_SELECTION_Z_PURIFICATION) {
num_resource = 3;
} else if (purification_type == PurType::DSDA_SECOND || purification_type == PurType::DSDA_SECOND_INV) {
} else if (purification_type == PurType::DOUBLE_SELECTION_X_PURIFICATION_SINGLE_SELECTION_Z_PURIFICATION ||
purification_type == PurType::DOUBLE_SELECTION_Z_PURIFICATION_SINGLE_SELECTION_X_PURIFICATION) {
num_resource = 4;
} else if (purification_type == PurType::DSDA || purification_type == PurType::DSDA_INV) {
} else if (purification_type == PurType::DOUBLE_SELECTION_XZ_PURIFICATION || purification_type == PurType::DOUBLE_SELECTION_ZX_PURIFICATION) {
num_resource = 5;
} else {
throw std::runtime_error("unknown purification type");
Expand Down
4 changes: 2 additions & 2 deletions quisp/modules/QRSA/ConnectionManager/RuleSetGenerator_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,7 @@ TEST_F(RuleSetGeneratorTest, Simple) {
TEST_F(RuleSetGeneratorTest, PurificationRule) {
// rule arguments
int partner_addr = 1;
PurType purification_type = PurType::DOUBLE;
PurType purification_type = PurType::SINGLE_SELECTION_XZ_PURIFICATION;

auto purification_rule = rsg->purifyRule(partner_addr, purification_type, 15);
auto serialized = purification_rule->serialize_json();
Expand Down Expand Up @@ -228,7 +228,7 @@ TEST_F(RuleSetGeneratorTest, PurificationRule) {
"action":{
"type":"purification",
"options":{
"purification_type":"DOUBLE",
"purification_type":"SINGLE_SELECTION_XZ_PURIFICATION",
"shared_rule_tag": 15,
"interface": [
{"partner_address":1}
Expand Down
Loading

0 comments on commit e1798fa

Please sign in to comment.