Skip to content

Commit dc8c261

Browse files
Fix overlaping Q2 coordinates in alphas interpolations
1 parent 6e27538 commit dc8c261

File tree

1 file changed

+13
-3
lines changed

1 file changed

+13
-3
lines changed

neopdf/src/alphas.rs

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@ impl AlphaSAnalytic {
114114
if nf == 0 {
115115
return Err(Error::NfZeroValueError);
116116
}
117-
match self.lambda_maps.get(&self.num_fl) {
117+
match self.lambda_maps.get(&nf) {
118118
Some(lambda_value) => Ok(*lambda_value),
119119
None => self.lambda_qcd(nf - 1),
120120
}
@@ -202,10 +202,20 @@ pub struct AlphaSInterpol {
202202

203203
impl AlphaSInterpol {
204204
pub fn from_metadata(meta: &MetaData) -> Result<Self, String> {
205-
let q2_values: Vec<f64> = meta.alphas_q_values.iter().map(|&q| (q * q).ln()).collect();
205+
let (q_values, alphas_vals): (Vec<_>, Vec<_>) = meta
206+
.alphas_q_values
207+
.iter()
208+
.zip(&meta.alphas_vals)
209+
.enumerate()
210+
.filter(|(i, (&q, _))| *i == 0 || q != meta.alphas_q_values[i - 1])
211+
.map(|(_, (&q, &alpha))| (q, alpha))
212+
.unzip();
213+
214+
let q2_values: Vec<f64> = q_values.iter().map(|&q| (q * q).ln()).collect();
215+
206216
let interpolator = Interp1D::new(
207217
q2_values.into(),
208-
meta.alphas_vals.to_owned().into(),
218+
alphas_vals.into(),
209219
AlphaSCubicInterpolation,
210220
Extrapolate::Error,
211221
)

0 commit comments

Comments
 (0)