Skip to content

Commit

Permalink
Merge pull request #109 from jdemeyer/master
Browse files Browse the repository at this point in the history
Correctly use relative imports
  • Loading branch information
malb committed Nov 15, 2017
2 parents 691452e + e5a90d4 commit 20a881d
Show file tree
Hide file tree
Showing 31 changed files with 188 additions and 190 deletions.
4 changes: 2 additions & 2 deletions src/fpylll/config.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
include "fpylll/config.pxi"


from fplll.fplll cimport default_strategy as default_strategy_c
from fplll.fplll cimport default_strategy_path as default_strategy_path_c
from .fplll.fplll cimport default_strategy as default_strategy_c
from .fplll.fplll cimport default_strategy_path as default_strategy_path_c

IF HAVE_LONG_DOUBLE:
have_long_double = True
Expand Down
10 changes: 5 additions & 5 deletions src/fpylll/fplll/bkz.pxd
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
# -*- coding: utf-8 -*-

from decl cimport bkz_auto_abort_core_t, fplll_gso_type_t
from decl cimport bkz_reduction_core_t
from gso cimport MatGSO
from bkz_param cimport BKZParam
from lll cimport LLLReduction
from .decl cimport bkz_auto_abort_core_t, fplll_gso_type_t
from .decl cimport bkz_reduction_core_t
from .gso cimport MatGSO
from .bkz_param cimport BKZParam
from .lll cimport LLLReduction

cdef class BKZAutoAbort:
cdef fplll_gso_type_t _type
Expand Down
43 changes: 21 additions & 22 deletions src/fpylll/fplll/bkz.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -10,34 +10,33 @@ include "fpylll/config.pxi"
from cysignals.signals cimport sig_on, sig_off

IF HAVE_QD:
from decl cimport gso_mpz_dd, gso_mpz_qd
from decl cimport gso_long_dd, gso_long_qd
from .decl cimport gso_mpz_dd, gso_mpz_qd
from .decl cimport gso_long_dd, gso_long_qd
from fpylll.qd.qd cimport dd_real, qd_real

from bkz_param cimport BKZParam
from decl cimport gso_mpz_d, gso_mpz_ld, gso_mpz_dpe, gso_mpz_mpfr, vector_fp_nr_t, fp_nr_t
from decl cimport gso_long_d, gso_long_ld, gso_long_dpe, gso_long_mpfr
from fplll cimport BKZAutoAbort as BKZAutoAbort_c
from fplll cimport BKZReduction as BKZReduction_c
from fplll cimport BKZ_MAX_LOOPS, BKZ_MAX_TIME, BKZ_DUMP_GSO, BKZ_DEFAULT
from fplll cimport BKZ_VERBOSE, BKZ_NO_LLL, BKZ_BOUNDED_LLL, BKZ_GH_BND, BKZ_AUTO_ABORT
from fplll cimport BKZ_DEF_AUTO_ABORT_SCALE, BKZ_DEF_AUTO_ABORT_MAX_NO_DEC
from fplll cimport BKZ_DEF_GH_FACTOR, BKZ_DEF_MIN_SUCCESS_PROBABILITY
from fplll cimport BKZ_DEF_RERANDOMIZATION_DENSITY
from fplll cimport BKZ_SD_VARIANT, BKZ_SLD_RED

from fplll cimport FP_NR, Z_NR
from fplll cimport FloatType
from fplll cimport RED_BKZ_LOOPS_LIMIT, RED_BKZ_TIME_LIMIT
from fplll cimport bkz_reduction as bkz_reduction_c
from fplll cimport dpe_t
from fplll cimport get_red_status_str
from fplll cimport ZT_MPZ
from .decl cimport gso_mpz_d, gso_mpz_ld, gso_mpz_dpe, gso_mpz_mpfr, vector_fp_nr_t, fp_nr_t
from .decl cimport gso_long_d, gso_long_ld, gso_long_dpe, gso_long_mpfr
from .fplll cimport BKZAutoAbort as BKZAutoAbort_c
from .fplll cimport BKZReduction as BKZReduction_c
from .fplll cimport BKZ_MAX_LOOPS, BKZ_MAX_TIME, BKZ_DUMP_GSO, BKZ_DEFAULT
from .fplll cimport BKZ_VERBOSE, BKZ_NO_LLL, BKZ_BOUNDED_LLL, BKZ_GH_BND, BKZ_AUTO_ABORT
from .fplll cimport BKZ_DEF_AUTO_ABORT_SCALE, BKZ_DEF_AUTO_ABORT_MAX_NO_DEC
from .fplll cimport BKZ_DEF_GH_FACTOR, BKZ_DEF_MIN_SUCCESS_PROBABILITY
from .fplll cimport BKZ_DEF_RERANDOMIZATION_DENSITY
from .fplll cimport BKZ_SD_VARIANT, BKZ_SLD_RED

