# Crate peroxide

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
• Statistics
• Statistical operations
• mean, var, sd
• factorial, P, C, H
• Confusion Matrix & metrics
• Distributions
• Bernoulli
• Uniform
• Binomial
• Normal
• Gamma
• Beta
• Student’s t
• Special functions (Using puruspe crate)
• Gaussian
• Gamma
• Beta
• Error
• Incomplete Gamma
• Incomplete Beta
• Automatic Differentiation
• Numerical Utils
• Optimization
• 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
• Communication with Python
• DataFrame
• Read & Write with parquet or netcdf or csv format
• Macros

And all these things are built on mathematical traits.

### §Quick Start

#### §Cargo.toml

• Run below commands in your project directory
1. Default
cargo add peroxide

2. OpenBLAS
cargo add peroxide --features O3

3. Plot
cargo add peroxide --features plot

4. NetCDF dependency for DataFrame
cargo add peroxide --features nc

5. CSV dependency for DataFrame
cargo add peroxide --features csv

6. Parquet dependency for DataFrame
cargo add peroxide --features parquet

7. All features
cargo add peroxide --features "O3 plot nc csv parquet"


### §Import all at once

Peroxide has two options.

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 the default feature.

• If you want to save your numerical results, consider using the parquet or nc features, which correspond to the parquet and netcdf file formats, respectively. These formats are much more efficient than csv and json.

• For plotting, it is recommended to use the plot feature. However, if you require more customization, you can use the parquet or nc 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 and pyarrow libraries.

• A template for Python code that works with netcdf files can be found in the Socialst repository.

## 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