Skip to content

Commit

Permalink
feat: calc scale factor once
Browse files Browse the repository at this point in the history
  • Loading branch information
dancixx committed Aug 29, 2024
1 parent c085995 commit 4baea29
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/noises/fgn.rs
Original file line number Diff line number Diff line change
Expand Up @@ -109,9 +109,10 @@ impl Generator for FgnFft {
let fft_handler = self.fft_handler.clone();
let mut fgn_fft = self.fft_fgn.clone();
ndfft_par(&fgn, &mut fgn_fft, &fft_handler, 0);
let scale_factor = self.t.powf(self.hurst) * (self.n as f64).powf(-self.hurst);
let fgn = fgn_fft
.slice(s![1..self.n - self.offset + 1])
.mapv(|x: Complex<f64>| (x.re * (self.n as f64).powf(-self.hurst)) * self.t.powf(self.hurst));
.mapv(|x: Complex<f64>| x.re * scale_factor);
fgn
}

Expand Down

0 comments on commit 4baea29

Please sign in to comment.