template <class ZT, class FT> void MatHouseholder<ZT, FT>::swap(int i, int j) { FPLLL_DEBUG_CHECK(0 <= i && i < j && j < d); // Invalidate to the min not modified row, that is i invalidate_row(i); b.swap_rows(i, j); bf.swap_rows(i, j); iter_swap(sigma.begin() + i, sigma.begin() + j); if (enable_row_expo) iter_swap(row_expo.begin() + i, row_expo.begin() + j); iter_swap(init_row_size.begin() + i, init_row_size.begin() + j); iter_swap(R_history.begin() + i, R_history.begin() + j); if (enable_transform) { u.swap_rows(i, j); if (enable_inverse_transform) u_inv_t.swap_rows(i, j); } iter_swap(norm_square_b.begin() + i, norm_square_b.begin() + j); iter_swap(expo_norm_square_b.begin() + i, expo_norm_square_b.begin() + j); #ifdef DEBUG iter_swap(col_kept.begin() + i, col_kept.begin() + j); #endif // DEBUG }
void menu::invalidate_row_pos(size_t pos) { if(pos >= items_.size()) { return; } invalidate_row(items_[pos].id); }
bool MatHouseholder<ZT, FT>::size_reduce(int k, int size_reduction_end, int size_reduction_start) { FPLLL_DEBUG_CHECK(k > 0 && k < d); bool reduced = false; for (int i = size_reduction_end - 1; i >= size_reduction_start; i--) { // R(k, i) / R(i, i) = ftmp1 * 2^(row_expo[k] - row_expo[i]) #ifndef HOUSEHOLDER_PRECOMPUTE_INVERSE ftmp1.div(R(k, i), R(i, i)); #else // HOUSEHOLDER_PRECOMPUTE_INVERSE ftmp1.mul(R(k, i), R_inverse_diag[i]); #endif // HOUSEHOLDER_PRECOMPUTE_INVERSE /* If T = mpfr or dpe, enable_row_expo must be false and then, expo1 - expo0 == 0 (required by * rnd_we with these types) */ // rnd(R(k, i) / R(i, i)) = ftmp1 * 2^(row_expo[k] - row_expo[i]) ftmp1.rnd_we(ftmp1, row_expo[k] - row_expo[i]); // ftmp1 * 2^(expo1 - expo0) is equal to -X[i] in Algorithm 3 of [MSV, ISSAC'09] ftmp1.neg(ftmp1); if (ftmp1.sgn() != 0) // Equivalent to test if ftmp1 == 0 { // b[k] will be reduced by ftmp1 * 2^(row_expo[k] - row_expo[i]) * b[i] row_addmul_we(k, i, ftmp1, row_expo[k] - row_expo[i]); // b[k] was reduced reduced = true; } } // b[k] was reduced by at least one b[i] if (reduced) { #ifdef DEBUG // b[k] has changed col_kept[k] = false; #endif // DEBUG // Invalidate since b has changed, but R is not recomputed. We do operations on R[k], but not // the one to get the correct R[k]: the operations are the one mentionned in line 5 of // Algorithm 3 [MSV, ISSAC'09]. invalidate_row(k); } return reduced; }