linfa_ica/
error.rs

1use thiserror::Error;
2
3pub type Result<T> = std::result::Result<T, FastIcaError>;
4
5/// An error when modeling FastICA algorithm
6#[derive(Error, Debug)]
7#[non_exhaustive]
8pub enum FastIcaError {
9    /// When there are no samples in the provided dataset
10    #[error("Dataset must contain at least one sample")]
11    NotEnoughSamples,
12    /// When any of the hyperparameters are set the wrong value
13    #[error("Invalid value encountered: {0}")]
14    InvalidValue(String),
15    /// If we fail to compute any components of the SVD decomposition
16    /// due to an Ill-Conditioned matrix
17    #[error("SVD Decomposition failed, X could be an Ill-Conditioned matrix")]
18    SvdDecomposition,
19    #[error("tolerance should be positive but is {0}")]
20    InvalidTolerance(f32),
21    #[cfg(feature = "blas")]
22    #[error("Linalg BLAS error: {0}")]
23    LinalgBlasError(#[from] ndarray_linalg::error::LinalgError),
24    #[error("Linalg error: {0}")]
25    /// Errors encountered during linear algebra operations
26    LinalgError(#[from] linfa_linalg::LinalgError),
27    #[error(transparent)]
28    LinfaError(#[from] linfa::error::Error),
29}