Skip to content

Commit 30d7197

Browse files
committed
Algorithm is Send+static
1 parent 1ffa539 commit 30d7197

File tree

4 files changed

+9
-9
lines changed

4 files changed

+9
-9
lines changed

src/algorithms/mod.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ pub enum Algorithm {
2828
POSTPROB,
2929
}
3030

31-
pub trait Algorithms<E: Equation>: Sync {
31+
pub trait Algorithms<E: Equation + Send + 'static>: Sync + Send + 'static {
3232
fn new(config: Settings, equation: E, data: Data) -> Result<Box<Self>>
3333
where
3434
Self: Sized;
@@ -262,7 +262,7 @@ pub trait Algorithms<E: Equation>: Sync {
262262
fn into_npresult(&self) -> NPResult<E>;
263263
}
264264

265-
pub fn dispatch_algorithm<E: Equation>(
265+
pub fn dispatch_algorithm<E: Equation + Send + 'static>(
266266
settings: Settings,
267267
equation: E,
268268
data: Data,

src/algorithms/npag.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ const THETA_F: f64 = 1e-2;
2929
const THETA_D: f64 = 1e-4;
3030

3131
#[derive(Debug)]
32-
pub struct NPAG<E: Equation> {
32+
pub struct NPAG<E: Equation + Send + 'static> {
3333
equation: E,
3434
ranges: Vec<(f64, f64)>,
3535
psi: Psi,
@@ -51,7 +51,7 @@ pub struct NPAG<E: Equation> {
5151
settings: Settings,
5252
}
5353

54-
impl<E: Equation> Algorithms<E> for NPAG<E> {
54+
impl<E: Equation + Send + 'static> Algorithms<E> for NPAG<E> {
5555
fn new(settings: Settings, equation: E, data: Data) -> Result<Box<Self>, anyhow::Error> {
5656
Ok(Box::new(Self {
5757
equation,

src/algorithms/npod.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ use ndarray::{
3434
const THETA_F: f64 = 1e-2;
3535
const THETA_D: f64 = 1e-4;
3636

37-
pub struct NPOD<E: Equation> {
37+
pub struct NPOD<E: Equation + Send + 'static> {
3838
equation: E,
3939
psi: Psi,
4040
theta: Theta,
@@ -52,7 +52,7 @@ pub struct NPOD<E: Equation> {
5252
settings: Settings,
5353
}
5454

55-
impl<E: Equation> Algorithms<E> for NPOD<E> {
55+
impl<E: Equation + Send + 'static> Algorithms<E> for NPOD<E> {
5656
fn new(settings: Settings, equation: E, data: Data) -> Result<Box<Self>, anyhow::Error> {
5757
Ok(Box::new(Self {
5858
equation,
@@ -397,7 +397,7 @@ impl<E: Equation> Algorithms<E> for NPOD<E> {
397397
}
398398
}
399399

400-
impl<E: Equation> NPOD<E> {
400+
impl<E: Equation + Send + 'static> NPOD<E> {
401401
fn validate_psi(&mut self) -> Result<()> {
402402
let mut psi = self.psi().matrix().as_ref().into_ndarray().to_owned();
403403
// First coerce all NaN and infinite in psi to 0.0

src/algorithms/postprob.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ use crate::routines::settings::Settings;
2121

2222
/// Posterior probability algorithm
2323
/// Reweights the prior probabilities to the observed data and error model
24-
pub struct POSTPROB<E: Equation> {
24+
pub struct POSTPROB<E: Equation + Send + 'static> {
2525
equation: E,
2626
psi: Psi,
2727
theta: Theta,
@@ -35,7 +35,7 @@ pub struct POSTPROB<E: Equation> {
3535
error_models: ErrorModels,
3636
}
3737

38-
impl<E: Equation> Algorithms<E> for POSTPROB<E> {
38+
impl<E: Equation + Send + 'static> Algorithms<E> for POSTPROB<E> {
3939
fn new(settings: Settings, equation: E, data: Data) -> Result<Box<Self>, anyhow::Error> {
4040
Ok(Box::new(Self {
4141
equation,

0 commit comments

Comments
 (0)