from .fplll cimport FP_NR, Z_NR
from .fplll cimport FloatType
from .fplll cimport RED_BKZ_LOOPS_LIMIT, RED_BKZ_TIME_LIMIT
from .fplll cimport bkz_reduction as bkz_reduction_c
from .fplll cimport dpe_t
from .fplll cimport get_red_status_str
from .fplll cimport ZT_MPZ
from fpylll.gmp.mpz cimport mpz_t
from fpylll.mpfr.mpfr cimport mpfr_t
from fpylll.util cimport check_delta, check_precision, check_float_type
from fpylll.util import ReductionError
from integer_matrix cimport IntegerMatrix
from .integer_matrix cimport IntegerMatrix
from fpylll.config import default_strategy, default_strategy_path

cdef class BKZAutoAbort:
Expand Down
12 changes: 6 additions & 6 deletions src/fpylll/fplll/bkz_param.pxd
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
# -*- coding: utf-8 -*-

from libcpp.vector cimport vector
from decl cimport bkz_auto_abort_core_t, fplll_gso_type_t
from gso cimport MatGSO
from fplll cimport BKZParam as BKZParam_c
from fplll cimport PruningParams as PruningParams_c
from fplll cimport Strategy as Strategy_c
from fplll cimport PrunerMetric
from .decl cimport bkz_auto_abort_core_t, fplll_gso_type_t
from .gso cimport MatGSO
from .fplll cimport BKZParam as BKZParam_c
from .fplll cimport PruningParams as PruningParams_c
from .fplll cimport Strategy as Strategy_c
from .fplll cimport PrunerMetric

cdef class Strategy:
cdef Strategy_c _core
Expand Down
28 changes: 14 additions & 14 deletions src/fpylll/fplll/bkz_param.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -9,24 +9,24 @@ include "fpylll/config.pxi"

from cysignals.signals cimport sig_on, sig_off

from fplll cimport BKZParam as BKZParam_c
from fplll cimport BKZ_MAX_LOOPS, BKZ_MAX_TIME, BKZ_DUMP_GSO, BKZ_DEFAULT
from fplll cimport BKZ_VERBOSE, BKZ_NO_LLL, BKZ_BOUNDED_LLL, BKZ_GH_BND, BKZ_AUTO_ABORT
from fplll cimport BKZ_DEF_AUTO_ABORT_SCALE, BKZ_DEF_AUTO_ABORT_MAX_NO_DEC
from fplll cimport BKZ_DEF_GH_FACTOR, BKZ_DEF_MIN_SUCCESS_PROBABILITY
from fplll cimport BKZ_DEF_RERANDOMIZATION_DENSITY
from fplll cimport PRUNER_METRIC_PROBABILITY_OF_SHORTEST
from fplll cimport PRUNER_METRIC_EXPECTED_SOLUTIONS
from fplll cimport LLL_DEF_DELTA
from fplll cimport PruningParams as PruningParams_c
from fplll cimport Strategy as Strategy_c
from fplll cimport load_strategies_json as load_strategies_json_c
from fplll cimport strategy_full_path
from .fplll cimport BKZParam as BKZParam_c
from .fplll cimport BKZ_MAX_LOOPS, BKZ_MAX_TIME, BKZ_DUMP_GSO, BKZ_DEFAULT
from .fplll cimport BKZ_VERBOSE, BKZ_NO_LLL, BKZ_BOUNDED_LLL, BKZ_GH_BND, BKZ_AUTO_ABORT
from .fplll cimport BKZ_DEF_AUTO_ABORT_SCALE, BKZ_DEF_AUTO_ABORT_MAX_NO_DEC
from .fplll cimport BKZ_DEF_GH_FACTOR, BKZ_DEF_MIN_SUCCESS_PROBABILITY
from .fplll cimport BKZ_DEF_RERANDOMIZATION_DENSITY
from .fplll cimport PRUNER_METRIC_PROBABILITY_OF_SHORTEST
from .fplll cimport PRUNER_METRIC_EXPECTED_SOLUTIONS
from .fplll cimport LLL_DEF_DELTA
from .fplll cimport PruningParams as PruningParams_c
from .fplll cimport Strategy as Strategy_c
from .fplll cimport load_strategies_json as load_strategies_json_c
from .fplll cimport strategy_full_path

