#include <stdint.h>
#include <stdbool.h>
#include <gmp.h>
#include "exit_codes.h"
#include "array.h"
#include "approx.h"
#include "buckets.h"
#include "siqs_poly.h"
#include "stopwatch.h"
Go to the source code of this file.
Data Structures | |
struct | struct_siqs_sieve_t |
Defines the sieve used by SIQS. More... | |
Typedefs | |
typedef struct struct_siqs_sieve_t | siqs_sieve_t |
Equivalent to struct_siqs_sieve_t . | |
Functions | |
siqs_sieve_t * | alloc_siqs_sieve (mpz_t n, uint32_array_t *const factor_base, byte_array_t *const log_primes, uint32_array_t *const sqrtm_pi, uint32_t half_width) |
Allocates and returns a new siqs_sieve_t . | |
void | free_siqs_sieve (siqs_sieve_t *sieve) |
Frees a previously allocated siqs_sieve_t . | |
ecode_t | fill_sieve (siqs_sieve_t *const sieve) |
Fills the next chunk of an siqs_sieve_t . | |
ecode_t | scan_sieve (siqs_sieve_t *const sieve, int32_array_t *const survivors, uint32_t nsurvivors) |
Scans a chunk of an siqs_sieve_t . | |
void | set_siqs_sieve_threshold (siqs_sieve_t *const sieve, uint32_t threshold) |
Sets the siqs_sieve_t 's threshold. | |
void | print_init_poly_timing (siqs_sieve_t *const sieve) |
Prints an siqs_sieve_t 's poly init timing. | |
void | print_fill_timing (siqs_sieve_t *const sieve) |
Prints an siqs_sieve_t 's fill timing. | |
void | print_scan_timing (siqs_sieve_t *const sieve) |
Prints an siqs_sieve_t 's scan timing. |
Definition in file siqs_sieve.h.
siqs_sieve_t* alloc_siqs_sieve | ( | mpz_t | n, | |
uint32_array_t *const | factor_base, | |||
byte_array_t *const | log_primes, | |||
uint32_array_t *const | sqrtm_pi, | |||
uint32_t | half_width | |||
) |
Allocates and returns a new siqs_sieve_t
.
n | the number to factor (or a small multiple) | |
factor_base | the factor base | |
log_primes | logarithms (in base 2) of the primes in the base | |
sqrtm_pi | modular square roots of n for each prime in the base | |
half_width | the (approximate) half_width of the sieving interval (the real half_width will be adjusted to be a multiple of chunk_size if ROUND_HALF_WIDTH is defined as non zero) |
siqs_sieve_t
. ecode_t fill_sieve | ( | siqs_sieve_t *const | sieve | ) |
Fills the next chunk of an siqs_sieve_t
.
Fills the next chunk of sieve
, transparently updating (if needed) the polynomial used.
sieve | the siqs_sieve_t to fill. |
void free_siqs_sieve | ( | siqs_sieve_t * | sieve | ) |
Frees a previously allocated siqs_sieve_t
.
Frees all memory used by the pointed siqs_sieve_t
and then frees the sieve
pointer.
free(sieve)
in client code after a call to free_siqs_sieve(sieve)
: it would result in an error.sieve | the siqs_sieve_t to free. |
void print_fill_timing | ( | siqs_sieve_t *const | sieve | ) |
Prints an siqs_sieve_t
's fill timing.
Prints the time taken by sieve
to fill its sieve chunks.
sieve | the siqs_sieve_t to read. |
void print_init_poly_timing | ( | siqs_sieve_t *const | sieve | ) |
Prints an siqs_sieve_t
's poly init timing.
Prints the time taken by sieve
to initialize its polynomials.
sieve | the siqs_sieve_t to read. |
void print_scan_timing | ( | siqs_sieve_t *const | sieve | ) |
Prints an siqs_sieve_t
's scan timing.
Prints the time taken by sieve
to scan its sieve chunks.
sieve | the siqs_sieve_t to read. |
ecode_t scan_sieve | ( | siqs_sieve_t *const | sieve, | |
int32_array_t *const | survivors, | |||
uint32_t | nsurvivors | |||
) |
Scans a chunk of an siqs_sieve_t
.
Scans the last filled chunk of sieve
.
sieve | the siqs_sieve_t to scan. |
void set_siqs_sieve_threshold | ( | siqs_sieve_t *const | sieve, | |
uint32_t | threshold | |||
) |
Sets the siqs_sieve_t
's threshold.
Sets sieve
's threshold (all positions xi with sieve[
xi]
< threshold will be tested for smoothness).
sieve | the siqs_sieve_t to update. | |
threshold | the new threshold's value. |