peroxide/fuga/
mod.rs

1//! Choose what you want.
2//!
3//! # Philosophy
4//!
5//! Numerical algorithms are neglected in many codes.
6//! However, it is very important which algorithm is used for precise research and important numerical computation.
7//! `fuga` is the best for you.
8//!
9//! # Usage
10//!
11//! ```ignore
12//! #[macro_use]
13//! extern crate peroxide;
14//! use peroxide::fuga::*;
15//!
16//! // Then you can use everything in peroxide.
17//! ```
18//!
19//! # Compare with `prelude`
20//!
21//! * Norm
22//! ```
23//! #[macro_use]
24//! extern crate peroxide;
25//! use peroxide::fuga::*;
26//!
27//! fn main() {
28//!     let a = c!(1, 2, 3);
29//!     let l1 = a.norm(Norm::L1);
30//!     let l2 = a.norm(Norm::L2);
31//!     let l_inf = a.norm(Norm::LInf);
32//!
33//!     assert_eq!(l1, 6f64);
34//!     assert_eq!(l2, 14f64.sqrt());
35//!     assert_eq!(l_inf, 3f64);
36//! }
37//! ```
38//!
39//! ```
40//! #[macro_use]
41//! extern crate peroxide;
42//! use peroxide::prelude::*;
43//!
44//! fn main() {
45//!     let a = c!(1, 2, 3);
46//!     let l2 = a.norm();      // L2 is default vector norm
47//!     // prelude can't compute l1 norm, l_inf norm
48//!     assert_eq!(l2, 14f64.sqrt());
49//! }
50//! ```
51//!
52//! * Numerical integration
53//!
54//! ```
55//! #[macro_use]
56//! extern crate peroxide;
57//! use peroxide::fuga::*;
58//! use std::f64::consts::PI;
59//!
60//! fn main() {
61//!     let sin = |x: f64| x.sin();
62//!     integrate(sin, (0f64, PI), GaussLegendre(15)).print();
63//! }
64//! ```
65//!
66//! ```
67//! #[macro_use]
68//! extern crate peroxide;
69//! use peroxide::prelude::*;
70//! use std::f64::consts::PI;
71//!
72//! fn main() {
73//!     let sin = |x: f64| x.sin();
74//!     integrate(sin, (0f64, PI)).print();
75//!     // Default integration = GaussLegendre(15)
76//! }
77//! ```
78//!
79//! * Solve
80//!
81//! ```
82//! #[macro_use]
83//! extern crate peroxide;
84//! use peroxide::fuga::*;
85//!
86//! fn main() {
87//!     let a = ml_matrix("1 2;3 4");
88//!     let b = c!(3, 7);
89//!     a.solve(&b, LU).print();    // [1, 1]
90//!     a.solve(&b, WAZ).print();   // [1, 1]
91//! }
92//! ```
93//!
94//! ```
95//! #[macro_use]
96//! extern crate peroxide;
97//! use peroxide::prelude::*;
98//!
99//! fn main() {
100//!     let a = ml_matrix("1 2;3 4");
101//!     let b = c!(3, 7);
102//!     // Prelude can only solve with LU
103//!     a.solve(&b).print();    // [1, 1]
104//! }
105//! ```
106//!
107//! * DataFrame with Parquet
108//!
109//! ```
110//! extern crate peroxide;
111//! use peroxide::fuga::*;
112//!
113//! fn main() {
114//!     let x = seq(0, 1, 0.1);
115//!     let y = x.fmap(|t| t.powi(2));
116//!
117//!     let mut df = DataFrame::new(vec![]);
118//!     df.push("x", Series::new(x));
119//!     df.push("y", Series::new(y));
120//!
121//!     df.print();
122//!
123//!     # #[cfg(feature="parquet")] {
124//!     df.write_parquet("example_data/test.parquet", SNAPPY).unwrap();
125//!     # }
126//! }
127//! ```
128//!
129//! ```
130//! extern crate peroxide;
131//! use peroxide::prelude::*;
132//!
133//! fn main() {
134//!     let x = seq(0, 1, 0.1);
135//!     let y = x.fmap(|t| t.powi(2));
136//!
137//!     let mut df = DataFrame::new(vec![]);
138//!     df.push("x", Series::new(x));
139//!     df.push("y", Series::new(y));
140//!
141//!     df.print();
142//!
143//!     # #[cfg(feature="parquet")] {
144//!     df.write_parquet("example_data/test.parquet").unwrap();
145//!     # }
146//! }
147//! ```
148
149#[allow(unused_imports)]
150pub use crate::macros::{julia_macro::*, matlab_macro::*, r_macro::*};
151
152pub use peroxide_ad::{ad_closure, ad_function};
153
154pub use peroxide_num::{ExpLogOps, PowOps, TrigOps};
155
156pub use crate::traits::{
157    fp::{FPMatrix, FPVector},
158    general::Algorithm,
159    math::{InnerProduct, LinearOp, MatrixProduct, Norm, Normed, Vector, VectorProduct},
160    matrix::{LinearAlgebra, MatrixTrait},
161    mutable::{MutFP, MutMatrix},
162    num::Real,
163    pointer::{MatrixPtr, Oxide, Redox, RedoxCommon},
164    stable::StableFn,
165    sugar::{ConvToMat, Scalable, ScalableMut, VecOps},
166};
167
168#[cfg(feature = "parallel")]
169pub use crate::traits::{
170    fp::{ParallelFPMatrix, ParallelFPVector},
171    math::{
172        ParallelInnerProduct, ParallelMatrixProduct, ParallelNormed, ParallelVector,
173        ParallelVectorProduct,
174    },
175    mutable::ParallelMutFP,
176};
177
178#[cfg(feature = "complex")]
179#[allow(unused_imports)]
180pub use crate::complex::{integral::*, matrix::*, vector::*, C64};
181
182#[allow(unused_imports)]
183#[allow(ambiguous_glob_reexports)]
184pub use crate::structure::{ad::*, dataframe::*, matrix::*, polynomial::*, vector::*};
185
186pub use crate::util::{api::*, low_level::*, non_macro::*, print::*, useful::*, wrapper::*};
187
188#[allow(unused_imports)]
189pub use crate::statistics::{dist::*, ops::*, rand::*, stat::*};
190
191#[allow(unused_imports)]
192pub use crate::special::function::*;
193
194#[allow(unused_imports)]
195pub use crate::numerical::{
196    eigen::*, integral::*, interp::*, ode::*, optimize::*, root::*, spline::*, utils::*,
197};
198
199#[allow(unused_imports)]
200pub use crate::ml::reg::*;
201
202#[allow(unused_imports)]
203#[cfg(feature = "plot")]
204pub use crate::util::plot::*;
205
206pub use anyhow;
207pub use paste;
208pub use rand::prelude::*;
209
210// =============================================================================
211// Enums
212// =============================================================================
213pub use crate::numerical::integral::Integral::{
214    GaussLegendre, NewtonCotes, G10K21, G10K21R, G15K31, G15K31R, G20K41, G20K41R, G25K51, G25K51R,
215    G30K61, G30K61R, G7K15, G7K15R,
216};
217pub use crate::numerical::spline::SlopeMethod::{Akima, Quadratic};
218pub use crate::statistics::stat::Metric::*;
219pub use crate::statistics::stat::QType::{
220    Type1, Type2, Type3, Type4, Type5, Type6, Type7, Type8, Type9,
221};
222pub use crate::structure::ad::AD::*;
223pub use crate::structure::dataframe::DType::*;
224pub use crate::traits::matrix::UPLO::{Lower, Upper};
225pub use crate::traits::matrix::{
226    Form::{Diagonal, Identity},
227    SolveKind::{LU, WAZ},
228};
229
230#[cfg(feature = "parquet")]
231pub use parquet::basic::Compression::*;