from fpylll.util cimport check_delta, check_pruner_metric
from cython.operator cimport dereference as deref, preincrement as inc

from pruner cimport PruningParams
from .pruner cimport PruningParams

from collections import OrderedDict
import json
Expand Down
10 changes: 5 additions & 5 deletions src/fpylll/fplll/decl.pxd
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,11 @@ from fpylll.mpfr.mpfr cimport mpfr_t
IF HAVE_QD:
from fpylll.qd.qd cimport dd_real, qd_real

from fplll cimport dpe_t
from fplll cimport Z_NR, FP_NR
from fplll cimport ZZ_mat, MatGSO, LLLReduction, BKZAutoAbort, BKZReduction, Enumeration
from fplll cimport GaussSieve
from fplll cimport FastEvaluator, FastErrorBoundedEvaluator, Pruner
from .fplll cimport dpe_t
from .fplll cimport Z_NR, FP_NR
from .fplll cimport ZZ_mat, MatGSO, LLLReduction, BKZAutoAbort, BKZReduction, Enumeration
from .fplll cimport GaussSieve
from .fplll cimport FastEvaluator, FastErrorBoundedEvaluator, Pruner

from libcpp.vector cimport vector

Expand Down
4 changes: 2 additions & 2 deletions src/fpylll/fplll/enumeration.pxd
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# -*- coding: utf-8 -*-

from decl cimport enumeration_core_t, fast_evaluator_core_t, fplll_gso_type_t
from gso cimport MatGSO
from .decl cimport enumeration_core_t, fast_evaluator_core_t, fplll_gso_type_t
from .gso cimport MatGSO

cdef class Enumeration:
cdef readonly MatGSO M
Expand Down
41 changes: 20 additions & 21 deletions src/fpylll/fplll/enumeration.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -8,33 +8,32 @@ from libcpp.pair cimport pair
from libcpp cimport bool
from cysignals.signals cimport sig_on, sig_off

from gso cimport MatGSO
from fplll cimport EvaluatorStrategy as EvaluatorStrategy_c
from fplll cimport EVALSTRATEGY_BEST_N_SOLUTIONS
from fplll cimport EVALSTRATEGY_FIRST_N_SOLUTIONS
from fplll cimport EVALSTRATEGY_OPPORTUNISTIC_N_SOLUTIONS
from fplll cimport Enumeration as Enumeration_c
from fplll cimport FastEvaluator as FastEvaluator_c
from fplll cimport FastErrorBoundedEvaluator as FastErrorBoundedEvaluator_c
from fplll cimport MatGSO as MatGSO_c
from fplll cimport Z_NR, FP_NR, mpz_t
from fplll cimport EVALMODE_SV

from fplll cimport dpe_t
from .fplll cimport EvaluatorStrategy as EvaluatorStrategy_c
from .fplll cimport EVALSTRATEGY_BEST_N_SOLUTIONS
from .fplll cimport EVALSTRATEGY_FIRST_N_SOLUTIONS
from .fplll cimport EVALSTRATEGY_OPPORTUNISTIC_N_SOLUTIONS
from .fplll cimport Enumeration as Enumeration_c
from .fplll cimport FastEvaluator as FastEvaluator_c
from .fplll cimport FastErrorBoundedEvaluator as FastErrorBoundedEvaluator_c
from .fplll cimport MatGSO as MatGSO_c
from .fplll cimport Z_NR, FP_NR, mpz_t
from .fplll cimport EVALMODE_SV

from .fplll cimport dpe_t
from fpylll.mpfr.mpfr cimport mpfr_t
from decl cimport gso_mpz_d, gso_mpz_ld, gso_mpz_dpe, gso_mpz_mpfr, fp_nr_t
from decl cimport gso_long_d, gso_long_ld, gso_long_dpe, gso_long_mpfr
from decl cimport d_t
from fplll cimport FT_DOUBLE, FT_LONG_DOUBLE, FT_DPE, FT_MPFR, FloatType
from .decl cimport gso_mpz_d, gso_mpz_ld, gso_mpz_dpe, gso_mpz_mpfr, fp_nr_t
from .decl cimport gso_long_d, gso_long_ld, gso_long_dpe, gso_long_mpfr
from .decl cimport d_t
from .fplll cimport FT_DOUBLE, FT_LONG_DOUBLE, FT_DPE, FT_MPFR, FloatType

