Git Product home page Git Product logo

sukker's Introduction

Sukker - Linear Algebra library written in rust

Build Status Documentation Crates.io Coverage Status Maintenance License

Linear algebra in Rust!

Parallelized using rayon with support for many common datatypes, sukker tries to make matrix operations easier for the user, while still giving you as the user the performance you deserve.

Regular matrices have many features already ready, while Sparse ones have most of them. Whenever you want to switch from one to the other, just call from_dense, or from_sparse to quickly and easily convert!

Need a feature? Please let me/us know!

Even have custom declarative macros to create hashmap for your sparse matrices!

Examples

Dens Matrices

use sukker::{LinAlgFloats, Matrix};

fn main() {
    let a = Matrix::<f32>::randomize((8, 56));
    let b = Matrix::<f32>::randomize((56, 8));

    let c = a.matmul(&b).unwrap();

    let res = c.sin().exp(3).unwrap().pow(2).add_val(4.0).abs();

    // To print this beautiful matrix:
    res.print(5);
}

Sparse Matrices

use std::collections::HashMap;
use sukker::{SparseMatrix, SparseMatrixData};

fn main() {
    let indexes: SparseMatrixData<f64> = smd![
        ((0, 1), 2.0), 
        ((1, 0), 4.0), 
        ((2, 3), 6.0), 
        ((3, 3), 8.0)
    ];

    let sparse = SparseMatrix::<f64>::new(indexes, (4, 4));

    sparse.print(3);
}

More examples can be found here

Documentation

Full API documentation can be found here.

Features

  • Easy to use!
  • Blazingly fast
  • Linear Algebra module fully functional on f32 and f64
  • Optimized matrix multiplication for both sparse and dense matrices
  • Easily able to convert between sparse and dense matrices
  • Serde support
  • Support for all signed numeric datatypes
  • Can be sent over threads
  • Sparse matrices

sukker's People

Contributors

jafagervik avatar

Stargazers

 avatar

Watchers

 avatar

sukker's Issues

Common Decompositions?

First, hats off to you for making a general purpose linear algebra library in Rust. This has been the one thing I have been missing from really digging in.

I use singular value decomposition quite a bit in my work, any chance you might include this as a future target?

Cheers,

JR

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.