Crate numrs2

Source
Expand description

§NumRS2: High-Performance Numerical Computing in Rust

NumRS2 is a comprehensive numerical computing library for Rust, inspired by NumPy. It provides a powerful N-dimensional array object, sophisticated mathematical functions, and advanced linear algebra, statistical, and random number functionality.

§Quick Start

use numrs2::prelude::*;

let a = Array::from_vec(vec![1.0, 2.0, 3.0, 4.0]).reshape(&[2, 2]);
let b = Array::from_vec(vec![5.0, 6.0, 7.0, 8.0]).reshape(&[2, 2]);
let c = a.matmul(&b).unwrap();
println!("Matrix multiplication result: {}", c);

§Main Features

  • N-dimensional Array: Core Array type with efficient memory layout and broadcasting
  • Linear Algebra: Matrix operations, decompositions, solvers through BLAS/LAPACK integration
  • Mathematical Functions: Comprehensive set of element-wise mathematical operations
  • SIMD Acceleration: Vectorized math operations using SIMD instructions
  • Parallel Computing: Multi-threaded execution with Rayon
  • Random Number Generation: Modern interface for various distributions
  • GPU Acceleration: Optional GPU-accelerated array operations using WGPU
  • Type Safety: Leverage Rust’s type system for compile-time guarantees

Re-exports§

pub use error::NumRs2Error;
pub use error::Result;
pub use random::random_base;

Modules§

algorithms
High-performance numerical algorithms
array
array_ops
array_ops_legacy
arrays
Array operations and data structures
axis_ops
blas
char
String and character array operations (NumPy char module equivalent)
comparisons
conversions
error
NumRS2 Error System
financial
Financial Functions Module
indexing
interop
Interoperability with other Rust numerical libraries
io
linalg
Basic linear algebra operations with Array Includes matrix multiplication, dot product, matrix inversion, etc.
linalg_extended
Extended Linear Algebra Operations
linalg_optimized
Optimized linear algebra operations with enhanced performance algorithms
linalg_parallel
Parallel linear algebra operations with load balancing
linalg_stable
Numerically stable matrix decomposition algorithms
masked
math
math_extended
Extended Mathematical Functions
matrix
memory_alloc
Custom memory allocation for numerical workloads
memory_optimize
Memory layout optimization for cache efficiency
mmap
new_modulesDeprecated
parallel
Parallel processing enhancements and workload balancing
parallel_optimize
Parallel processing optimization
prelude
Core prelude that exports the most commonly used types and functions
printing
Array Printing and Display Module
random
Random Number Generation
set_ops
Set operations for arrays
signal
Signal Processing Module
simd
simd_optimize
CPU feature detection and SIMD optimization for NumRS
sparse
Sparse Matrix Operations
sparse_enhanced
Enhanced sparse matrix operations with advanced algorithms and optimizations
stats
stride_tricks
traits
Core Trait System for NumRS2
types
Advanced data types and type system for NumRS
ufuncs
unique
unique_optimized
util
views

Macros§

error_location
Macro for creating error location from current position
operation_context
Macro for creating operation context with current function
simd_array
Convenience macro for creating SIMD-optimized arrays