from fplll cimport multimap
from .fplll cimport multimap

IF HAVE_LONG_DOUBLE:
from decl cimport ld_t
from .decl cimport ld_t

IF HAVE_QD:
from decl cimport gso_mpz_dd, gso_mpz_qd, gso_long_dd, gso_long_qd, dd_t, qd_t
from fplll cimport FT_DD, FT_QD
from .decl cimport gso_mpz_dd, gso_mpz_qd, gso_long_dd, gso_long_qd, dd_t, qd_t
from .fplll cimport FT_DD, FT_QD

class EnumerationError(Exception):
pass
Expand Down
4 changes: 2 additions & 2 deletions src/fpylll/fplll/gso.pxd
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# -*- coding: utf-8 -*-

from integer_matrix cimport IntegerMatrix
from decl cimport mat_gso_core_t, fplll_gso_type_t
from .integer_matrix cimport IntegerMatrix
from .decl cimport mat_gso_core_t, fplll_gso_type_t

cdef class MatGSO:
cdef fplll_gso_type_t _type
Expand Down
32 changes: 16 additions & 16 deletions src/fpylll/fplll/gso.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -20,29 +20,29 @@ include "fpylll/config.pxi"

from cysignals.signals cimport sig_on, sig_off

from decl cimport gso_mpz_d, gso_mpz_ld, gso_mpz_dpe, gso_mpz_mpfr, fp_nr_t, zz_mat_core_t
from decl cimport gso_long_d, gso_long_ld, gso_long_dpe, gso_long_mpfr
from decl cimport d_t
from fplll cimport FT_DOUBLE, FT_LONG_DOUBLE, FT_DPE, FT_MPFR, FloatType
from fplll cimport ZT_LONG, ZT_MPZ, IntType
from fplll cimport GSO_DEFAULT
from fplll cimport GSO_INT_GRAM
from fplll cimport GSO_OP_FORCE_LONG
from fplll cimport GSO_ROW_EXPO
from fplll cimport MatGSO as MatGSO_c, Z_NR, FP_NR, Matrix
from fplll cimport dpe_t
from fplll cimport get_current_slope
from .decl cimport gso_mpz_d, gso_mpz_ld, gso_mpz_dpe, gso_mpz_mpfr, fp_nr_t, zz_mat_core_t
from .decl cimport gso_long_d, gso_long_ld, gso_long_dpe, gso_long_mpfr
from .decl cimport d_t
from .fplll cimport FT_DOUBLE, FT_LONG_DOUBLE, FT_DPE, FT_MPFR, FloatType
from .fplll cimport ZT_LONG, ZT_MPZ, IntType
from .fplll cimport GSO_DEFAULT
from .fplll cimport GSO_INT_GRAM
from .fplll cimport GSO_OP_FORCE_LONG
from .fplll cimport GSO_ROW_EXPO
from .fplll cimport MatGSO as MatGSO_c, Z_NR, FP_NR, Matrix
from .fplll cimport dpe_t
from .fplll cimport get_current_slope
from fpylll.gmp.mpz cimport mpz_t
from fpylll.mpfr.mpfr cimport mpfr_t
from fpylll.util cimport preprocess_indices, check_float_type
from integer_matrix cimport IntegerMatrix
from .integer_matrix cimport IntegerMatrix

IF HAVE_LONG_DOUBLE:
from decl cimport ld_t
from .decl cimport ld_t

IF HAVE_QD:
from decl cimport gso_mpz_dd, gso_mpz_qd, gso_long_dd, gso_long_qd, dd_t, qd_t
from fplll cimport FT_DD, FT_QD
from .decl cimport gso_mpz_dd, gso_mpz_qd, gso_long_dd, gso_long_qd, dd_t, qd_t
from .fplll cimport FT_DD, FT_QD

