Skip to content

Commit 29cc22d

Browse files
committed
FIX: Fix mis-impementation for ParallelFPMatrix
1 parent 9bca563 commit 29cc22d

File tree

1 file changed

+13
-11
lines changed

1 file changed

+13
-11
lines changed

src/traits/fp.rs

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -82,20 +82,22 @@ pub trait ParallelFPVector {
8282
/// Functional Programming for Matrix in Parallel (Uses Rayon crate)
8383
#[cfg(feature = "parallel")]
8484
pub trait ParallelFPMatrix {
85-
fn par_fmap<F>(&self, f: F) -> Matrix
85+
type Scalar;
86+
87+
fn par_fmap<F>(&self, f: F) -> Self
8688
where
87-
F: Fn(f64) -> f64 + Send + Sync;
88-
fn par_reduce<F, T>(&self, init: T, f: F) -> f64
89+
F: Fn(Self::Scalar) -> Self::Scalar + Send + Sync;
90+
fn par_reduce<F, T>(&self, init: T, f: F) -> Self::Scalar
8991
where
90-
F: Fn(f64, f64) -> f64 + Send + Sync,
91-
T: Into<f64> + Copy + Clone + Send + Sync;
92-
fn par_zip_with<F>(&self, f: F, other: &Matrix) -> Matrix
92+
F: Fn(Self::Scalar, Self::Scalar) -> Self::Scalar + Send + Sync,
93+
T: Into<Self::Scalar> + Copy + Clone + Send + Sync;
94+
fn par_zip_with<F>(&self, f: F, other: &Self) -> Self
9395
where
94-
F: Fn(f64, f64) -> f64 + Send + Sync;
95-
fn par_col_reduce<F>(&self, f: F) -> Vec<f64>
96+
F: Fn(Self::Scalar, Self::Scalar) -> Self::Scalar + Send + Sync;
97+
fn par_col_reduce<F>(&self, f: F) -> Vec<Self::Scalar>
9698
where
97-
F: Fn(Vec<f64>) -> f64 + Send + Sync;
98-
fn par_row_reduce<F>(&self, f: F) -> Vec<f64>
99+
F: Fn(Vec<Self::Scalar>) -> Self::Scalar + Send + Sync;
100+
fn par_row_reduce<F>(&self, f: F) -> Vec<Self::Scalar>
99101
where
100-
F: Fn(Vec<f64>) -> f64 + Send + Sync;
102+
F: Fn(Vec<Self::Scalar>) -> Self::Scalar + Send + Sync;
101103
}

0 commit comments

Comments
 (0)