EvalExpr-JIT
A high-performance mathematical expression evaluator with JIT compilation and automatic differentiation support. Builds on top of evalexpr and Cranelift.
Features
- 🚀 JIT compilation for fast expression evaluation
- 📊 Automatic differentiation (up to any order)
- 🔢 Support for multiple variables
- 🧮 Higher-order partial derivatives
- 💪 Type-safe and memory-safe Rust implementation
This crate is still under development and the API is subject to change. Not all mathematical operations are supported yet.
Installation
Add this to your Cargo.toml:
[]
= "0.1.0" # Replace with actual version
Quick Start
use Equation;
Advanced Usage
Computing Derivatives
use Equation;
let eq = new?;
// Get specific partial derivative
let dx = eq.derivative?;
let values = vec!;
let result = dx;
// Compute higher-order derivatives
let dxdy = eq.derive_wrt?;
let result = dxdy;
// Compute Hessian matrix
let hessian = eq.hessian;
API Reference
Equation
The main struct representing a mathematical equation. Key methods include:
new(equation_str: String) -> Result<Self, EquationError>eval(&self, values: &[f64]) -> f64gradient(&self, values: &[f64]) -> Vec<f64>hessian(&self, values: &[f64]) -> Vec<Vec<f64>>derivative(&self, variable: &str) -> Result<&JITFunction, EquationError>derive_wrt(&self, variables: &[&str]) -> Result<JITFunction, EquationError>
Contributing
Contributions are welcome! Please feel free to submit a Pull Request.