void RaptorQ__v1::Impl::Operation_Reorder::build_mtx ( RaptorQ__v1::Impl::DenseMtx &mtx) const { uint16_t overhead = static_cast<uint16_t> ( static_cast<uint16_t> (mtx.rows()) - _order.size()); DenseMtx ret = DenseMtx (mtx.rows() - overhead , mtx.cols()); // reorder some of the lines as requested by the _order vector uint16_t row = 0; for (const uint16_t pos : _order) ret.row (pos) = mtx.row (row++); mtx = ret; // other lines will not influence the computation, ignore them }
void Precode_Matrix::gen (const uint32_t repair_overhead) { _repair_overhead = repair_overhead; A = DenseMtx (_params.L + repair_overhead, _params.L); init_LDPC1 (_params.S, _params.B); add_identity (_params.S, 0, _params.B); init_LDPC2 (_params.W, _params.S, _params.P); init_HDPC (); add_identity (_params.H, _params.S, _params.L - _params.H); add_G_ENC (); // G_ENC only fills up to L rows, but we might have overhead. // initialize it. for (uint16_t row = _params.L; row < A.rows(); ++row) { for (uint16_t col = 0; col < A.cols(); ++col) A(row, col) = 0; } }
DenseMtx Precode_Matrix::make_GAMMA() const { // rfc 6330, pg 24 DenseMtx GAMMA = DenseMtx (_params.K_padded + _params.S, _params.K_padded + _params.S); for (uint16_t row = 0; row < GAMMA.rows(); ++row) { uint16_t col; for (col = 0; col <= row; ++col) // alpha ^^ (i-j), as in rfc6330, pg24 // rfc only says "i-j", but we could go well over oct_exp size. // we hope they just missed a modulus :/ GAMMA (row, col) = RaptorQ::Impl::oct_exp[(row - col) % RaptorQ::Impl::oct_exp.size()]; for (; col < GAMMA.cols(); ++col) { GAMMA (row, col) = 0; } } return GAMMA; }
DenseMtx Precode_Matrix::make_MT() const { // rfc 6330, pg 24 Rand rnd; DenseMtx MT = DenseMtx (_params.H, _params.K_padded + _params.S); for (uint16_t row = 0; row < MT.rows(); ++row) { uint16_t col; for (col = 0; col < MT.cols() - 1; ++col) { auto tmp = rnd.get (col + 1, 6, _params.H); if ((row == tmp) || (row == (tmp + rnd.get (col + 1, 7, _params.H - 1) + 1) % _params.H)) { MT (row, col) = 1; } else { MT (row, col) = 0; } } // last column: alpha ^^ i, as in rfc6330 MT (row, col) = RaptorQ::Impl::oct_exp[row]; } return MT; }