Crate peroxide

source ·
Expand description

peroxide is comprehensive numerical library for Rust.

Components

peroxide has various components for scientific computation.

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.

  • prelude : To simple use
  • fuga : To control numerical algorithms

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

  • After 0.28.0, dataframe feature is replaced by nc feature.
  • If you want to use QR or SVD or Cholesky Decomposition then should use O3 feature (there are no implementations for these decompositions in default)
  • If you want to write your numerical results, then use parquet or nc features (corresponding to parquet or netcdf format. (It is much more effective than csv and json.)
  • After 0.23.0, there are two options - fuga, prelude. Choose proper option for your computations.
  • To plot, use parquet or nc feature to export data as parquet or netcdf format and use python to draw plot.
    • plot feature has limited plot abilities.
    • To read parquet file in python, use pandas & pyarrow libraries.
    • There is a template of python code for netcdf. - Socialst

Modules

Macros

  • R like concatenate (Type: Vec<f64>)
  • R like cbind
  • R like dnorm
  • R like dt
  • MATLAB like eye - identity matrix
  • MATLAB like linspace
  • R like lm
  • More R like Matrix constructor (Macro)
  • 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
  • R like seq macro
  • MATLAB like zeros - zero matrix