Giter Club home page Giter Club logo

numeric's Introduction

Crates.io

Numeric Rust

General-purpose N-dimensional matrix class for Rust. It links to OpenBLAS and LAPACK to make tensor operations fast (such as matrix multiplications and linear solvers). It utilizes Rust's move semantics as much as possible to avoid unnecessary copies.

Documentation

Features

Some of the completed and planned features:

  • Element-wise addition, subtraction, multiplication, division
  • Matrix multiplication and scalar product
  • Indexing
  • Slicing
  • Generic (anything from Tensor<bool> to Tensor<f64>)
  • Mathematical functions
  • Linear solver
  • Basic random number generation
  • Creation macro
  • Updating slices
  • Saving/loading HDF5
  • Strided slices
  • Broadcasted axes
  • Basic support for complex numbers
  • Singular Value Decomposition
  • Matrix inverse

Recent progress is summarized in CHANGELOG.md. For planned features, take a look at TODO.md.

Example

#[macro_use(tensor)]
extern crate numeric;

use numeric::Tensor;

fn main() {
    let a: Tensor<f64> = Tensor::range(6).reshape(&[2, 3]);
    let b = tensor![7.0, 3.0, 2.0; -3.0, 2.0, -5.0];
    let c = tensor![7.0, 3.0, 2.0];

    let d = &a + &b;         // a new tensor is returned
    println!("d = {}", d);

    let e = a.dot(&c);       // matrix multiplication (returns a new tensor)
    println!("e = {}", e);

    let f = a + &b;          // a is moved (no new memory is allocated)
    println!("f = {}", f);

    // Higher-dimensional
    let g: Tensor<f64> = Tensor::ones(&[2, 3, 4, 5]);
    println!("g = {}", g);
}

Output:

d =
 7 4 4
 0 6 0
[Tensor<f64> of shape 2x3]
e =
  7 43
[Tensor<f64> of shape 2]
f =
 7 4 4
 0 6 0
[Tensor<f64> of shape 2x3]
g =
...
[Tensor<f64> of shape 2x3x4x5]

Contribute

We love pull requests and there are tons of things to work on for this project. If you want suggestions for contributions, check out TODO.md (a non-exhaustive list of what would be useful additions). Add your name to the CONTRIBUTORS.md file as part of your PR, no matter how small it may seem.

Acknowledgements

Numeric Rust is primarily inspired by Numpy and borrows heavily from that project. Even the name is a play on Numeric Python. Another source of some inspiration is Torch7.

numeric's People

Contributors

gustavla avatar ivanukhov avatar neutronest avatar

Watchers

 avatar  avatar

Forkers

pyzh

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.