19#ifndef FPLLL_GSOGRAM_H
20#define FPLLL_GSOGRAM_H
79 throw std::invalid_argument(
"flags must be equal to GSO_INT_GRAM");
84 throw std::runtime_error(
"Error: gptr is equal to the nullpointer.");
90 row_op_first = row_op_last = -1;
112 virtual void move_row(
int old_r,
int new_r);
114 virtual void row_addmul_we(
int i,
int j,
const FT &x,
long expo_add);
117 virtual void row_add(
int i,
int j);
118 virtual void row_sub(
int i,
int j);
124 virtual inline FT &
get_gram(FT &f,
int i,
int j);
129 virtual void row_swap(
int i,
int j);
134 virtual void size_increased();
136 virtual void discover_row();
140 virtual void update_bf(
int i);
142 virtual void invalidate_gram_row(
int i);
145 virtual void row_addmul_si(
int i,
int j,
long x);
148 virtual void row_addmul_si_2exp(
int i,
int j,
long x,
long expo);
149 virtual void row_addmul_2exp(
int i,
int j,
const ZT &x,
long expo);
153template <
class ZT,
class FT>
161 for (
int i = 0; i < g.
get_cols(); i++)
163 ztmp1.mul(tmpvec[i], coordinates[i]);
164 sqnorm.add(sqnorm, ztmp1);
173 throw std::runtime_error(
"Error: gptr is equal to the nullpointer.");
187 throw std::runtime_error(
"Error: gptr is equal to the nullpointer.");
193 return g[i][i].is_zero();
199 throw std::runtime_error(
"Error: gptr is equal to the nullpointer.");
204 return gptr->get_cols();
211 throw std::runtime_error(
"Error: gptr is equal to the nullpointer.");
216 return gptr->get_rows();
224 for (
int j = 0; j < get_rows_of_b(); j++)
228 sym_g(i, j).neg(sym_g(i, j));
236 FPLLL_DEBUG_CHECK(i >= 0 && i < n_known_rows && j >= 0 && j <= i && j < n_source_rows &&
237 !in_row_op_range(i));
242 throw std::runtime_error(
"Error: gptr is equal to the nullpointer.");
244 f.set_z((*gptr)(i, j));
251 FPLLL_DEBUG_CHECK(i >= 0 && i < n_known_rows && j >= 0 && j <= i && j < n_source_rows &&
252 !in_row_op_range(i));
257 throw std::runtime_error(
"Error: gptr is equal to the nullpointer.");
268 n_known_rows = min(n_known_rows, d);
269 n_source_rows = n_known_rows;
270 if (enable_transform)
280 if (enable_transform)
283 for (
int i = old_d; i < d; i++)
284 for (
int j = 0; j < u.get_cols(); j++)
288 if (n_known_rows == old_d)
Definition: gso_gram.h:35
virtual void create_rows(int n_new_rows)
Definition: gso_gram.h:274
virtual void remove_last_rows(int n_removed_rows)
Definition: gso_gram.h:264
virtual void move_row(int old_r, int new_r)
Definition: gso_gram.cpp:283
virtual int get_cols_of_b() const
Definition: gso_gram.h:195
virtual bool b_row_is_zero(int i)
Definition: gso_gram.h:183
virtual void row_swap(int i, int j)
Definition: gso_gram.cpp:254
virtual int get_rows_of_b() const
Definition: gso_gram.h:207
MatGSOGram(Matrix< ZT > &arg_g, Matrix< ZT > &arg_u, Matrix< ZT > &arg_uinv_t, int flags=GSO_INT_GRAM)
Definition: gso_gram.h:74
virtual void row_add(int i, int j)
Definition: gso_gram.cpp:51
virtual void negate_row_of_b(int i)
Definition: gso_gram.h:219
virtual long get_max_exp_of_b()
Definition: gso_gram.h:169
virtual void row_addmul_we(int i, int j, const FT &x, long expo_add)
Definition: gso_gram.cpp:228
virtual FT & get_gram(FT &f, int i, int j)
Definition: gso_gram.h:234
virtual ZT & get_int_gram(ZT &z, int i, int j)
Definition: gso_gram.h:249
virtual ZT & sqnorm_coordinates(ZT &sqnorm, vector< ZT > coordinates)
Definition: gso_gram.h:154
virtual void row_sub(int i, int j)
Definition: gso_gram.cpp:80
Definition: gso_interface.h:60
int alloc_dim
Definition: gso_interface.h:558
bool cols_locked
Definition: gso_interface.h:557
vector< int > gso_valid_cols
Definition: gso_interface.h:605
const bool enable_int_gram
Definition: gso_interface.h:480
Matrix< FT > mu
Definition: gso_interface.h:572
FT & get_r(FT &f, int i, int j)
Definition: gso_interface.h:721
const bool enable_inverse_transform
Definition: gso_interface.h:493
bool update_gso()
Definition: gso_interface.h:764
int n_known_rows
Definition: gso_interface.h:554
void invalidate_gso_row(int i, int new_valid_cols=0)
Definition: gso_interface.cpp:26
int n_source_rows
Definition: gso_interface.h:555
bool update_gso_row(int i, int last_j)
Definition: gso_interface.cpp:131
Matrix< ZT > * gptr
Definition: gso_interface.h:597
void remove_last_row()
Definition: gso_interface.h:753
void discover_all_rows()
Definition: gso_interface.h:758
FT & get_mu(FT &f, int i, int j)
Definition: gso_interface.h:691
ZT ztmp1
Definition: gso_interface.h:611
Matrix< ZT > & u_inv_t
Definition: gso_interface.h:548
const bool row_op_force_long
Definition: gso_interface.h:499
int d
Definition: gso_interface.h:114
void create_row()
Definition: gso_interface.h:751
Matrix< FT > r
Definition: gso_interface.h:586
void print_mu_r_g(ostream &os)
Definition: gso_interface.h:645
void symmetrize_g()
Definition: gso_interface.h:629
ZT & sym_g(int i, int j)
Definition: gso_interface.h:661
const bool enable_transform
Definition: gso_interface.h:486
Matrix< ZT > & u
Definition: gso_interface.h:547
ZT ztmp2
Definition: gso_interface.h:613
int get_cols() const
Definition: matrix.h:156
int get_rows() const
Definition: matrix.h:154
long get_max_exp()
Definition: matrix.cpp:127
#define FPLLL_END_NAMESPACE
Definition: defs.h:117
#define FPLLL_DEBUG_CHECK(x)
Definition: defs.h:109
#define FPLLL_BEGIN_NAMESPACE
Definition: defs.h:114
@ GSO_INT_GRAM
Definition: gso_interface.h:29
void vector_matrix_product(vector< ZT > &result, const vector< ZT > &x, const Matrix< ZT > &m)
Definition: util.h:41