#mathematics #statistics #algebra

mathru

Simple mathematics library written in Rust

9 releases

✓ Uses Rust 2018 edition

0.1.3 Apr 22, 2019
0.1.2 Apr 1, 2019
0.1.1 Mar 24, 2019
0.0.5 Mar 14, 2019
0.0.3 Nov 19, 2018

#109 in Algorithms

Download history 12/week @ 2019-01-07 10/week @ 2019-01-14 3/week @ 2019-01-21 3/week @ 2019-01-28 1/week @ 2019-02-04 1/week @ 2019-02-18 5/week @ 2019-02-25 4/week @ 2019-03-04 34/week @ 2019-03-11 13/week @ 2019-03-18 103/week @ 2019-03-25 26/week @ 2019-04-01 5/week @ 2019-04-08 2/week @ 2019-04-15

67 downloads per month

MIT license

246KB
6K SLoC

mathru

crate documentation minimum rustc 1.32.0


A simple mathematics library written in Rust and supports BLAS/LAPACK.

Implementation

This project is implemented entirely in Rust.

Features

- linear algebra
    - Vector
    - Matrix
        - Basic matrix operations(+,-,*)
        - Transposition
        - LU decomposition (native/lapack)
        - QR decomposition (native/lapack)
        - Hessenberg decomposition (native/lapack)
        - Singular value decomposition
        - Inverse matrix (native/lapack)
        - Determinant (native/lapack)
        - Trace
        - Eigenvalue (native/lapack)

- complex numbers
    - Complex<f32>
    - Complex<f64>

- special functions
    - gamma functions
    - beta functions
- statistics
    - distributions
        - normal distribution
        - gamma distribution
        - binomial distribution
        - poisson distribution
        - exponential distribution
        - chi squared distribution
        - beta distribution
        - bernoulli distribution

- elementary functions
    - trigonometric functions
    - hyperbolic functions
    - exponential

Usage

Add this to your Cargo.toml for the native Rust implementation:

[dependencies.mathru]
version = "0.1.3"
[dependencies.mathru]
version = "0.1.3"
default-features = false
features = ["blaslapack"]

And then import the library using:

extern crate mathru;

Then import the modules and it is ready to be used:

extern crate mathru;
use mathru::algebra::linear::{Matrix};

// Compute the LU decomposition of a 2x2 matrix
let a: Matrix<f64> = Matrix::new(2, 2, vec![1.0, -2.0, 3.0, -7.0]);
let l_ref: Matrix<f64> = Matrix::new(2, 2, vec![1.0, 0.0, 1.0 / 3.0, 1.0]);

let (l, u, p): (Matrix<f64>, Matrix<f64>, Matrix<f64>) = a.dec_lu();

assert_eq!(l_ref, l);

Contributions

Any contribution is welcome!

Dependencies

~13MB
~318K SLoC