Epstein Zeta Library 0.6.2
Calculates the Epstein Zeta function
Loading...
Searching...
No Matches
Functions
harmonics.c File Reference

Calculates the harmonic polynomials. More...

#include "harmonics.h"
#include "hpdyad.h"
#include "stdbool.h"
#include "tools.h"
#include <math.h>
Include dependency graph for harmonics.c:

Functions

double coeffs_c_inner (long long n, long long i, long long k, long long dim)
 Computes cₙ,ᵢ,ₖ= ∏_{j=i+1}^{⌊n/2⌋-k} (2n+d−2−4k−2j).
 
double coeffs_c_outer (long long n, long long k, long long dim)
 Computes cₙ,ₖ=2⁻ᵏ/ cₙ,₀,ₖ ∏ⱼ₌₁ᵏ(2n+d−2j)∕((2n+d+2−4j)(2n+d−4j)).
 
void coeffs_c_inner_hpdyad (unsigned int n, unsigned int i, unsigned int k, unsigned int dim, hpdyad_t *out)
 Computes cₙ,ᵢ,ₖ= ∏_{j=i+1}^{⌊n/2⌋-k} (2n+d−2−4k−2j) as hpdyad.
 
void harmonic_h_inner_term_scalar_hpdyad (unsigned int n, unsigned int i, unsigned int k, unsigned int dim, hpdyad_t *out)
 Computes (-2)**(-i) · c_{n,i,k} · binom(i+k,k) as hpdyad.
 
void harmonic_h_inner_term_multi_hpdyad (unsigned int dim, const unsigned int *alpha, const unsigned int *beta, const unsigned int *theta1, const unsigned int *theta2, hpdyad_t *out)
 Computes binom(i,β) × binom(α,θ₁) × θ₂!/(θ₂−θ₁)! as hpdyad.
 
double harmonic_h_inner_sum (unsigned int k, unsigned int dim, const unsigned int *alpha, const unsigned int *gamma, unsigned int alphaAbs)
 Computes the inner sum h_inner(α,γ,k) using exact hpdyad arithmetic.
 
unsigned long long precompute_harmonic_h_inner_chunk_size (unsigned int alphaAbs, unsigned int kMax, unsigned int dim, const unsigned int *alpha, unsigned long long *chunk_offset, unsigned long long *valid_count)
 Computes chunk offsets and valid entry counts for precomputed inner harmonic sums corresponding to k = 0, ..., floor(|alpha|/2). For each k, chunk_offset[k] stores the starting offset in the coeffs array where values corresponding to |gamma| = |alpha| - k are stored. valid_count[k] stores the number of valid gamma for that k.
 
void precompute_harmonic_h_inner_sum (unsigned int alphaAbs, unsigned int dim, const unsigned int *alpha, const unsigned long long *chunk_offset, double *coeffs, unsigned int *exponents)
 Precomputes and stores inner harmonic sums h_inner(α,γ,k) and exponents (2γ-α) for all k = 0, ..., floor(|alpha|/2) and all gamma with |gamma| = |alpha| - k satisfying 2γ[i] >= α[i]. Coefficients are stored in coeffs starting at offsets given by chunk_offset[k]. Exponents are stored in exponents with stride dim, i.e., exponent i for entry n of chunk k is at exponents[(chunk_offset[k] + n) * dim + i]. Gamma is iterated in graded lexicographic order with total degree |alpha| - k.
 
double harmonic_h (unsigned int k, unsigned int dim, const double *z, unsigned int alphaAbs, const unsigned long long *chunk_offset, const unsigned long long *valid_count, const double *coeffs, const unsigned int *exponents)
 Calculates the homogeneous harmonic polynomial h₍α,k₎ of degree |α|−2k such that y^α = ∑ₖ (y·y)^k h₍α,k₎(y); explicitly, h₍α,k₎(y)=c_{|α|,k} ∑{|γ|=|α|−k} y^{2γ−α} h_inner(α,γ,k). Uses precomputed coefficients and exponents to avoid multi-index iteration.
 

Detailed Description

Calculates the harmonic polynomials.

Function Documentation

◆ coeffs_c_inner()

double coeffs_c_inner ( long long n,
long long i,
long long k,
long long dim )

Computes cₙ,ᵢ,ₖ= ∏_{j=i+1}^{⌊n/2⌋-k} (2n+d−2−4k−2j).

Parameters
[in]nindex (total of alpha).
[in]ilower bound of product (exclusive).
[in]kindex (specifies degree |alpha| - 2k).
[in]dimdimension of the zeta function inputs.
Returns
cₙ,ᵢ,ₖ.

◆ coeffs_c_inner_hpdyad()

void coeffs_c_inner_hpdyad ( unsigned int n,
unsigned int i,
unsigned int k,
unsigned int dim,
hpdyad_t * out )

Computes cₙ,ᵢ,ₖ= ∏_{j=i+1}^{⌊n/2⌋-k} (2n+d−2−4k−2j) as hpdyad.

Parameters
[in]nindex (total of alpha).
[in]ilower bound of product (exclusive).
[in]kindex (specifies degree |alpha| - 2k).
[in]dimdimension.
[out]outresult hpdyad.

◆ coeffs_c_outer()

double coeffs_c_outer ( long long n,
long long k,
long long dim )

Computes cₙ,ₖ=2⁻ᵏ/ cₙ,₀,ₖ ∏ⱼ₌₁ᵏ(2n+d−2j)∕((2n+d+2−4j)(2n+d−4j)).

Parameters
[in]nindex (total of alpha).
[in]kindex (specifies degree |alpha| - 2k).
[in]dimdimension of the zeta function inputs.
Returns
cₙ,ₖ.

