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 (
O3feature needed) - Singular Value Decomposition (
O3feature needed) - Cholesky Decomposition (
O3feature needed) - Reduced Row Echelon Form
- Vector operations
- Eigenvalue, Eigenvector algorithms
- Matrix operations
- Statistics
- Statistical operations
mean, var, sdfactorial, P, C, H- Confusion Matrix & metrics
- Distributions
- Bernoulli
- Uniform
- Binomial
- Normal
- Gamma
- Beta
- Student’s t
- LogNormal
- Statistical operations
- Special functions (Using
puruspecrate)- Gaussian
- Gamma
- Beta
- Error
- Incomplete Gamma
- Incomplete Beta
- Lambert W
- 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)
- Runge-Kutta-Fehlberg 7(8)
- Implicit
- Gauss-Legendre 4th order
- Explicit
- Communication with Python
- DataFrame
- Read & Write with
parquetornetcdforcsvformat
- 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
O3feature. These decompositions are not implemented in thedefaultfeature. -
If you want to save your numerical results, consider using the
parquetorncfeatures, which correspond to theparquetandnetcdffile formats, respectively. These formats are much more efficient thancsvandjson. -
For plotting, it is recommended to use the
plotfeature. However, if you require more customization, you can use theparquetorncfeature 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
pandasandpyarrowlibraries. -
A template for Python code that works with netcdf files can be found in the Socialst repository.
-
Modules§
- complex
- fuga
- Choose what you want.
- macros
- Useful macros
- ml
- Machine learning tools
- numerical
- Differential equations & Numerical Analysis tools
- prelude
- Do not disturbed. Just use.
- special
- Special functions module
- statistics
- Statistical Modules
- structure
- Main structures for peroxide
- traits
- util
- Utility - plot, print, pickle and etc.
Macros§
- bisection
- High level macro for bisection
- c
- R like concatenate (Type: Vec<f64>)
- cbind
- R like cbind
- dnorm
- R like
dnorm - dt
- R like
dt - eye
- MATLAB like eye - identity matrix
- false_
position - High level macro for false position
- hstack
- linspace
- MATLAB like linspace
- lm
- R like lm
- matrix
- More R like Matrix constructor (Macro)
- newton
- High level macro for newton (using Automatic differentiation)
- pnorm
- R like
pnorm - pt
- R like
pt - rand
- MATLAB like rand - random matrix
- rbind
- R like rbind
- rnorm
- R like random normal
- rt
- R like random Student’s t
- runif
- R like random uniform
- secant
- High level macro for secant
- seq
- R like seq macro
- single_
derivative - Macro for single derivative
- single_
function - Macro for single function
- vstack
- zeros
- MATLAB like zeros - zero matrix