binius_math/
error.rs

1// Copyright 2024-2025 Irreducible Inc.
2
3use std::ops::Range;
4
5#[derive(Debug, thiserror::Error)]
6pub enum Error {
7	#[error("argument {arg} does not have expected length {expected}")]
8	IncorrectArgumentLength { arg: String, expected: usize },
9	#[error("the matrix is not square")]
10	MatrixNotSquare,
11	#[error("the matrix is singular")]
12	MatrixIsSingular,
13	#[error("domain size is larger than the field")]
14	DomainSizeTooLarge,
15	#[error("argument {arg} must be in the range {range:?}")]
16	ArgumentRangeError { arg: String, range: Range<usize> },
17	#[error("buffer length must be a power of two")]
18	PowerOfTwoLengthRequired,
19	#[error("tensor and/or multilinear sizes do not match during fold")]
20	FoldLengthMismatch,
21	#[error("cannot split a buffer of length 1")]
22	CannotSplit,
23}