From 5fc8435cb4f02d6d1e43b00de6ca1e648b7360d6 Mon Sep 17 00:00:00 2001 From: Andreas Tsouchlos Date: Fri, 25 Nov 2022 15:39:41 +0100 Subject: [PATCH] Return number of iterations after decoding --- sw/cpp/CMakeLists.txt | 2 ++ sw/cpp/src/cpp_decoders.cpp | 6 +++--- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/sw/cpp/CMakeLists.txt b/sw/cpp/CMakeLists.txt index f1ef167..3833598 100644 --- a/sw/cpp/CMakeLists.txt +++ b/sw/cpp/CMakeLists.txt @@ -24,6 +24,8 @@ include_directories(${pybind11_INCLUDE_DIRS}) find_package(OpenMP REQUIRED) +add_compile_options(-ffast-math) + pybind11_add_module(cpp_decoders src/cpp_decoders.cpp) target_link_libraries(cpp_decoders PRIVATE Eigen3::Eigen OpenMP::OpenMP_CXX) diff --git a/sw/cpp/src/cpp_decoders.cpp b/sw/cpp/src/cpp_decoders.cpp index bb519bf..4d3259d 100644 --- a/sw/cpp/src/cpp_decoders.cpp +++ b/sw/cpp/src/cpp_decoders.cpp @@ -31,7 +31,7 @@ public: Eigen::setNbThreads(8); } - const std::optional + std::pair, int> decode(const Eigen::Ref& y) { Eigen::RowVectorXd s = Eigen::RowVectorXd::Zero(mH.cols()); Eigen::RowVectorXi x_hat; @@ -49,11 +49,11 @@ public: }).cast(); if (check_parity(x_hat)) { - return x_hat; + return {x_hat, i + 1}; } } - return std::nullopt; + return {std::nullopt, mK}; } private: