00001 // Copyright (C) 2011 CNRS - Ecole Polytechnique - INRIA. 00002 // 00003 // This file is part of TIFA. 00004 // 00005 // TIFA is free software; you can redistribute it and/or modify it under the 00006 // terms of the GNU Lesser General Public License as published by the Free 00007 // Software Foundation; either version 2.1 of the License, or (at your option) 00008 // any later version. 00009 // 00010 // TIFA is distributed in the hope that it will be useful, but WITHOUT ANY 00011 // WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS 00012 // FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for 00013 // more details. 00014 // 00015 // You should have received a copy of the GNU Lesser General Public License 00016 // along with this library; if not, write to the Free Software Foundation, 00017 // Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. 00018 00028 #if !defined(_TIFA_SIQS_H_) 00029 00033 #define _TIFA_SIQS_H_ 00034 00035 #ifdef __cplusplus 00036 extern "C" { 00037 #endif 00038 00039 #include <stdbool.h> 00040 #include <inttypes.h> 00041 #include <gmp.h> 00042 00043 #include "array.h" 00044 #include "lindep.h" 00045 #include "factoring_machine.h" 00046 #include "exit_codes.h" 00047 00052 #define SIQS_DFLT_SIEVE_HALF_WIDTH 500000 00053 00058 #define SIQS_DFLT_NPRIMES_IN_BASE NFIRST_PRIMES/16 00059 00064 #define SIQS_DFLT_NPRIMES_TDIV NFIRST_PRIMES/16 00065 00070 #define SIQS_DFLT_NRELATIONS 24 00071 00075 #define SIQS_DFLT_LINALG_METHOD SMART_GAUSS_ELIM 00076 00080 #define SIQS_DFLT_USE_LARGE_PRIMES true 00081 00089 struct struct_siqs_params_t { 00094 uint32_t sieve_half_width; 00099 uint32_t nprimes_in_base; 00103 uint32_t threshold; 00111 uint32_t nprimes_tdiv; 00116 uint32_t nrelations; 00120 linalg_method_t linalg_method; 00125 bool use_large_primes; 00126 }; 00127 00132 typedef struct struct_siqs_params_t siqs_params_t; 00133 00142 void set_siqs_params_to_default(const mpz_t n, siqs_params_t* const params); 00143 00175 ecode_t siqs( 00176 mpz_array_t* const factors, 00177 uint32_array_t* const multis, 00178 const mpz_t n, 00179 const siqs_params_t* const params, 00180 const factoring_mode_t mode 00181 ); 00182 00183 #ifdef __cplusplus 00184 } 00185 #endif 00186 00187 #endif