Expand description
§SciRS2
SciRS2 is a comprehensive scientific computing library for Rust, aiming to provide functionality similar to SciPy in Python.
§Overview
SciRS2 provides a collection of modules for various scientific computing tasks:
- Linear algebra operations -
linalg
- Statistical functions -
stats
- Optimization algorithms -
optimize
- Numerical integration -
integrate
- Fast Fourier Transform -
fft
- Signal processing -
signal
- Special functions -
special
- Sparse matrix operations -
sparse
- Spatial algorithms -
spatial
- Clustering algorithms -
cluster
- N-dimensional image processing -
ndimage
- Neural network building blocks -
neural
- Automatic differentiation -
autograd
- Physical and mathematical constants -
constants
- Input/output utilities -
io
- Text processing -
text
- Computer vision -
vision
- Time series analysis -
series
- Graph processing -
graph
- Data transformation -
transform
- ML evaluation metrics -
metrics
- Dataset utilities -
datasets
Note: ML optimization algorithms have been moved to the independent OptiRS project from v0.1.0-beta.2
§Examples
use scirs2::prelude::*;
fn main() -> Result<(), Box<dyn std::error::Error>> {
// Example using linear algebra module (when enabled)
#[cfg(feature = "linalg")]
{
use ndarray::array;
// Create a matrix
let a = array![[1.0, 2.0], [3.0, 4.0]];
// Calculate determinant
if let Ok(det_val) = scirs2::linalg::det(&a.view(), None) {
println!("Determinant: {}", det_val);
}
// Calculate matrix inverse
if let Ok(inv_a) = scirs2::linalg::inv(&a.view(), None) {
println!("Inverse matrix: {:?}", inv_a);
}
}
// Example using stats module (when enabled)
#[cfg(feature = "stats")]
{
use ndarray::array;
// Create a data array
let data = array![1.0, 2.0, 3.0, 4.0, 5.0];
// Calculate mean
if let Ok(mean_val) = scirs2::stats::mean(&data.view()) {
println!("Mean: {}", mean_val);
}
// Calculate standard deviation
if let Ok(std_val) = scirs2::stats::std(&data.view(), 0, None) {
println!("Standard deviation: {}", std_val);
}
}
Ok(())
}
Re-exports§
pub use scirs2_linalg as linalg;
pub use scirs2_stats as stats;
pub use scirs2_integrate as integrate;
pub use scirs2_interpolate as interpolate;
pub use scirs2_optimize as optimize;
pub use scirs2_fft as fft;
pub use scirs2_special as special;
pub use scirs2_signal as signal;
pub use scirs2_sparse as sparse;
pub use scirs2_spatial as spatial;
pub use scirs2_cluster as cluster;
pub use scirs2_transform as transform;
pub use scirs2_metrics as metrics;
Modules§
- constants
- Physical and Mathematical Constants
- error
- Advanced error handling and recovery system for
SciRS2
- prelude
- Re-export of common utilities and types
- utils
- Utility functions for numerical operations
- validation
- Validation utilities for
SciRS2
- version
- Version information