◆ harmonic_h()

double harmonic_h ( unsigned int k,
unsigned int dim,
const double * z,
unsigned int alphaAbs,
const unsigned long long * chunk_offset,
const unsigned long long * valid_count,
const double * coeffs,
const unsigned int * exponents )

Calculates the homogeneous harmonic polynomial h₍α,k₎ of degree |α|−2k such that y^α = ∑ₖ (y·y)^k h₍α,k₎(y); explicitly, h₍α,k₎(y)=c_{|α|,k} ∑{|γ|=|α|−k} y^{2γ−α} h_inner(α,γ,k). Uses precomputed coefficients and exponents to avoid multi-index iteration.

Parameters
[in]kspecifies degree |alpha| - 2k.
[in]dimdimension of alpha, gamma and y.
[in]zvector of the polynomial.
[in]alphaAbstotal of alpha.
[in]chunk_offsetstarting offsets for each k.
[in]valid_countnumber of valid entries for each k.
[in]coeffsarray storing precomputed inner harmonic sums.
[in]exponentsarray storing precomputed exponents (2γ-α).
Returns
h₍α,k₎(z).

◆ harmonic_h_inner_sum()

double harmonic_h_inner_sum ( unsigned int k,
unsigned int dim,
const unsigned int * alpha,
const unsigned int * gamma,
unsigned int alphaAbs )

Computes the inner sum h_inner(α,γ,k) using exact hpdyad arithmetic.

Precondition
k ≤ ⌊alphaAbs/2⌋
Parameters
[in]kspecifies degree |alpha| - 2k.
[in]dimdimension of alpha, beta and gamma.
[in]alphaupper multi-index.
[in]gammafixed multi-index gamma.
[in]alphaAbstotal of alpha.
Returns
h_inner(α,γ,k).

◆ harmonic_h_inner_term_multi_hpdyad()

void harmonic_h_inner_term_multi_hpdyad ( unsigned int dim,
const unsigned int * alpha,
const unsigned int * beta,
const unsigned int * theta1,
const unsigned int * theta2,
hpdyad_t * out )

Computes binom(i,β) × binom(α,θ₁) × θ₂!/(θ₂−θ₁)! as hpdyad.

Parameters
[in]dimdimension of the multi-indices.
[in]alphaupper multi-index α.
[in]betalower multi-index β.
[in]theta1multi-index α+β−γ.
[in]theta2multi-index γ−β.
[out]outresult hpdyad (always positive).

◆ harmonic_h_inner_term_scalar_hpdyad()

void harmonic_h_inner_term_scalar_hpdyad ( unsigned int n,
unsigned int i,
unsigned int k,
unsigned int dim,
hpdyad_t * out )

Computes (-2)**(-i) · c_{n,i,k} · binom(i+k,k) as hpdyad.

Parameters
[in]nindex (total of alpha).
[in]iindex (total of beta).
[in]kindex (specifies degree |alpha| - 2k).
[in]dimdimension.
[out]outresult hpdyad.

◆ precompute_harmonic_h_inner_chunk_size()

unsigned long long precompute_harmonic_h_inner_chunk_size ( unsigned int alphaAbs,
unsigned int kMax,
unsigned int dim,
const unsigned int * alpha,
unsigned long long * chunk_offset,
unsigned long long * valid_count )

Computes chunk offsets and valid entry counts for precomputed inner harmonic sums corresponding to k = 0, ..., floor(|alpha|/2). For each k, chunk_offset[k] stores the starting offset in the coeffs array where values corresponding to |gamma| = |alpha| - k are stored. valid_count[k] stores the number of valid gamma for that k.

Parameters
[in]alphaAbstotal of alpha.
[in]kMaxfloor(|alpha|/2).
[in]dimdimension of alpha and gamma.
[in]alphaupper multi-index.
[out]chunk_offsetarray of length kMax+1 storing offsets.
[out]valid_countarray of length kMax+1 storing valid entry counts.
Returns
total length required for coeffs array.

◆ precompute_harmonic_h_inner_sum()

void precompute_harmonic_h_inner_sum ( unsigned int alphaAbs,
unsigned int dim,
const unsigned int * alpha,
const unsigned long long * chunk_offset,
double * coeffs,
unsigned int * exponents )

Precomputes and stores inner harmonic sums h_inner(α,γ,k) and exponents (2γ-α) for all k = 0, ..., floor(|alpha|/2) and all gamma with |gamma| = |alpha| - k satisfying 2γ[i] >= α[i]. Coefficients are stored in coeffs starting at offsets given by chunk_offset[k]. Exponents are stored in exponents with stride dim, i.e., exponent i for entry n of chunk k is at exponents[(chunk_offset[k] + n) * dim + i]. Gamma is iterated in graded lexicographic order with total degree |alpha| - k.

Precomputes and stores inner harmonic sums h_inner(α,γ,k) and exponents (2γ-α) for all k = 0, ..., floor(|alpha|/2) and all gamma with |gamma| = |alpha| - k satisfying 2γ[i] >= α[i]. Coefficients are stored in coeffs starting at offsets given by chunk_offset[k]. Exponents are stored in exponents with stride dim, i.e., exponent i for entry n of chunk k is at exponents[(chunk_offset[k] + n) * dim + i]. Gamma is ordered identically to harmonic_h_update_outer_index.

Parameters
[in]alphaAbstotal of alpha.
[in]dimdimension of alpha and gamma.
[in]alphaupper multi-index.
[in]chunk_offsetstarting offsets for each k.
[out]coeffsarray storing precomputed inner harmonic sums.
[out]exponentsarray storing precomputed exponents (2γ-α), size = totalSize * dim.