Skip to content

Commit 3c8a224

Browse files
committed
lint
Signed-off-by: Kevin Mato <[email protected]>
1 parent 56b61d5 commit 3c8a224

File tree

3 files changed

+21
-23
lines changed

3 files changed

+21
-23
lines changed

libs/qec/include/cudaq/qec/experiments.h

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -61,27 +61,27 @@ std::tuple<cudaqx::tensor<uint8_t>, cudaqx::tensor<uint8_t>>
6161
sample_code_capacity(const code &code, std::size_t numShots,
6262
double error_probability);
6363

64-
/// @brief Sample measurements from a check matrix with per-mechanism error probabilities
64+
/// @brief Sample measurements from a check matrix with per-mechanism error
65+
/// probabilities
6566
/// @param check_matrix Binary matrix [num_checks × num_error_mechanisms]
6667
/// @param numShots Number of measurement shots
6768
/// @param error_probabilities Per-error-mechanism probabilities
68-
/// @return Tuple of check measurements [numShots × num_checks] and error occurrences [numShots × num_error_mechanisms]
69+
/// @return Tuple of check measurements [numShots × num_checks] and error
70+
/// occurrences [numShots × num_error_mechanisms]
6971
std::tuple<cudaqx::tensor<uint8_t>, cudaqx::tensor<uint8_t>>
70-
dem_sampling(const cudaqx::tensor<uint8_t> &check_matrix,
71-
std::size_t numShots,
72+
dem_sampling(const cudaqx::tensor<uint8_t> &check_matrix, std::size_t numShots,
7273
const std::vector<double> &error_probabilities);
7374

7475
/// @brief Sample measurements from a check matrix with seed
7576
/// @param check_matrix Binary matrix [num_checks × num_error_mechanisms]
7677
/// @param numShots Number of measurement shots
7778
/// @param error_probabilities Per-error-mechanism probabilities
7879
/// @param seed RNG seed for reproducible experiments
79-
/// @return Tuple of check measurements [numShots × num_checks] and error occurrences [numShots × num_error_mechanisms]
80+
/// @return Tuple of check measurements [numShots × num_checks] and error
81+
/// occurrences [numShots × num_error_mechanisms]
8082
std::tuple<cudaqx::tensor<uint8_t>, cudaqx::tensor<uint8_t>>
81-
dem_sampling(const cudaqx::tensor<uint8_t> &check_matrix,
82-
std::size_t numShots,
83-
const std::vector<double> &error_probabilities,
84-
unsigned seed);
83+
dem_sampling(const cudaqx::tensor<uint8_t> &check_matrix, std::size_t numShots,
84+
const std::vector<double> &error_probabilities, unsigned seed);
8585

8686
/// @brief Sample syndrome measurements with circuit-level noise
8787
/// @param statePrep Initial state preparation operation

libs/qec/lib/experiments.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -131,14 +131,14 @@ std::tuple<cudaqx::tensor<uint8_t>, cudaqx::tensor<uint8_t>>
131131
dem_sampling(const cudaqx::tensor<uint8_t> &check_matrix, std::size_t nShots,
132132
const std::vector<double> &error_probabilities) {
133133
return details::__dem_sampling(check_matrix, nShots, error_probabilities,
134-
std::random_device()());
134+
std::random_device()());
135135
}
136136

137137
std::tuple<cudaqx::tensor<uint8_t>, cudaqx::tensor<uint8_t>>
138138
dem_sampling(const cudaqx::tensor<uint8_t> &check_matrix, std::size_t nShots,
139139
const std::vector<double> &error_probabilities, unsigned seed) {
140140
return details::__dem_sampling(check_matrix, nShots, error_probabilities,
141-
seed);
141+
seed);
142142
}
143143

144144
std::tuple<cudaqx::tensor<uint8_t>, cudaqx::tensor<uint8_t>>

libs/qec/unittests/test_qec.cpp

Lines changed: 10 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -587,9 +587,9 @@ TEST(QECCodeTester, checkDemSampling) {
587587
// Create a simple check matrix [3 checks x 5 error mechanisms]
588588
cudaqx::tensor<uint8_t> check_matrix({3, 5});
589589
std::vector<uint8_t> matrix_data = {
590-
1, 0, 1, 0, 0, // check 0 triggered by errors 0, 2
591-
0, 1, 1, 0, 0, // check 1 triggered by errors 1, 2
592-
0, 0, 0, 1, 1 // check 2 triggered by errors 3, 4
590+
1, 0, 1, 0, 0, // check 0 triggered by errors 0, 2
591+
0, 1, 1, 0, 0, // check 1 triggered by errors 1, 2
592+
0, 0, 0, 1, 1 // check 2 triggered by errors 3, 4
593593
};
594594
check_matrix.copy(matrix_data.data(), check_matrix.shape());
595595

@@ -602,9 +602,9 @@ TEST(QECCodeTester, checkDemSampling) {
602602

603603
// Validate shapes
604604
EXPECT_EQ(nShots, checks.shape()[0]);
605-
EXPECT_EQ(3, checks.shape()[1]); // 3 checks
605+
EXPECT_EQ(3, checks.shape()[1]); // 3 checks
606606
EXPECT_EQ(nShots, errors.shape()[0]);
607-
EXPECT_EQ(5, errors.shape()[1]); // 5 error mechanisms
607+
EXPECT_EQ(5, errors.shape()[1]); // 5 error mechanisms
608608

609609
// Verify determinism with same seed
610610
auto [checks2, errors2] =
@@ -624,8 +624,7 @@ TEST(QECCodeTester, checkDemSampling) {
624624
for (size_t check = 0; check < 3; ++check) {
625625
uint8_t expected = 0;
626626
for (size_t err = 0; err < 5; ++err) {
627-
expected ^=
628-
(errors.at({shot, err}) & check_matrix.at({check, err}));
627+
expected ^= (errors.at({shot, err}) & check_matrix.at({check, err}));
629628
}
630629
EXPECT_EQ(expected, checks.at({shot, check}));
631630
}
@@ -684,16 +683,15 @@ TEST(QECCodeTester, checkDemSampling) {
684683
std::vector<uint8_t> matrix_data = {1, 0, 1, 0, 1, 1};
685684
check_matrix.copy(matrix_data.data(), check_matrix.shape());
686685

687-
std::vector<double> wrong_size_probs = {0.1, 0.2}; // Should be size 3
686+
std::vector<double> wrong_size_probs = {0.1, 0.2}; // Should be size 3
688687

689-
EXPECT_THROW(
690-
cudaq::qec::dem_sampling(check_matrix, 10, wrong_size_probs),
691-
std::invalid_argument);
688+
EXPECT_THROW(cudaq::qec::dem_sampling(check_matrix, 10, wrong_size_probs),
689+
std::invalid_argument);
692690
}
693691

694692
// Test error: non-rank-2 matrix
695693
{
696-
cudaqx::tensor<uint8_t> bad_matrix({5}); // rank-1
694+
cudaqx::tensor<uint8_t> bad_matrix({5}); // rank-1
697695
std::vector<uint8_t> matrix_data = {1, 0, 1, 0, 1};
698696
bad_matrix.copy(matrix_data.data(), bad_matrix.shape());
699697

0 commit comments

Comments
 (0)