embedded-dsp
A #![no_std] Rust Digital Signal Processing library designed for microcontrollers (Cortex-M, RISC-V, AVR, Xtensa), embedded systems, and real-time digital signal processing applications.
Features
#![no_std]First: Purecorecompatibility for bare-metal targets with zero dynamic allocation required.libmIntegration: UnifiedFloatMathtrait providing floating-point math routines in#![no_std]environments vialibm.- Fixed-Point & Floating-Point: Complete support for
f32,f64,q31,q15,q7, andq63saturating arithmetic. - 16 Core DSP Modules:
- Basic Math: Elementwise
add,sub,mult,negate,offset,scale,shift,dot_prod,clip, bitwise operations. - Complex Math: Complex vector addition, multiplication, magnitude, conjugate, dot product.
- Fast Math: Trigonometric
sin,cos,sin_cos,sqrt,vsqrt,divide,log,exp,atan2. - Filtering: FIR filters, Biquad IIR cascade, LMS adaptive filters, 1D convolution & correlation.
- Transforms: In-place Complex FFT (
cfft), Real FFT (rfft), Discrete Cosine Transform (dct4). - Matrix Operations: Matrix addition, subtraction, multiplication, scaling, transpose, Gauss-Jordan inversion.
- Controller: PID motor controller, Clarke and Park transforms.
- Statistics: Mean, variance, standard deviation, RMS, power, min/max, entropy, KL divergence, logsumexp.
- Support & Conversions: Array copy/fill, zero-allocation sorting (
sort_f32), format conversions (q15↔f32↔q31). - Interpolation: Linear, Bilinear, and Cubic Spline interpolation.
- Quaternions: Norm, normalization, quaternion product, conjugate, inverse, rotation matrix conversion.
- Window Functions: Hanning, Hamming, Blackman, Bartlett, Welch, Flat-top generators.
- Distance Metrics: Euclidean, Cosine, Chebyshev, Manhattan, Minkowski, Jaccard, Hamming, Canberra, Bray-Curtis.
- Machine Learning: Support Vector Machine (
SvmInstanceF32) and Gaussian Naive Bayes (GaussianNaiveBayesInstanceF32).
- Basic Math: Elementwise
Quick Start
Add embedded-dsp to your Cargo.toml:
[]
# For bare-metal #![no_std] environments with libm
= { = "0.1", = false, = ["libm"] }
# For standard std environments
= "0.1"
Basic Example
use *;
Running Included Examples
# Run basic usage example
# Run performance comparison benchmark (libm vs embedded-dsp)
License
The contents of this repository are dual-licensed under the MIT OR Apache 2.0
License. That means you can choose either the MIT license or the Apache 2.0
license when you re-use this code. See LICENSE, LICENSE-MIT, or
LICENSE-APACHE for more information on each specific
license.