Skip to content

Commit

Permalink
update to current FPLLL API
Browse files Browse the repository at this point in the history
  • Loading branch information
malb committed Nov 11, 2017
1 parent e15afa2 commit 5a1f3f0
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
4 changes: 3 additions & 1 deletion src/fpylll/fplll/fplll.pxd
Original file line number Diff line number Diff line change
Expand Up @@ -321,6 +321,9 @@ cdef extern from "fplll/nr/matrix.h" namespace "fplll":
void addmul_si_2exp(const MatrixRow[T]& v, long x, long expo, T& tmp) nogil
void addmul_si_2exp(const MatrixRow[T]& v, long x, long expo, int n, T& tmp) nogil

void dot_product(T &result, const MatrixRow[T] &v0) nogil
void dot_product(T &result, const MatrixRow[T] &v0, int n) nogil

void dot_product[T](T& result, const MatrixRow[T]& v1, const MatrixRow[T]& v2, int n) nogil
void dot_product[T](T& result, const MatrixRow[T]& v1, const MatrixRow[T]& v2) nogil

Expand Down Expand Up @@ -734,7 +737,6 @@ cdef extern from "fplll/util.h" namespace "fplll":
vector[Z_NR[mpz_t]] &x,
const ZZ_mat[mpz_t] &m) nogil

void sqr_norm[T](T& result, const MatrixRow[T]& v, int n) nogil



Expand Down
6 changes: 3 additions & 3 deletions src/fpylll/fplll/integer_matrix.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ include "fpylll/config.pxi"
from cpython cimport PyIndex_Check
from cysignals.signals cimport sig_on, sig_off

from fplll cimport Matrix, MatrixRow, sqr_norm, Z_NR
from fplll cimport Matrix, MatrixRow, Z_NR
from fpylll.util cimport preprocess_indices, check_int_type
from fpylll.io cimport assign_Z_NR_mpz, assign_mpz, mpz_get_python

Expand Down Expand Up @@ -126,10 +126,10 @@ cdef class IntegerMatrixRow:

# TODO: don't just use doubles
if self.m._type == ZT_MPZ:
sqr_norm[Z_NR[mpz_t]](t_mpz, self.m._core.mpz[0][self.row], self.m._ncols())
self.m._core.mpz[0][self.row].dot_product(t_mpz, self.m._core.mpz[0][self.row])
return sqrt(t_mpz.get_d())
elif self.m._type == ZT_LONG:
sqr_norm[Z_NR[long]](t_l, self.m._core.long[0][self.row], self.m._ncols())
self.m._core.long[0][self.row].dot_product(t_l, self.m._core.long[0][self.row])
return sqrt(t_l.get_d())
else:
raise RuntimeError("Integer type '%s' not understood."%self._m._type)
Expand Down

0 comments on commit 5a1f3f0

Please sign in to comment.