peroxide/
lib.rs

1//! `peroxide` is comprehensive numerical library for Rust.
2//!
3//! ## Components
4//!
5//! `peroxide` has various components for scientific computation.
6//!
7//! - Linear Algebra (with BLAS & LAPACK)
8//!   - [Matrix](structure/matrix/index.html) operations
9//!     - `+,-,*,/`
10//!     - LU Decomposition, Determinant, Inverse
11//!     - QR Decomposition (`O3` feature needed)
12//!     - Singular Value Decomposition (`O3` feature needed)
13//!     - Cholesky Decomposition (`O3` feature needed)
14//!     - Reduced Row Echelon Form
15//!   - [Vector](structure/vector/index.html) operations
16//!   - [Eigenvalue, Eigenvector](numerical/eigen/index.html) algorithms
17//! - Statistics
18//!   - [Statistical operations](statistics/stat/index.html)
19//!     - `mean, var, sd`
20//!     - `factorial, P, C, H`
21//!     - Confusion Matrix & metrics
22//!   - [Distributions](statistics/dist/index.html)
23//!     - Bernoulli
24//!     - Uniform
25//!     - Binomial
26//!     - Normal
27//!     - Gamma
28//!     - Beta
29//!     - Student's t
30//!     - LogNormal
31//! - [Special functions](special/function/index.html) (Using `puruspe` crate)
32//!   - Gaussian
33//!   - Gamma
34//!   - Beta
35//!   - Error
36//!   - Incomplete Gamma
37//!   - Incomplete Beta
38//!   - Lambert W
39//! - Automatic Differentiation
40//!   - [Const-generic `Jet<N>` forward AD](structure/ad/index.html) — arbitrary-order Taylor mode
41//!   - Type aliases: `Dual = Jet<1>`, `HyperDual = Jet<2>`
42//!   - `#[ad_function]` proc macro for automatic gradient/hessian
43//! - Numerical Utils
44//!   - [Interpolation](numerical/interp/index.html)
45//!   - [Spline](numerical/spline/index.html)
46//!   - [Polynomial](structure/polynomial/index.html)
47//!   - [Lanczos Approximation](special/lanczos/index.html)
48//!   - [Numerical Integrations](numerical/integral/index.html)
49//! - [Optimization](numerical/optimize/index.html)
50//!   - Gradient Descent
51//!   - Levenberg-Marquardt
52//! - [Root Finding](numerical/root/index.html)
53//!   - Bisection
54//!   - False Position
55//!   - Secant
56//!   - Newton
57//!   - Broyden
58//! - [Ordinary Differential Equations](numerical/ode/index.html)
59//!   - Explicit
60//!     - Ralston's 3rd order
61//!     - Runge-Kutta 4th order
62//!     - Ralston's 4th order
63//!     - Runge-Kutta 5th order
64//!   - Embedded
65//!     - Bogacki-Shampine 3(2)
66//!     - Runge-Kutta-Fehlberg 4(5)
67//!     - Dormand-Prince 5(4)
68//!     - Tsitouras 5(4)
69//!     - Runge-Kutta-Fehlberg 7(8)
70//!   - Implicit
71//!     - Gauss-Legendre 4th order
72//! - Communication with Python
73//!   - [Plot with `matplotlib`](util/plot/index.html)
74//! - [DataFrame](structure/dataframe/index.html)
75//!   - Read & Write with `parquet` or `netcdf` or `csv` format
76//!   - Shape & info: `nrow`, `ncol`, `shape`, `dtypes`, `is_empty`, `contains`
77//!   - Row operations: `head`, `tail`, `slice`
78//!   - Column operations: `select`, `rename`, `column_names`, `select_dtypes`
79//!   - Statistics: `describe`, `sum`, `mean`
80//!   - Series statistics: `sum`, `mean`, `var`, `sd`, `min`, `max`
81//! - Macros
82//!   - [R macros](macros/r_macro/index.html)
83//!   - [Matlab macros](macros/matlab_macro/index.html)
84//!   - [Julia macros](macros/julia_macro/index.html)
85//!
86//! And all these things are built on mathematical traits.
87//!
88//! - Traits
89//!   - [Functional Programming tools](traits/fp/index.html)
90//!   - [General algorithms](traits/general/index.html)
91//!   - [Mathematics](traits/math/index.html)
92//!   - [Mutable tools](traits/mutable/index.html)
93//!   - [Number & Real](traits/num/index.html)
94//!   - [Pointer](traits/pointer/index.html)
95//!   - [Stable](traits/stable/index.html)
96//! ## Quick Start
97//!
98//! ### Cargo.toml
99//!
100//! * Run below commands in your project directory
101//!
102//! 1. Default
103//!     ```bash
104//!     cargo add peroxide
105//!     ```
106//! 2. OpenBLAS
107//!     ```bash
108//!     cargo add peroxide --features O3
109//!     ```
110//! 3. Plot
111//!     ```bash
112//!     cargo add peroxide --features plot
113//!     ```
114//! 4. NetCDF dependency for DataFrame
115//!     ```bash
116//!     cargo add peroxide --features nc
117//!     ```
118//! 5. CSV dependency for DataFrame
119//!     ```bash
120//!     cargo add peroxide --features csv
121//!     ```
122//! 6. Parquet dependency for DataFrame
123//!     ```bash
124//!     cargo add peroxide --features parquet
125//!     ```
126//! 7. All features
127//!     ```bash
128//!     cargo add peroxide --features "O3 plot nc csv parquet"
129//!     ```
130//!
131//! ## Import all at once
132//!
133//! Peroxide has two options.
134//!
135//! * [`prelude`](prelude/index.html) : To simple use
136//! * [`fuga`](fuga/index.html) : To control numerical algorithms
137//!
138//! To see differences, follow above two links.
139//!
140//! You can import all functions & structures at once
141//!
142//! * `prelude`
143//! ```
144//! #[macro_use]
145//! extern crate peroxide;
146//! use peroxide::prelude::*;
147//!
148//! fn main() {
149//!     // Write what you want
150//! }
151//! ```
152//!
153//! * `fuga`
154//! ```
155//! #[macro_use]
156//! extern crate peroxide;
157//! use peroxide::fuga::*;
158//!
159//! fn main() {
160//!     // Write what you want
161//! }
162//! ```
163//!
164//! ## Useful tips for features
165//!
166//! * 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.
167//!
168//! * 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`.
169//!
170//! * 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.
171//!
172//!     * To read parquet files in Python, you can use the `pandas` and `pyarrow` libraries.
173//!
174//!     * A template for Python code that works with netcdf files can be found in the [Socialst](https://github.com/Axect/Socialst/blob/master/Templates/PyPlot_Template/nc_plot.py) repository.
175
176//!
177#![cfg_attr(docsrs, feature(doc_auto_cfg))]
178
179#[cfg(feature = "O3")]
180extern crate blas;
181
182#[cfg(feature = "O3")]
183extern crate lapack;
184
185#[cfg(feature = "plot")]
186extern crate pyo3;
187
188#[cfg(feature = "serde")]
189extern crate serde;
190
191extern crate rand;
192
193// extern crate json;
194
195extern crate order_stat;
196
197extern crate puruspe;
198
199extern crate matrixmultiply;
200
201#[cfg(feature = "nc")]
202extern crate netcdf;
203
204extern crate peroxide_ad;
205
206#[macro_use]
207pub mod macros;
208
209pub mod fuga;
210pub mod ml;
211pub mod numerical;
212pub mod prelude;
213pub mod special;
214pub mod statistics;
215pub mod structure;
216pub mod traits;
217pub mod util;
218
219#[cfg(feature = "complex")]
220pub mod complex;
221
222#[cfg(feature = "parallel")]
223extern crate rayon;