pub enum TensorTrainError {
DimensionMismatch {
site: usize,
},
IndexOutOfBounds {
site: usize,
index: usize,
max: usize,
},
IndexLengthMismatch {
expected: usize,
got: usize,
},
Empty,
InvalidOperation {
message: String,
},
MatrixCI(MatrixCIError),
}Expand description
Errors that can occur during tensor train operations
§Examples
use tensor4all_simplett::{TensorTrainError, TensorTrain, AbstractTensorTrain};
// Empty index set triggers IndexLengthMismatch
let tt = TensorTrain::<f64>::constant(&[2, 3], 1.0);
let err = tt.evaluate(&[0]).unwrap_err();
assert!(matches!(err, TensorTrainError::IndexLengthMismatch { expected: 2, got: 1 }));
// DimensionMismatch can be constructed directly
let err = TensorTrainError::DimensionMismatch { site: 3 };
assert!(err.to_string().contains("site 3"));
// InvalidOperation carries an arbitrary message
let err = TensorTrainError::InvalidOperation {
message: "test error".to_string(),
};
assert!(err.to_string().contains("test error"));Variants§
DimensionMismatch
Dimension mismatch between tensors
IndexOutOfBounds
Invalid index provided
Fields
IndexLengthMismatch
Length mismatch in index set
Empty
Empty tensor train
InvalidOperation
Invalid operation
MatrixCI(MatrixCIError)
Matrix CI error
Trait Implementations§
Source§impl Debug for TensorTrainError
impl Debug for TensorTrainError
Source§impl Display for TensorTrainError
impl Display for TensorTrainError
Source§impl Error for TensorTrainError
impl Error for TensorTrainError
Source§fn source(&self) -> Option<&(dyn Error + 'static)>
fn source(&self) -> Option<&(dyn Error + 'static)>
Returns the lower-level source of this error, if any. Read more
1.0.0 · Source§fn description(&self) -> &str
fn description(&self) -> &str
👎Deprecated since 1.42.0: use the Display impl or to_string()
Auto Trait Implementations§
impl Freeze for TensorTrainError
impl RefUnwindSafe for TensorTrainError
impl Send for TensorTrainError
impl Sync for TensorTrainError
impl Unpin for TensorTrainError
impl UnsafeUnpin for TensorTrainError
impl UnwindSafe for TensorTrainError
Blanket Implementations§
§impl<U> As for U
impl<U> As for U
§fn as_<T>(self) -> Twhere
T: CastFrom<U>,
fn as_<T>(self) -> Twhere
T: CastFrom<U>,
Casts
self to type T. The semantics of numeric casting with the as operator are followed, so <T as As>::as_::<U> can be used in the same way as T as U for numeric conversions. Read moreSource§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
§impl<T> DistributionExt for Twhere
T: ?Sized,
impl<T> DistributionExt for Twhere
T: ?Sized,
fn rand<T>(&self, rng: &mut (impl Rng + ?Sized)) -> Twhere
Self: Distribution<T>,
§impl<T> DistributionExt for Twhere
T: ?Sized,
impl<T> DistributionExt for Twhere
T: ?Sized,
fn rand<T>(&self, rng: &mut (impl Rng + ?Sized)) -> Twhere
Self: Distribution<T>,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more