Skip to content

Commit 5ff20e3

Browse files
authored
Follow-up to #61 - apply first-round data to all shots (#85)
This fixes what a bug with #61. The problem was that the first round data in `syndromeTensor` was only being copied for `shot == 0` and was left uninitialized/uncopied for all other shots. Signed-off-by: Ben Howe <[email protected]>
1 parent 616bbcd commit 5ff20e3

File tree

2 files changed

+7
-6
lines changed

2 files changed

+7
-6
lines changed

libs/qec/lib/experiments.cpp

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -155,11 +155,12 @@ sample_memory_circuit(const code &code, operation statePrep,
155155
measuresTensor.borrow(measurements.data());
156156

157157
// First round, store bare syndrome measurement
158-
for (std::size_t col = 0; col < numCols; ++col) {
159-
std::size_t shot = 0;
160-
std::size_t round = 0;
161-
std::size_t measIdx = shot * numRounds + round;
162-
syndromeTensor.at({measIdx, col}) = measuresTensor.at({measIdx, col});
158+
for (std::size_t shot = 0; shot < numShots; ++shot) {
159+
for (std::size_t col = 0; col < numCols; ++col) {
160+
std::size_t round = 0;
161+
std::size_t measIdx = shot * numRounds + round;
162+
syndromeTensor.at({measIdx, col}) = measuresTensor.at({measIdx, col});
163+
}
163164
}
164165

165166
// After first round, store syndrome flips

libs/qec/unittests/backend-specific/stim/test_qec_stim.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,7 @@ TEST(QECCodeTester, checkSteaneNoiseStim) {
156156
z_sum += syndromes.at({i, j_z});
157157
}
158158
}
159-
EXPECT_TRUE(x_sum == 0);
159+
EXPECT_TRUE(x_sum > 0);
160160
EXPECT_TRUE(z_sum > 0);
161161
}
162162
{

0 commit comments

Comments
 (0)