Skip to main content

Crate tpt_math_numeric

Crate tpt_math_numeric 

Source
Expand description

Scalar numeric trait glue for the tpt-math substrate.

This crate is a thin wrapper over num_traits (and, when the libm feature is enabled, libm) that re-exports the numeric traits the rest of tpt-math builds on, and provides a single Scalar supertrait that captures “a floating-point scalar type we can do math on”.

§Features

  • std (default) — enable num_traits’ std-dependent items.
  • alloc — signal that an allocator is available (no extra deps).
  • libm — re-export libm so callers can do transcendental math in no_std environments.

Re-exports§

pub use report::SolveReport;
pub use report::SolveStatus;
pub use num_traits;
pub use libm;

Modules§

cast
ode
Explicit Runge–Kutta integration of ODE systems: fixed-step RK4, adaptive Dormand–Prince 5(4), dense output and event location.
prelude
Re-export of the Num/Float numeric hierarchy root for convenience.
quadrature
Numerical integration of scalar functions.
report
A common summary of an iterative solve, shared by the solver crates.
roots
Bracketing root finders for scalar functions.
sensitivity
Forward sensitivity analysis: ∂y/∂p for an ODE y' = f(t, y, p).
stiff
A stiff ODE solver: the two-stage, second-order, L-stable Rosenbrock method ROS2 with step-doubling error control.

Traits§

CheckedAdd
Performs addition that returns None instead of wrapping around on overflow.
CheckedDiv
Performs division that returns None instead of panicking on division by zero and instead of wrapping around on underflow and overflow.
CheckedMul
Performs multiplication that returns None instead of wrapping around on underflow or overflow.
CheckedNeg
Performs negation that returns None if the result can’t be represented.
CheckedRem
Performs an integral remainder that returns None instead of panicking on division by zero and instead of wrapping around on underflow and overflow.
CheckedShl
Performs a left shift that returns None on shifts larger than or equal to the type width.
CheckedShr
Performs a right shift that returns None on shifts larger than or equal to the type width.
CheckedSub
Performs subtraction that returns None instead of wrapping around on underflow.
Float
Generic trait for floating point numbers
FloatConst
FromPrimitive
A generic trait for converting a number to a value.
Inv
Unary operator for retrieving the multiplicative inverse, or reciprocal, of a value.
Num
The base trait for numeric types, covering 0 and 1 values, comparisons, basic numeric operations, and string conversion.
NumAssign
The trait for Num types which also implement assignment operators.
NumAssignOps
Generic trait for types implementing numeric assignment operators (like +=).
NumCast
An interface for casting between machine scalars.
NumOps
Generic trait for types implementing basic numeric operations
One
Defines a multiplicative identity element for Self.
Pow
Binary operator for raising a value to a power.
PrimInt
Generic trait for primitive integers.
Real
A trait for real number types that do not necessarily have floating-point-specific characteristics such as NaN and infinity.
Scalar
A floating-point scalar type usable throughout tpt-math.
Signed
Useful functions for signed numbers (i.e. numbers that can be negative).
ToPrimitive
A generic trait for converting a value to a number.
Unsigned
A trait for values which cannot be negative
Zero
Defines an additive identity element for Self.

Functions§

cast
Cast from one machine scalar to another.