Return number of iterations after decoding
This commit is contained in:
parent
066d9d85d2
commit
5fc8435cb4
@ -24,6 +24,8 @@ include_directories(${pybind11_INCLUDE_DIRS})
|
|||||||
|
|
||||||
find_package(OpenMP REQUIRED)
|
find_package(OpenMP REQUIRED)
|
||||||
|
|
||||||
|
add_compile_options(-ffast-math)
|
||||||
|
|
||||||
pybind11_add_module(cpp_decoders src/cpp_decoders.cpp)
|
pybind11_add_module(cpp_decoders src/cpp_decoders.cpp)
|
||||||
target_link_libraries(cpp_decoders PRIVATE Eigen3::Eigen OpenMP::OpenMP_CXX)
|
target_link_libraries(cpp_decoders PRIVATE Eigen3::Eigen OpenMP::OpenMP_CXX)
|
||||||
|
|
||||||
|
|||||||
@ -31,7 +31,7 @@ public:
|
|||||||
Eigen::setNbThreads(8);
|
Eigen::setNbThreads(8);
|
||||||
}
|
}
|
||||||
|
|
||||||
const std::optional<Eigen::RowVectorXi>
|
std::pair<std::optional<Eigen::RowVectorXi>, int>
|
||||||
decode(const Eigen::Ref<const Eigen::VectorXd>& y) {
|
decode(const Eigen::Ref<const Eigen::VectorXd>& y) {
|
||||||
Eigen::RowVectorXd s = Eigen::RowVectorXd::Zero(mH.cols());
|
Eigen::RowVectorXd s = Eigen::RowVectorXd::Zero(mH.cols());
|
||||||
Eigen::RowVectorXi x_hat;
|
Eigen::RowVectorXi x_hat;
|
||||||
@ -49,11 +49,11 @@ public:
|
|||||||
}).cast<int>();
|
}).cast<int>();
|
||||||
|
|
||||||
if (check_parity(x_hat)) {
|
if (check_parity(x_hat)) {
|
||||||
return x_hat;
|
return {x_hat, i + 1};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return std::nullopt;
|
return {std::nullopt, mK};
|
||||||
}
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user