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) — enablenum_traits’std-dependent items.alloc— signal that an allocator is available (no extra deps).libm— re-exportlibmso callers can do transcendental math inno_stdenvironments.
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/Floatnumeric 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/∂pfor an ODEy' = 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§
- Checked
Add - Performs addition that returns
Noneinstead of wrapping around on overflow. - Checked
Div - Performs division that returns
Noneinstead of panicking on division by zero and instead of wrapping around on underflow and overflow. - Checked
Mul - Performs multiplication that returns
Noneinstead of wrapping around on underflow or overflow. - Checked
Neg - Performs negation that returns
Noneif the result can’t be represented. - Checked
Rem - Performs an integral remainder that returns
Noneinstead of panicking on division by zero and instead of wrapping around on underflow and overflow. - Checked
Shl - Performs a left shift that returns
Noneon shifts larger than or equal to the type width. - Checked
Shr - Performs a right shift that returns
Noneon shifts larger than or equal to the type width. - Checked
Sub - Performs subtraction that returns
Noneinstead of wrapping around on underflow. - Float
- Generic trait for floating point numbers
- Float
Const - From
Primitive - 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
0and1values, comparisons, basic numeric operations, and string conversion. - NumAssign
- The trait for
Numtypes which also implement assignment operators. - NumAssign
Ops - 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.