Skip to content

Commit

Permalink
adding Sm3e and Sm3o
Browse files Browse the repository at this point in the history
  • Loading branch information
tgiani committed Sep 5, 2024
1 parent e57e891 commit 70cdc7c
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 0 deletions.
6 changes: 6 additions & 0 deletions crates/ekore/src/harmonics/cache.rs
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,10 @@ pub enum K {
Sm2e,
/// $S_{-2}(N)$ odd moments
Sm2o,
/// $S_{-3}(N)$ even moments
Sm3e,
/// $S_{-3}(N)$ odd moments
Sm3o,
/// $S_{-2,1}(N)$ even moments
Sm21e,
/// $S_{-2,1}(N)$ odd moments
Expand Down Expand Up @@ -90,6 +94,8 @@ impl Cache {
K::Sm1o => w1::Sm1o(self.get(K::S1), self.get(K::S1mh)),
K::Sm2e => w2::Sm2e(self.get(K::S2), self.get(K::S2h)),
K::Sm2o => w2::Sm2o(self.get(K::S2), self.get(K::S2mh)),
K::Sm3e => w3::Sm3e(self.get(K::S3), self.get(K::S3h)),
K::Sm3o => w3::Sm3o(self.get(K::S3), self.get(K::S3mh)),
K::Sm21e => w3::Sm21e(self.n, self.get(K::S1), self.get(K::Sm1e)),
K::Sm21o => w3::Sm21o(self.n, self.get(K::S1), self.get(K::Sm1o)),
};
Expand Down
11 changes: 11 additions & 0 deletions crates/ekore/src/harmonics/w3.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
//! Harmonic sums of weight 3.
use num::complex::Complex;
use num::traits::Pow;
use std::f64::consts::LN_2;

use crate::constants::{ZETA2, ZETA3};
Expand All @@ -14,6 +15,16 @@ pub fn S3(N: Complex<f64>) -> Complex<f64> {
0.5 * cern_polygamma(N + 1.0, 2) + ZETA3
}

/// Analytic continuation of harmonic sum $S_{-3}(N)$ for even moments.
pub fn Sm3e(hS3: Complex<f64>, hS3h: Complex<f64>) -> Complex<f64> {
1. / (2_f64).pow(2) * hS3h - hS3
}

/// Analytic continuation of harmonic sum $S_{-3}(N)$ for odd moments.
pub fn Sm3o(hS3: Complex<f64>, hS3mh: Complex<f64>) -> Complex<f64> {
1. / (2_f64).pow(2) * hS3mh - hS3
}

/// Analytic continuation of harmonic sum $S_{-2,1}(N)$ for even moments.
pub fn Sm21e(N: Complex<f64>, hS1: Complex<f64>, hSm1: Complex<f64>) -> Complex<f64> {
let eta = 1.;
Expand Down

0 comments on commit 70cdc7c

Please sign in to comment.