Module peroxide::prelude

source ·
Expand description

Do not disturbed. Just use.

§Philosophy

For complicated computations like as physics, statistics and etc, too many options of library disturbes theory. Many computations where numerical algorithms are not very critical do not require many options. L2 norm is enough, and what integration algorithms you use is not important. prelude makes you free.

§Usage

#[macro_use]
extern crate peroxide;
use peroxide::prelude::*;

// Then you can use almost everything in peroxide.

§Compare with fuga

  • Norm
#[macro_use]
extern crate peroxide;
use peroxide::prelude::*;

fn main() {
    let a = c!(1, 2, 3);
    let l2 = a.norm();      // L2 is default vector norm

    assert_eq!(l2, 14f64.sqrt());
}
#[macro_use]
extern crate peroxide;
use peroxide::fuga::*;

fn main() {
    let a = c!(1, 2, 3);
    let l2 = a.norm(Norm::L2);
    assert_eq!(l2, 14f64.sqrt());
}
  • Numerical integration
#[macro_use]
extern crate peroxide;
use peroxide::prelude::*;
use std::f64::consts::PI;

fn main() {
    let sin = |x: f64| x.sin();
    integrate(sin, (0f64, PI)).print();
    // Default integration = G7K15R(1e-4, 20)
}
#[macro_use]
extern crate peroxide;
use peroxide::fuga::*;
use std::f64::consts::PI;

fn main() {
    let sin = |x: f64| x.sin();
    integrate(sin, (0f64, PI), G7K15R(1e-4, 20)).print();
}
  • Solve
#[macro_use]
extern crate peroxide;
use peroxide::fuga::*;

fn main() {
    let a = ml_matrix("1 2;3 4");
    let b = c!(3, 7);
    a.solve(&b, LU).print();    // [1, 1]
    a.solve(&b, WAZ).print();   // [1, 1]
}
#[macro_use]
extern crate peroxide;
use peroxide::prelude::*;

fn main() {
    let a = ml_matrix("1 2;3 4");
    let b = c!(3, 7);
    // Prelude can only solve with LU
    a.solve(&b).print();    // [1, 1]
}
  • DataFrame with Parquet
extern crate peroxide;
use peroxide::fuga::*;

fn main() {
    let x = seq(0, 1, 0.1);
    let y = x.fmap(|t| t.powi(2));

    let mut df = DataFrame::new(vec![]);
    df.push("x", Series::new(x));
    df.push("y", Series::new(y));

    df.print();

    df.write_parquet("example_data/test.parquet", CompressionOptions::Uncompressed).unwrap();
}
extern crate peroxide;
use peroxide::prelude::*;

fn main() {
    let x = seq(0, 1, 0.1);
    let y = x.fmap(|t| t.powi(2));

    let mut df = DataFrame::new(vec![]);
    df.push("x", Series::new(x));
    df.push("y", Series::new(y));

    df.print();

    df.write_parquet("example_data/test.parquet").unwrap();
}

