Browse Source

isomorphism runs through first tests :)

Former-commit-id: c83157ba7a
tempestpy_adaptions
sjunges 9 years ago
parent
commit
aaec1fd3bd
  1. 12
      src/storage/dft/DFTIsomorphism.h

12
src/storage/dft/DFTIsomorphism.h

@ -96,7 +96,7 @@ namespace storage {
return res; return res;
} }
bool hasGate(size_t index) {
bool hasGate(size_t index) const {
for(auto const& x : gateCandidates) { for(auto const& x : gateCandidates) {
for( auto const& ind : x.second) { for( auto const& ind : x.second) {
if(index == ind) return true; if(index == ind) return true;
@ -105,7 +105,7 @@ namespace storage {
return false; return false;
} }
bool hasBE(size_t index) {
bool hasBE(size_t index) const {
for(auto const& x : beCandidates) { for(auto const& x : beCandidates) {
for(auto const& ind : x.second) { for(auto const& ind : x.second) {
if(index == ind) return true; if(index == ind) return true;
@ -114,7 +114,7 @@ namespace storage {
return false; return false;
} }
bool hasDep(size_t index) {
bool hasDep(size_t index) const {
for(auto const& x : pdepCandidates) { for(auto const& x : pdepCandidates) {
for(auto const& ind : x.second) { for(auto const& ind : x.second) {
if(index == ind) return true; if(index == ind) return true;
@ -123,7 +123,7 @@ namespace storage {
return false; return false;
} }
bool has(size_t index) {
bool has(size_t index) const {
return hasGate(index) || hasBE(index) || hasDep(index); return hasGate(index) || hasBE(index) || hasDep(index);
} }
@ -355,11 +355,13 @@ namespace storage {
auto const& lGate = dft.getGate(indexpair.first); auto const& lGate = dft.getGate(indexpair.first);
std::set<size_t> childrenLeftMapped; std::set<size_t> childrenLeftMapped;
for(auto const& child : lGate->children() ) { for(auto const& child : lGate->children() ) {
assert(bleft.has(child->id()));
childrenLeftMapped.insert(bijection.at(child->id())); childrenLeftMapped.insert(bijection.at(child->id()));
} }
auto const& rGate = dft.getGate(indexpair.second); auto const& rGate = dft.getGate(indexpair.second);
std::set<size_t> childrenRight; std::set<size_t> childrenRight;
for(auto const& child : rGate->children() ) { for(auto const& child : rGate->children() ) {
assert(bright.has(child->id()));
childrenRight.insert(child->id()); childrenRight.insert(child->id());
} }
if(childrenLeftMapped != childrenRight) { if(childrenLeftMapped != childrenRight) {
@ -435,7 +437,7 @@ namespace storage {
auto it = permutations.insert(colour); auto it = permutations.insert(colour);
assert(it.second); assert(it.second);
std::sort(it.first->second.begin(), it.first->second.end()); std::sort(it.first->second.begin(), it.first->second.end());
zipVectorsIntoMap(colour.second, permutations.find(colour.first)->second, bijection);
zipVectorsIntoMap(left.at(colour.first), it.first->second, bijection);
} else { } else {
assert(colour.second.size() == 1); assert(colour.second.size() == 1);
assert(bijection.count(left.at(colour.first).front()) == 0); assert(bijection.count(left.at(colour.first).front()) == 0);

Loading…
Cancel
Save