1use thiserror::Error;
4
5pub type Result<T> = std::result::Result<T, OptimError>;
7
8#[derive(Debug, Error)]
10pub enum OptimError {
11 #[error("invalid configuration: {0}")]
13 InvalidConfig(String),
14
15 #[error("shape mismatch: expected {expected:?}, got {actual:?}")]
17 ShapeMismatch {
18 expected: Vec<usize>,
20 actual: Vec<usize>,
22 },
23
24 #[error("dimension mismatch: expected {expected}, got {actual}")]
26 DimensionMismatch {
27 expected: usize,
29 actual: usize,
31 },
32
33 #[error("empty input: {0}")]
35 EmptyInput(String),
36
37 #[error("compression error: {0}")]
39 Compression(String),
40
41 #[error("prediction error: {0}")]
43 Prediction(String),
44
45 #[error("tensor error: {0}")]
47 Tensor(#[from] candle_core::Error),
48
49 #[error("ternary error: {0}")]
51 Ternary(#[from] trit_vsa::TernaryError),
52}