pointprocesses/temporal/
traits.rs1use rayon::prelude::*;
2use ndarray::prelude::*;
3
4pub struct TimeProcessResult {
7 pub timestamps: Array1<f64>,
8 pub intensities: Array1<f64>
9}
10
11
12pub trait TemporalProcess {
14 fn sample(&self, tmax: f64) -> TimeProcessResult;
17
18 fn batch_sample(&self, tmax: f64, num_batch: usize) -> Vec<TimeProcessResult>
20 where Self: std::marker::Sync
21 {
22 let range = 0..num_batch;
23 range.into_par_iter().map(|_| {
24 self.sample(tmax)
25 }).collect()
26 }
27}
28
29use std::fmt;
30impl fmt::Debug for TimeProcessResult {
31 fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result
32 {
33 f.debug_struct("ProcessTraj")
34 .field("timestamps", &self.timestamps)
35 .field("intensities", &self.intensities)
36 .finish()
37 }
38}
39
40pub trait DeterministicIntensity {
42 fn intensity(&self, t: f64) -> f64;
43}
44
45pub trait StochasticIntensity {}