Expand description
Comprehensive input validation for solver operations.
All validation functions run eagerly before any computation begins, ensuring
callers receive clear diagnostics instead of mysterious numerical failures or
resource exhaustion. Every public function returns ValidationError on
failure, which converts into [SolverError::InvalidInput] via From.
§Limits
Hard limits are enforced to prevent denial-of-service through oversized inputs:
| Resource | Limit | Constant |
|---|---|---|
| Nodes (rows) | 10,000,000 | MAX_NODES |
| Edges (nnz) | 100,000,000 | MAX_EDGES |
| Dimension | 65,536 | MAX_DIM |
| Iterations | 1,000,000 | MAX_ITERATIONS |
| Request body | 10 MiB | MAX_BODY_SIZE |
Constants§
- MAX_
BODY_ SIZE - Maximum request body size in bytes (10 MiB).
- MAX_DIM
- Maximum vector/matrix dimension for dense operations.
- MAX_
EDGES - Maximum number of non-zero entries.
- MAX_
ITERATIONS - Maximum solver iterations to prevent runaway computation.
- MAX_
NODES - Maximum number of rows or columns to prevent resource exhaustion.
Functions§
- validate_
body_ size - Validate that a request body does not exceed
MAX_BODY_SIZE. - validate_
csr_ matrix - Validate the structural integrity of a CSR matrix.
- validate_
output - Validate a solver result after computation completes.
- validate_
params - Validate solver convergence parameters.
- validate_
rhs - Validate a right-hand-side vector for a linear solve.
- validate_
rhs_ vector - Validate the right-hand side vector
bfor compatibility with a matrix. - validate_
solver_ input - Validate the complete solver input (matrix + rhs + parameters).