Skip to main content

tensorlogic_infer/low_rank/
error.rs

1//! Error types for low-rank approximation.
2
3/// Errors that can arise during low-rank approximation.
4#[derive(Debug, thiserror::Error)]
5pub enum LowRankError {
6    #[error("SVD failed after {iterations} iterations: {reason}")]
7    SvdFailed { iterations: usize, reason: String },
8
9    #[error("Rank {rank} exceeds min(rows={rows}, cols={cols})")]
10    RankExceedsDimensions {
11        rank: usize,
12        rows: usize,
13        cols: usize,
14    },
15
16    #[error("Approximation error {actual:.6} exceeds threshold {threshold:.6}")]
17    ErrorExceedsThreshold { actual: f64, threshold: f64 },
18
19    #[error("Invalid input: {0}")]
20    InvalidInput(String),
21
22    #[error("Numerical instability: {0}")]
23    NumericalInstability(String),
24}