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