Made cpp proximal decoder pickling compile

This commit is contained in:
Andreas Tsouchlos 2022-12-01 01:26:26 +01:00
parent 7c6962bf65
commit 0705fbbcaf
2 changed files with 9 additions and 7 deletions

View File

@ -106,7 +106,7 @@ public:
* @return \b std::tuple * @return \b std::tuple
*/ */
auto get_decoder_state() const { auto get_decoder_state() const {
return std::tuple(mK, mOmega, mGamma, mEta, mH); return std::tuple(mH, mK, mOmega, mGamma, mEta);
} }
private: private:

View File

@ -17,12 +17,14 @@ using namespace pybind11::literals;
.def("decode", &ProximalDecoder<m, n>::decode, "x"_a.noconvert()) \ .def("decode", &ProximalDecoder<m, n>::decode, "x"_a.noconvert()) \
.def(py::pickle( \ .def(py::pickle( \
[](const ProximalDecoder<m, n>& a) { \ [](const ProximalDecoder<m, n>& a) { \
MatrixiR<m, n> H; \ auto state = a.get_decoder_state(); \
int K; \ \
double omega; \ MatrixiR<m, n> H = std::get<0>(state); \
double gamma; \ int K = std::get<1>(state); \
double eta; \ double omega = std::get<2>(state); \
std::tie(H, K, omega, gamma, eta) = a.get_decoder_state(); \ double gamma = std::get<3>(state); \
double eta = std::get<4>(state); \
\
return py::make_tuple(H, K, omega, gamma, eta); \ return py::make_tuple(H, K, omega, gamma, eta); \
}, \ }, \
[](py::tuple t) { \ [](py::tuple t) { \