NumRS2: High-Performance Numerical Computing in Rust
NumRS2 is a comprehensive numerical computing library for Rust, designed to provide NumPy-like functionality with native performance. Built on top of highly optimized libraries and leveraging Rust's safety and performance features, NumRS2 aims to be the go-to solution for scientific computing, data analysis, and machine learning in Rust.
๐ Features
- N-dimensional Array: Core
Arraytype with efficient memory layout and broadcasting - Linear Algebra: Matrix operations, decompositions, solvers through BLAS/LAPACK integration
- Polynomial Functions: Interpolation, evaluation, and arithmetic operations
- Fast Fourier Transform: FFT implementation with various windowing functions
- Sparse Arrays: Memory-efficient representation for sparse data
- SIMD Acceleration: Vectorized math operations using SIMD instructions
- Parallel Computing: Multi-threaded execution with Rayon
- Mathematical Functions: Comprehensive set of element-wise mathematical operations
- Statistical Analysis: Descriptive statistics, probability distributions, and more
- Random Number Generation: Various distributions with fast generation
- Fully Type-Safe: Leverage Rust's type system for compile-time guarantees
๐งฎ Example
use *;
๐ Performance
NumRS is designed with performance as a primary goal:
- Rust's Zero-Cost Abstractions: Compile-time optimization without runtime overhead
- BLAS/LAPACK Integration: Industry-standard libraries for linear algebra operations
- SIMD Vectorization: Parallel processing at the CPU instruction level with automatic CPU feature detection
- Memory Layout Optimization: Cache-friendly data structures and memory alignment
- Data Placement Strategies: Optimized memory placement for better cache utilization
- Adaptive Parallelization: Smart thresholds to determine when parallel execution is beneficial
- Scheduling Optimization: Intelligent selection of work scheduling strategies based on workload
- Fine-grained Parallelism: Advanced workload partitioning for better load balancing
๐ฆ Installation
Add this to your Cargo.toml:
[]
= "0.1.0-alpha.1"
For BLAS/LAPACK support, ensure you have the necessary system libraries:
# Ubuntu/Debian
# macOS
๐ Implementation Details
NumRS is built on top of several battle-tested libraries:
- ndarray: Provides the foundation for n-dimensional arrays
- ndarray-linalg: Provides BLAS/LAPACK bindings for linear algebra
- num-complex: Complex number support for advanced operations
- BLAS/LAPACK: Powers high-performance linear algebra routines
- Rayon: Enables parallel computation capabilities
- num-traits: Provides generic numeric traits for numerical operations
๐ Current Status
NumRS is currently under active development. The current implementation includes:
โ Complete:
- Basic array operations with broadcasting
- Integration with BLAS for fundamental operations
- SIMD optimization with CPU feature detection
- Memory layout optimization for cache efficiency
- Optimized data placement strategies
- Enhanced parallel processing with optimized thresholds
- Fine-grained parallelization strategies
- Adaptive scheduling for parallel computations
- Foundational mathematical functions
- Numerically stable matrix decompositions (SVD, QR, Cholesky, LU, Schur, COD)
- Condition number calculation and numerical stability assessment
- Eigenvalue and eigenvector computation
- Fast Fourier Transform (FFT) implementation
- Polynomial operations and interpolation
- Sparse matrix representations
- Memory-mapped arrays for large datasets
- Support for datetime64 and timedelta64 data types
- Structured arrays and record arrays with custom dtypes
๐ง In Progress:
- Custom memory allocators for numerical workloads
- GPU acceleration for supported operations
- Adding more comprehensive documentation
- Building a more comprehensive test suite
๐ Documentation
For detailed documentation, examples, and API reference, visit docs.rs/numrs2.
๐งช Examples
Check out the examples/ directory for more usage examples:
basic_usage.rs: Core array operations and manipulationslinalg_example.rs: Linear algebra operations and solverssimd_example.rs: SIMD-accelerated computationsmemory_optimize_example.rs: Memory layout optimization for cache efficiencyparallel_optimize_example.rs: Parallelization optimization techniques- See the examples README for more details
๐ ๏ธ Development
NumRS is in active development. See TODO.md for upcoming features and development roadmap.
๐ค Contributing
Contributions are welcome! Please feel free to submit a Pull Request.
๐ License
This project is licensed under the Apache License 2.0 - see the LICENSE file for details.