Expand description
peroxide
is comprehensive numerical library for Rust.
§Components
peroxide
has various components for scientific computation.
- Linear Algebra (with BLAS & LAPACK)
- Matrix operations
+,-,*,/
- LU Decomposition, Determinant, Inverse
- QR Decomposition (
O3
feature needed) - Singular Value Decomposition (
O3
feature needed) - Cholesky Decomposition (
O3
feature needed) - Reduced Row Echelon Form
- Vector operations
- Eigenvalue, Eigenvector algorithms
- Matrix operations
- Statistics
- Statistical operations
mean, var, sd
factorial, P, C, H
- Confusion Matrix & metrics
- Distributions
- Bernoulli
- Uniform
- Binomial
- Normal
- Gamma
- Beta
- Student’s t
- Statistical operations
- Special functions (Using
puruspe
crate)- Gaussian
- Gamma
- Beta
- Error
- Incomplete Gamma
- Incomplete Beta
- Automatic Differentiation
- Numerical Utils
- Optimization
- Gradient Descent
- Levenberg-Marquardt
- Root Finding
- Bisection
- False Position
- Secant
- Newton
- Broyden
- Ordinary Differential Equations
- Explicit
- Ralston’s 3rd order
- Runge-Kutta 4th order
- Ralston’s 4th order
- Runge-Kutta 5th order
- Embedded
- Bogacki-Shampine 3(2)
- Runge-Kutta-Fehlberg 4(5)
- Dormand-Prince 5(4)
- Tsitouras 5(4)
- Implicit
- Gauss-Legendre 4th order
- Explicit
- Communication with Python
- DataFrame
- Read & Write with
parquet
ornetcdf
orcsv
format
- Read & Write with
- Macros
And all these things are built on mathematical traits.
- Traits
§Quick Start
§Cargo.toml
- Run below commands in your project directory
- Default
cargo add peroxide
- OpenBLAS
cargo add peroxide --features O3
- Plot
cargo add peroxide --features plot
- NetCDF dependency for DataFrame
cargo add peroxide --features nc
- CSV dependency for DataFrame
cargo add peroxide --features csv
- Parquet dependency for DataFrame
cargo add peroxide --features parquet
- All features
cargo add peroxide --features "O3 plot nc csv parquet"
§Import all at once
Peroxide has two options.
To see differences, follow above two links.
You can import all functions & structures at once
prelude
#[macro_use]
extern crate peroxide;
use peroxide::prelude::*;
fn main() {
// Write what you want
}
fuga
#[macro_use]
extern crate peroxide;
use peroxide::fuga::*;
fn main() {
// Write what you want
}
§Useful tips for features
-
If you want to use QR, SVD, or Cholesky Decomposition, you should use the
O3
feature. These decompositions are not implemented in thedefault
feature. -
If you want to save your numerical results, consider using the
parquet
ornc
features, which correspond to theparquet
andnetcdf
file formats, respectively. These formats are much more efficient thancsv
andjson
. -
For plotting, it is recommended to use the
plot
feature. However, if you require more customization, you can use theparquet
ornc
feature to export your data in the parquet or netcdf format and then use Python to create the plots.-
To read parquet files in Python, you can use the
pandas
andpyarrow
libraries. -
A template for Python code that works with netcdf files can be found in the Socialst repository.
-
Modules§
- Choose what you want.
- Useful macros
- Machine learning tools
- Differential equations & Numerical Analysis tools
- Do not disturbed. Just use.
- Special functions module
- Statistical Modules
- Main structures for peroxide
- Utility - plot, print, pickle and etc.
Macros§
- High level macro for bisection
- R like concatenate (Type: Vec<f64>)
- R like cbind
- R like
dnorm
- R like
dt
- MATLAB like eye - identity matrix
- High level macro for false position
- MATLAB like linspace
- R like lm
- More R like Matrix constructor (Macro)
- High level macro for newton (using Automatic differentiation)
- R like
pnorm
- R like
pt
- MATLAB like rand - random matrix
- R like rbind
- R like random normal
- R like random Student’s t
- R like random uniform
- High level macro for secant
- R like seq macro
- Macro for single derivative
- Macro for single function
- MATLAB like zeros - zero matrix