126bool nut_euler_sieve_conv_u(int64_t n, int64_t m, const int64_t f_vals[static n+1], int64_t f_conv_u_vals[restrict static n+1]);
138bool nut_euler_sieve_conv_N(int64_t n, int64_t m, const int64_t f_vals[static n+1], int64_t f_conv_N_vals[restrict static n+1]);
155bool nut_euler_sieve_conv(int64_t n, int64_t m, const int64_t f_vals[static n+1], const int64_t g_vals[static n+1], int64_t f_conv_g_vals[restrict static n+1]);
184static inline int64_t nut_Diri_get_dense(const
nut_Diri *self, int64_t k){
185 assert(k >= 0 && k <= self->y);
191static inline
void nut_Diri_set_dense(
nut_Diri *self, int64_t k, int64_t v){
192 assert(k >= 0 && k <= self->y);
199static inline int64_t nut_Diri_get_sparse(const
nut_Diri *self, int64_t k){
200 assert(k > 0 && k <= self->yinv);
201 return self->buf[self->y + k];
206static inline
void nut_Diri_set_sparse(
nut_Diri *self, int64_t k, int64_t v){
207 assert(k > 0 && k <= self->yinv);
208 self->buf[self->y + k] = v;
void nut_Diri_compute_mertens(nut_Diri *restrict self, int64_t m, const uint8_t mobius[restrict static self->y/4+1])
Compute the value table for the mobius function mu(n) (whose sum is called the Mertens function) Requ...
NUT_ATTR_CONST uint64_t nut_dirichlet_D(uint64_t max, uint64_t m)
Compute the sum of the divisor count function d from 1 to max.
void nut_Diri_copy(nut_Diri *restrict dest, const nut_Diri *restrict src)
Copy the values from one diri table to another, which must be initialized.
bool nut_Diri_init(nut_Diri *self, int64_t x, int64_t y)
Allocate internal buffers for a diri table self->buf will have f(0) through f(y) at indicies 0 throug...
bool nut_euler_sieve_conv(int64_t n, int64_t m, const int64_t f_vals[static n+1], const int64_t g_vals[static n+1], int64_t f_conv_g_vals[restrict static n+1])
Given tables of values of multiplicative functions f and g, compute (f <*> g)(x) for all x from 1 to ...
bool nut_Diri_compute_conv_N(nut_Diri *restrict self, int64_t m, const nut_Diri *restrict f_tbl)
Compute the value table for h = f <*> N, the dirichlet convolution of f and N (the identity function ...
bool nut_Diri_compute_Chi_balanced(nut_Diri *restrict self, uint64_t n, int64_t m, const int64_t period_tbl[restrict static n])
Compute the value table for a given Dirichlet Character Chi, whose total is 0 A dirichlet character i...
void nut_Diri_compute_I(nut_Diri *self)
Just memset's the dense part, then sets index 1 and y + 1 through y + yinv - 1 to 1 (remember the spa...
bool nut_euler_sieve_conv_N(int64_t n, int64_t m, const int64_t f_vals[static n+1], int64_t f_conv_N_vals[restrict static n+1])
Given a table of values of a multiplicative function f, compute (f <*> N)(x) for all x from 1 to n Se...
void nut_Diri_compute_u(nut_Diri *self, int64_t m)
Compute the value table for the unit function u(n) = 1 Fills the dense part of the table with 1s,...
bool nut_Diri_compute_pi(nut_Diri *restrict self)
Compute the value table for the prime counting function, aka prime pi The indicator function for prim...
bool nut_Diri_convdiv(nut_Diri *restrict self, int64_t m, const nut_Diri *restrict f_tbl, const nut_Diri *restrict g_tbl)
Compute the value table for h such that f = g <*> h, aka h = f </> g where the division is in terms o...
bool nut_Diri_compute_dk(nut_Diri *restrict self, uint64_t k, int64_t m, nut_Diri *restrict f_tbl, nut_Diri *restrict g_tbl)
Compute the value table for the kth generalized divisor function dk(n) dk(n) = da(n) <*> db(n) whenev...
bool nut_Diri_compute_conv_u(nut_Diri *restrict self, int64_t m, const nut_Diri *restrict f_tbl)
Compute the value table for h = f <*> u, the dirichlet convolution of f and u (the unit function u(n)...
bool nut_Diri_compute_conv(nut_Diri *restrict self, int64_t m, const nut_Diri *f_tbl, const nut_Diri *g_tbl)
Compute the value table for h = f <*> g, the dirichlet convolution of f and g, given value tables for...
NUT_ATTR_CONST uint64_t nut_dirichlet_Sigma(uint64_t max, uint64_t m)
Compute the sum of the divisor sum function sigma from 1 to max.
bool nut_Diri_compute_J(nut_Diri *restrict self, uint64_t p)
Compute the value table for the Jacobi symbol jacobi(n/p) Currently, p MUST be and odd prime This is ...
void nut_Diri_destroy(nut_Diri *self)
Deallocate internal buffers for a diri table.
bool nut_Diri_compute_Nk(nut_Diri *restrict self, uint64_t k, int64_t m)
Compute the value table for the kth power function N^k(n) N^k(n) = n^k, so we can find the sums using...
void nut_Diri_compute_N(nut_Diri *self, int64_t m)
Compute the value table for the identity function N(n) = n Fills the dense part of the table with inc...
bool nut_euler_sieve_conv_u(int64_t n, int64_t m, const int64_t f_vals[static n+1], int64_t f_conv_u_vals[restrict static n+1])
Given a table of values of a multiplicative function f, compute (f <*> u)(x) for all x from 1 to n Se...
#define NUT_ATTR_ACCESS(...)
Wrapper for gcc's access function annotation - no clang equivalent, and currently disabled because it...
#define NUT_ATTR_NONNULL(...)
Wrapper for gnu::nonnull attr.
#define NUT_ATTR_PURE
Wrapper for gnu::pure attr - similar to const but the function can read non-volatile memory (includin...
#define NUT_ATTR_CONST
Wrapper for gnu::const attr - such a function has no side effects and cannot read memory.
Wrapper to hold values of some multiplicative function.