Skip to content

Commit

Permalink
Debug/optimize gate fusion in QBdt
Browse files Browse the repository at this point in the history
  • Loading branch information
WrathfulSpatula committed Aug 7, 2023
1 parent ebd4b9a commit da727ac
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/qbdt/tree.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -376,7 +376,11 @@ real1_f QBdt::Prob(bitLenInt qubit)
throw std::invalid_argument("QBdt::Prob qubit index parameter must be within allocated qubit bounds!");
}

FlushIfBlocked(qubit);
const MpsShardPtr shard = shards[qubit];
if (shard && !shard->IsPhase()) {
shards[qubit] = NULL;
ApplySingle(shard->gate, qubit);
}

const bitCapInt qPower = pow2(qubit);
const unsigned numCores = GetConcurrencyLevel();
Expand Down Expand Up @@ -504,9 +508,9 @@ bitCapInt QBdt::MAll()
for (bitLenInt i = 0U; i < qubitCount; ++i) {
const MpsShardPtr shard = shards[i];
if (shard && !shard->IsPhase()) {
shards[i] = NULL;
ApplySingle(shard->gate, i);
}
shards[i] = NULL;
}

Finish();
Expand Down

0 comments on commit da727ac

Please sign in to comment.