Skip to main content

Crate numra_core

Crate numra_core 

Source
Expand description

§Numra Core

Core traits and types for the Numra numerical methods library.

This crate provides the fundamental abstractions that all other Numra crates build upon:

  • Scalar - Trait for scalar numeric types (f32, f64)
  • Vector - Trait for vector types
  • Signal - Trait for time-dependent forcing functions
  • Error types and result definitions

§Design Philosophy

Numra Core is designed to be:

  • Backend-agnostic: Works with faer, nalgebra, or pure Rust
  • No-std compatible: Can be used in embedded systems (with alloc)
  • Zero-cost abstractions: Compiles to optimal machine code

§Example

use numra_core::{Scalar, Signal};
use numra_core::signal::Harmonic;

// Define a harmonic forcing function
let forcing = Harmonic::new(1.0, 2.0, 0.0);  // amplitude=1, freq=2 Hz, phase=0

// Evaluate at t=0.25s (should be sin(2π*2*0.25) = sin(π) = 0)
let value = forcing.eval(0.25);
assert!(value.abs() < 1e-10);

Author: Moussa Leblouba Date: 9 February 2026 Modified: 2 May 2026

Re-exports§

pub use error::LinalgError;
pub use error::NumraError;
pub use error::NumraResult;
pub use scalar::from_f64_vec;
pub use scalar::to_f64_vec;
pub use scalar::Scalar;
pub use signal::Signal;
pub use uncertainty::compute_sensitivities;
pub use uncertainty::Interval;
pub use uncertainty::ParameterSensitivity;
pub use uncertainty::ParameterSensitivityResult;
pub use uncertainty::Uncertain;
pub use vector::Vector;

Modules§

error
Error types for Numra.
prelude
Commonly used items
scalar
Scalar type trait for numerical computation.
signal
Signal generators for forcing functions.
uncertainty
Uncertainty propagation and sensitivity analysis.
vector
Vector trait for numerical computation.