Skip to main content

Module error

Module error 

Source
Expand description

§Chapter 12.0.1 — Errors

§Purpose

One error type for every function of the crate (decision S10 of D-0127), so that xingo-ffi maps one enum to R conditions and Python exceptions. No function of the crate panics on bad input: wrong lengths, bad indices, non-finite data and invalid options come back as a StatlaError; a panic is a bug.

§Variants of this edition

The enum is #[non_exhaustive]. Task L3.2 has the six variants its operations can return, with the names of the contract: Dimension, InvalidArgument, NonFinite, NotPositiveDefinite, DowndateIndefinite, RankDeficient. Task L3.3 adds NoConvergence (crate::svds()) and Operator (every driver over a crate::LinearOperator). The contract’s Lu and Kkt arrive with shift-invert (L3.4); adding a variant to a non-exhaustive enum is not breaking.

§Conventions

  1. Lengths are checked before indices, indices before values, values (finiteness) before any arithmetic: the first violation found in that order is the one reported.
  2. NonFinite::index is the position in the argument, column-major for matrices (i + j·rows, independent of the leading dimension).
  3. Every error of an updating operation leaves the factorization bit for bit as it was (invariants H3, Q3).

Enums§

StatlaError
Everything that can go wrong, for every function of the crate (decision S10: one error type). No function of the crate panics on bad input; panics are bugs.

Functions§

op_err 🔒
StatlaError::Operator (a function, not a public From impl: the contract has none).