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

  • 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.

Modules§

Macros§