Skip to main content

tensor4all_tensorci/
error.rs

1//! Error types for tensor cross interpolation operations
2
3use thiserror::Error;
4
5/// Result type for TCI operations
6pub type Result<T> = std::result::Result<T, TCIError>;
7
8/// Errors that can occur during tensor cross interpolation operations
9#[derive(Error, Debug)]
10pub enum TCIError {
11    /// Dimension mismatch
12    #[error("Dimension mismatch: {message}")]
13    DimensionMismatch {
14        /// Description of the dimension mismatch
15        message: String,
16    },
17
18    /// Invalid index
19    #[error("Index out of bounds: {message}")]
20    IndexOutOfBounds {
21        /// Description of the index error
22        message: String,
23    },
24
25    /// Invalid pivot
26    #[error("Invalid pivot: {message}")]
27    InvalidPivot {
28        /// Description of the invalid pivot
29        message: String,
30    },
31
32    /// Convergence failure
33    #[error("Failed to converge after {iterations} iterations")]
34    ConvergenceFailure {
35        /// Number of iterations before failure
36        iterations: usize,
37    },
38
39    /// Empty tensor train
40    #[error("Empty tensor structure")]
41    Empty,
42
43    /// Invalid operation
44    #[error("Invalid operation: {message}")]
45    InvalidOperation {
46        /// Description of the invalid operation
47        message: String,
48    },
49    /// Internal index inconsistency
50    #[error("Index inconsistency: {message}")]
51    IndexInconsistency {
52        /// Description of the inconsistency
53        message: String,
54    },
55
56    /// Matrix CI error
57    #[error("Matrix CI error: {0}")]
58    MatrixCIError(#[from] tensor4all_tcicore::MatrixCIError),
59
60    /// Matrix LUCI substrate error
61    #[error("Matrix LUCI error: {0}")]
62    MatrixLuciError(#[from] tensor4all_tcicore::MatrixLuciError),
63
64    /// Tensor train error
65    #[error("Tensor train error: {0}")]
66    TensorTrainError(#[from] tensor4all_simplett::TensorTrainError),
67}