pub trait ComputeEngine: Send + Sync {
// Required methods
fn batch_dot_product(
&self,
a: &[f64],
b: &[f64],
) -> Result<f64, ComputeError>;
fn batch_matrix_solve(
&self,
a_flat: &[f64],
b: &[f64],
n: usize,
) -> Result<Vec<f64>, ComputeError>;
fn batch_exponential_smooth(
&self,
values: &[f64],
alpha: f64,
) -> Result<Vec<f64>, ComputeError>;
fn batch_difference(
&self,
values: &[f64],
d: usize,
) -> Result<Vec<f64>, ComputeError>;
fn batch_autocorrelation(
&self,
values: &[f64],
max_lag: usize,
) -> Result<Vec<f64>, ComputeError>;
fn batch_least_squares(
&self,
a_flat: &[f64],
b: &[f64],
m: usize,
n: usize,
) -> Result<Vec<f64>, ComputeError>;
}Expand description
Compute engine trait — defines batch numerical operations used by forecast, anomaly detection, and multivariate engines.
Required Methods§
Sourcefn batch_dot_product(&self, a: &[f64], b: &[f64]) -> Result<f64, ComputeError>
fn batch_dot_product(&self, a: &[f64], b: &[f64]) -> Result<f64, ComputeError>
Dot product of two vectors.
Sourcefn batch_matrix_solve(
&self,
a_flat: &[f64],
b: &[f64],
n: usize,
) -> Result<Vec<f64>, ComputeError>
fn batch_matrix_solve( &self, a_flat: &[f64], b: &[f64], n: usize, ) -> Result<Vec<f64>, ComputeError>
Solve a linear system Ax = b using LU decomposition.
a_flat is the row-major flattened NxN matrix A.
b is the right-hand-side vector of length N.
Returns x such that Ax = b.
Sourcefn batch_exponential_smooth(
&self,
values: &[f64],
alpha: f64,
) -> Result<Vec<f64>, ComputeError>
fn batch_exponential_smooth( &self, values: &[f64], alpha: f64, ) -> Result<Vec<f64>, ComputeError>
Exponential smoothing on a time series.
Returns smoothed values with the given alpha parameter.
Sourcefn batch_difference(
&self,
values: &[f64],
d: usize,
) -> Result<Vec<f64>, ComputeError>
fn batch_difference( &self, values: &[f64], d: usize, ) -> Result<Vec<f64>, ComputeError>
Compute d-th order differences of a series.
Sourcefn batch_autocorrelation(
&self,
values: &[f64],
max_lag: usize,
) -> Result<Vec<f64>, ComputeError>
fn batch_autocorrelation( &self, values: &[f64], max_lag: usize, ) -> Result<Vec<f64>, ComputeError>
Compute autocorrelation at the given lags.
Sourcefn batch_least_squares(
&self,
a_flat: &[f64],
b: &[f64],
m: usize,
n: usize,
) -> Result<Vec<f64>, ComputeError>
fn batch_least_squares( &self, a_flat: &[f64], b: &[f64], m: usize, n: usize, ) -> Result<Vec<f64>, ComputeError>
Solve least-squares: find x minimizing ||Ax - b||².
a_flat is row-major M×N matrix, b is length-M vector.
Returns x of length N via Householder QR decomposition (numerically
stable — preserves κ(A) instead of squaring it like normal equations).
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".