Re-exports§

  • pub use crate::traits::fp::FPMatrix;
  • pub use crate::traits::fp::FPVector;
  • pub use crate::traits::general::Algorithm;
  • pub use crate::traits::math::InnerProduct;
  • pub use crate::traits::math::LinearOp;
  • pub use crate::traits::math::MatrixProduct;
  • pub use crate::traits::math::Vector;
  • pub use crate::traits::math::VectorProduct;
  • pub use crate::traits::matrix::MatrixTrait;
  • pub use crate::traits::matrix::PQLU;
  • pub use crate::traits::matrix::QR;
  • pub use crate::traits::matrix::WAZD;
  • pub use crate::traits::mutable::MutFP;
  • pub use crate::traits::mutable::MutMatrix;
  • pub use crate::traits::num::Real;
  • pub use crate::traits::pointer::MatrixPtr;
  • pub use crate::traits::pointer::Oxide;
  • pub use crate::traits::pointer::Redox;
  • pub use crate::traits::pointer::RedoxCommon;
  • pub use crate::traits::sugar::ConvToMat;
  • pub use crate::traits::sugar::Scalable;
  • pub use crate::traits::sugar::ScalableMut;
  • pub use crate::traits::sugar::VecOps;
  • pub use simpler::SimpleNorm;
  • pub use crate::structure::dataframe::WithCSV;
  • pub use crate::structure::dataframe::DType;
  • pub use crate::structure::dataframe::DTypeArray;
  • pub use crate::structure::dataframe::DTypeValue;
  • pub use crate::structure::dataframe::DataFrame;
  • pub use crate::structure::dataframe::Scalar;
  • pub use crate::structure::dataframe::Series;
  • pub use crate::structure::dataframe::TypedScalar;
  • pub use crate::structure::dataframe::TypedVector;
  • pub use crate::structure::matrix::combine;
  • pub use crate::structure::matrix::diag;
  • pub use crate::structure::matrix::gemm;
  • pub use crate::structure::matrix::gemv;
  • pub use crate::structure::matrix::gen_householder;
  • pub use crate::structure::matrix::inv_l;
  • pub use crate::structure::matrix::inv_u;
  • pub use crate::structure::matrix::matrix;
  • pub use crate::structure::matrix::ml_matrix;
  • pub use crate::structure::matrix::py_matrix;
  • pub use crate::structure::matrix::r_matrix;
  • pub use crate::structure::matrix::Col;
  • pub use crate::structure::matrix::Matrix;
  • pub use crate::structure::matrix::Row;
  • pub use crate::structure::matrix::Shape;
  • pub use crate::structure::polynomial::lagrange_polynomial;
  • pub use crate::structure::polynomial::legendre_polynomial;
  • pub use crate::structure::polynomial::poly;
  • pub use crate::structure::polynomial::Calculus;
  • pub use crate::structure::polynomial::Polynomial;
  • pub use crate::structure::dataframe::WithNetCDF;
  • pub use crate::complex::C64;
  • pub use simpler::solve;
  • pub use simpler::SimplerLinearAlgebra;
  • pub use crate::special::function::beta;
  • pub use crate::special::function::erf;
  • pub use crate::special::function::erfc;
  • pub use crate::special::function::gamma;
  • pub use crate::special::function::gaussian;
  • pub use crate::special::function::inc_beta;
  • pub use crate::special::function::inc_gamma;
  • pub use crate::special::function::inv_erf;
  • pub use crate::special::function::inv_erfc;
  • pub use crate::special::function::inv_inc_beta;
  • pub use crate::special::function::inv_inc_gamma;
  • pub use crate::special::function::ln_gamma;
  • pub use crate::special::function::phi;
  • pub use crate::special::function::poch;
  • pub use crate::numerical::eigen::Eigen;
  • pub use crate::numerical::spline::cubic_spline;
  • pub use crate::numerical::spline::CubicHermiteSpline;
  • pub use crate::numerical::spline::CubicSpline;
  • pub use crate::numerical::spline::Spline;
  • pub use simpler::chebyshev_polynomial;
  • pub use simpler::cubic_hermite_spline;
  • pub use simpler::eigen;
  • pub use simpler::integrate;
  • pub use simpler::lambert_w0;
  • pub use simpler::lambert_wm1;
  • pub use simpler::SimpleParquet;
  • pub use anyhow;
  • pub use paste;
  • pub use crate::macros::julia_macro::*;
  • pub use crate::macros::matlab_macro::*;
  • pub use crate::macros::r_macro::*;
  • pub use crate::structure::ad::AD::*;
  • pub use crate::structure::ad::*;
  • pub use crate::structure::vector::*;
  • pub use crate::complex::integral::*;
  • pub use crate::complex::matrix::*;
  • pub use crate::complex::vector::*;
  • pub use crate::util::api::*;
  • pub use crate::util::low_level::*;
  • pub use crate::util::non_macro::*;
  • pub use crate::util::print::*;
  • pub use crate::util::useful::*;
  • pub use crate::util::wrapper::*;
  • pub use crate::statistics::dist::*;
  • pub use crate::statistics::ops::*;
  • pub use crate::statistics::rand::*;
  • pub use crate::statistics::stat::*;
  • pub use crate::numerical::interp::*;
  • pub use crate::numerical::ode::*;
  • pub use crate::numerical::optimize::*;
  • pub use crate::numerical::root::*;
  • pub use crate::numerical::utils::*;
  • pub use crate::statistics::stat::Metric::*;
  • pub use crate::util::plot::*;

Modules§

Macros§

Traits§

Attribute Macros§