Skip to content

Commit 0c7ef21

Browse files
authored
Update API name: decode_multi to decode_batch (#102)
Signed-off-by: Melody Ren <[email protected]>
1 parent 893b924 commit 0c7ef21

File tree

6 files changed

+8
-8
lines changed

6 files changed

+8
-8
lines changed

docs/sphinx/components/qec/introduction.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -500,7 +500,7 @@ The decoder base class defines the core interface for syndrome decoding:
500500
virtual decoder_result decode(
501501
const std::vector<float_t>& syndrome) = 0;
502502
503-
virtual std::vector<decoder_result> decode_multi(
503+
virtual std::vector<decoder_result> decode_batch(
504504
const std::vector<std::vector<float_t>>& syndrome);
505505
};
506506

libs/qec/include/cudaq/qec/decoder.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,7 @@ class decoder
126126
/// @returns 2-D vector of size `N` x `block_size` with soft probabilities of
127127
/// errors in each index.
128128
virtual std::vector<decoder_result>
129-
decode_multi(const std::vector<std::vector<float_t>> &syndrome);
129+
decode_batch(const std::vector<std::vector<float_t>> &syndrome);
130130

131131
/// @brief This `get` overload supports default values.
132132
static std::unique_ptr<decoder>

libs/qec/lib/decoder.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ decoder_result decoder::decode(const cudaqx::tensor<uint8_t> &syndrome) {
4646
// Provide a trivial implementation of the multi-syndrome decoder. Child classes
4747
// should override this if they can do it more efficiently than this.
4848
std::vector<decoder_result>
49-
decoder::decode_multi(const std::vector<std::vector<float_t>> &syndrome) {
49+
decoder::decode_batch(const std::vector<std::vector<float_t>> &syndrome) {
5050
std::vector<decoder_result> result;
5151
result.reserve(syndrome.size());
5252
for (auto &s : syndrome)

libs/qec/python/bindings/py_decoder.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -157,10 +157,10 @@ void bindDecoder(py::module &mod) {
157157
},
158158
"Asynchronously decode the given syndrome", py::arg("syndrome"))
159159
.def(
160-
"decode_multi",
160+
"decode_batch",
161161
[](decoder &decoder,
162162
const std::vector<std::vector<float_t>> &syndrome) {
163-
return decoder.decode_multi(syndrome);
163+
return decoder.decode_batch(syndrome);
164164
},
165165
"Decode multiple syndromes and return the results",
166166
py::arg("syndrome"))

libs/qec/python/tests/test_decoder.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,9 +30,9 @@ def test_decoder_initialization():
3030

3131

3232
def test_decoder_api():
33-
# Test decode_multi
33+
# Test decode_batch
3434
decoder = qec.get_decoder('example_byod', H)
35-
result = decoder.decode_multi(
35+
result = decoder.decode_batch(
3636
[create_test_syndrome(), create_test_syndrome()])
3737
assert len(result) == 2
3838
for r in result:

libs/qec/unittests/test_decoders.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ TEST(SampleDecoder, checkAPI) {
8787
// Test the move constructor and move assignment operator
8888

8989
// Multi test
90-
auto dec_results = d->decode_multi({syndromes, syndromes});
90+
auto dec_results = d->decode_batch({syndromes, syndromes});
9191
ASSERT_EQ(dec_results.size(), 2);
9292
for (auto &m : dec_results)
9393
for (auto x : m.result)

0 commit comments

Comments
 (0)