Crates.io | scirs2 |
lib.rs | scirs2 |
version | |
source | src |
created_at | 2025-04-13 21:37:53.841069+00 |
updated_at | 2025-04-13 21:37:53.841069+00 |
description | A Rust port of SciPy with AI/ML extensions - Scientific Computing and AI Library |
homepage | |
repository | https://github.com/cool-japan/scirs |
max_upload_size | |
id | 1632166 |
Cargo.toml error: | TOML parse error at line 18, column 1 | 18 | autolib = false | ^^^^^^^ unknown field `autolib`, expected one of `name`, `version`, `edition`, `authors`, `description`, `readme`, `license`, `repository`, `homepage`, `documentation`, `build`, `resolver`, `links`, `default-run`, `default_dash_run`, `rust-version`, `rust_dash_version`, `rust_version`, `license-file`, `license_dash_file`, `license_file`, `licenseFile`, `license_capital_file`, `forced-target`, `forced_dash_target`, `autobins`, `autotests`, `autoexamples`, `autobenches`, `publish`, `metadata`, `keywords`, `categories`, `exclude`, `include` |
size | 0 |
SciRS2 is a comprehensive scientific computing library for Rust, inspired by SciPy and designed to provide a complete ecosystem for numerical computation, statistical analysis, and scientific algorithms.
This is the main SciRS2 crate, which provides a convenient facade over the ecosystem of specialized sub-crates. Each sub-crate focuses on a specific domain of scientific computing, while this crate re-exports their functionality in a unified interface.
SciRS2 brings together a large collection of scientific computing tools:
scirs2-core
scirs2-linalg
scirs2-stats
scirs2-optimize
scirs2-integrate
scirs2-interpolate
scirs2-special
scirs2-fft
scirs2-signal
scirs2-sparse
scirs2-spatial
scirs2-ndimage
scirs2-io
Add the following to your Cargo.toml
:
[dependencies]
scirs2 = "0.1.0" # Enable only the features you need
You can enable only the features you need:
[dependencies]
scirs2 = { version = "0.1.0", features = ["linalg", "stats", "optimize"] }
Basic usage examples:
use scirs2::prelude::*;
use ndarray::array;
fn main() -> CoreResult<()> {
// Linear algebra operations
let a = array![[1., 2.], [3., 4.]];
let eig = linalg::eigen::eig(&a)?;
println!("Eigenvalues: {:?}", eig.eigenvalues);
println!("Eigenvectors: {:?}", eig.eigenvectors);
// Statistical distributions
let normal = stats::distributions::normal::Normal::new(0.0, 1.0)?;
let samples = normal.random_sample(1000, None)?;
let mean = stats::descriptive::mean(&samples)?;
let std_dev = stats::descriptive::std_dev(&samples, None)?;
println!("Sample mean: {}, std dev: {}", mean, std_dev);
// Optimization
let f = |x: &[f64]| x[0].powi(2) + x[1].powi(2);
let df = |x: &[f64], grad: &mut [f64]| {
grad[0] = 2.0 * x[0];
grad[1] = 2.0 * x[1];
};
let result = optimize::unconstrained::minimize(
f, df, &[1.0, 1.0], "L-BFGS-B", None, None)?;
println!("Optimization result: {:?}", result);
// Special functions
let gamma = special::gamma::gamma(5.0)?;
println!("Gamma(5) = {}", gamma);
// FFT
let signal = array![1.0, 2.0, 3.0, 4.0];
let fft_result = fft::fft(&signal)?;
println!("FFT result: {:?}", fft_result);
Ok(())
}
This crate uses feature flags to control which sub-crates are included:
core
: Core utilities (always enabled)linalg
: Linear algebra operationsstats
: Statistical functions and distributionsoptimize
: Optimization algorithmsintegrate
: Numerical integration and ODEsinterpolate
: Interpolation methodsfft
: Fast Fourier Transformspecial
: Special functionssignal
: Signal processingsparse
: Sparse matricesspatial
: Spatial algorithmsndimage
: N-dimensional image processingcluster
: Clustering algorithmsdatasets
: Dataset utilitiesio
: I/O utilitiesneural
: Neural networksoptim
: Optimization for machine learninggraph
: Graph algorithmstransform
: Data transformationmetrics
: Evaluation metricstext
: Text processingvision
: Computer visionseries
: Time series analysisautograd
: Automatic differentiationSciRS2 follows a modular architecture where each domain of scientific computing is implemented in a separate crate. This main crate provides a unified interface by re-exporting their functionality.
scirs2
├── core // Core utilities
├── linalg // Linear algebra
├── stats // Statistics
├── optimize // Optimization
├── integrate // Integration
├── interpolate // Interpolation
├── fft // Fourier transforms
├── special // Special functions
├── signal // Signal processing
├── sparse // Sparse matrices
├── spatial // Spatial algorithms
├── ndimage // Image processing
└── ... // Other modules
SciRS2 is designed with performance in mind:
See the CONTRIBUTING.md file for contribution guidelines.
This project is licensed under the Apache License, Version 2.0 - see the LICENSE file for details.