class MatGSORowOpContext(object):
"""
Expand Down
4 changes: 2 additions & 2 deletions src/fpylll/fplll/integer_matrix.pxd
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
# -*- coding: utf-8 -*-

from fpylll.gmp.types cimport mpz_t
from fplll cimport IntType
from decl cimport zz_mat_core_t
from .fplll cimport IntType
from .decl cimport zz_mat_core_t

cdef class IntegerMatrix:
cdef IntType _type
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,16 +11,16 @@ include "fpylll/config.pxi"
from cpython cimport PyIndex_Check
from cysignals.signals cimport sig_on, sig_off

from fplll cimport Matrix, MatrixRow, 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

from fplll cimport IntType, ZT_MPZ, ZT_LONG, ZZ_mat
from .fplll cimport IntType, ZT_MPZ, ZT_LONG, ZZ_mat

import re
from math import log10, ceil, sqrt, floor

from decl cimport z_long, z_mpz
from .decl cimport z_long, z_mpz
from fpylll.gmp.pylong cimport mpz_get_pyintlong
from fpylll.gmp.mpz cimport mpz_init, mpz_mod, mpz_fdiv_q_ui, mpz_clear, mpz_cmp, mpz_sub, mpz_set, mpz_set_si, mpz_get_si

Expand Down
4 changes: 2 additions & 2 deletions src/fpylll/fplll/lll.pxd
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# -*- coding: utf-8 -*-

from gso cimport MatGSO
from decl cimport lll_reduction_core_t, fplll_gso_type_t
from .gso cimport MatGSO
from .decl cimport lll_reduction_core_t, fplll_gso_type_t

cdef class LLLReduction:

Expand Down
54 changes: 27 additions & 27 deletions src/fpylll/fplll/lll.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -6,42 +6,42 @@ from cysignals.signals cimport sig_on, sig_off

from fpylll.gmp.mpz cimport mpz_t
from fpylll.mpfr.mpfr cimport mpfr_t
from integer_matrix cimport IntegerMatrix

from fplll cimport LLL_VERBOSE
from fplll cimport LLL_EARLY_RED
from fplll cimport LLL_SIEGEL
from fplll cimport LLL_DEFAULT

from fplll cimport LLLMethod, LLL_DEF_ETA, LLL_DEF_DELTA
from fplll cimport LM_WRAPPER, LM_PROVED, LM_HEURISTIC, LM_FAST
from fplll cimport FT_DEFAULT, FT_DOUBLE, FT_LONG_DOUBLE, FT_DD, FT_QD
from fplll cimport ZT_MPZ

from fplll cimport dpe_t
from fplll cimport Z_NR, FP_NR
from fplll cimport lll_reduction as lll_reduction_c
from fplll cimport RED_SUCCESS
from fplll cimport MatGSO as MatGSO_c
from fplll cimport LLLReduction as LLLReduction_c
from fplll cimport get_red_status_str
from fplll cimport is_lll_reduced
from fplll cimport FloatType
from .integer_matrix cimport IntegerMatrix

from .fplll cimport LLL_VERBOSE
from .fplll cimport LLL_EARLY_RED
from .fplll cimport LLL_SIEGEL
from .fplll cimport LLL_DEFAULT

from .fplll cimport LLLMethod, LLL_DEF_ETA, LLL_DEF_DELTA
from .fplll cimport LM_WRAPPER, LM_PROVED, LM_HEURISTIC, LM_FAST
from .fplll cimport FT_DEFAULT, FT_DOUBLE, FT_LONG_DOUBLE, FT_DD, FT_QD
from .fplll cimport ZT_MPZ

from .fplll cimport dpe_t
from .fplll cimport Z_NR, FP_NR
from .fplll cimport lll_reduction as lll_reduction_c
from .fplll cimport RED_SUCCESS
from .fplll cimport MatGSO as MatGSO_c
from .fplll cimport LLLReduction as LLLReduction_c
from .fplll cimport get_red_status_str
from .fplll cimport is_lll_reduced
from .fplll cimport FloatType

from fpylll.util cimport check_float_type, check_delta, check_eta, check_precision
from fpylll.util import ReductionError

from decl cimport d_t
from decl cimport gso_mpz_d, gso_mpz_ld, gso_mpz_dpe, gso_mpz_mpfr
from decl cimport gso_long_d, gso_long_ld, gso_long_dpe, gso_long_mpfr
from .decl cimport d_t
from .decl cimport gso_mpz_d, gso_mpz_ld, gso_mpz_dpe, gso_mpz_mpfr
from .decl cimport gso_long_d, gso_long_ld, gso_long_dpe, gso_long_mpfr

IF HAVE_LONG_DOUBLE:
from decl cimport ld_t
from .decl cimport ld_t

IF HAVE_QD:
from decl cimport gso_mpz_dd, gso_mpz_qd, gso_long_dd, gso_long_qd, dd_t, qd_t
from .decl cimport gso_mpz_dd, gso_mpz_qd, gso_long_dd, gso_long_qd, dd_t, qd_t

from wrapper import Wrapper
from .wrapper import Wrapper

cdef class LLLReduction:
def __init__(self, MatGSO M,
Expand Down

0 comments on commit 20a881d

Please sign in to comment.