Loading...
Searching...
No Matches
segsieves.h
Go to the documentation of this file.
1#pragma once
2
13
14#include <inttypes.h>
15#include <stdlib.h>
16
17#include <nut/modular_math.h>
18#include <nut/factorization.h>
19#include <nut/sieves.h>
20
21typedef struct{
22 uint64_t max;
23 uint64_t sqrt_max;
24 uint64_t num_primes;
25 uint64_t *primes;
26 uint64_t preferred_bucket_size;
28
38bool nut_Segsieve_init(nut_Segsieve *self, uint64_t max, uint64_t preferred_bucket_size);
39
43
56void nut_Segsieve_factorizations(const nut_Segsieve *restrict self, uint64_t a, uint64_t b, size_t pitch, void *buffer);
57
62void *nut_Segsieve_factorizations_mkbuffer(const nut_Segsieve *self, size_t *pitch);
void nut_Segsieve_destroy(nut_Segsieve *self)
Free the resources held by a segmented sieve header.
void * nut_Segsieve_factorizations_mkbuffer(const nut_Segsieve *self, size_t *pitch)
Allocate a buffer for a thread to pass to nut_Segsieve_factorizations on its intervals.
void nut_Segsieve_factorizations(const nut_Segsieve *restrict self, uint64_t a, uint64_t b, size_t pitch, void *buffer)
Sieve all factorizations in the range [a, b) using a modified, in place largest factor sieve This use...
bool nut_Segsieve_init(nut_Segsieve *self, uint64_t max, uint64_t preferred_bucket_size)
Set up the sieving primes header for a segmented sieve.