GithubHelp home page GithubHelp logo

jaak-s / sparsematrixproduct Goto Github PK

View Code? Open in Web Editor NEW
0.0 2.0 0.0 2.69 MB

Example Java code for implementing very fast crossproduct for sparse matrixes

License: Apache License 2.0

Java 100.00%

sparsematrixproduct's Introduction

sparseMatrixProduct

Example Java code for implementing very fast crossproduct for sparse (boolean) matrixes.

Benchmark of crossproduct

Summary: SparseBoolMatrix is 3.5x faster compared to Matrix package in R.

Two sparse boolean matrices:

  • m1 of size 204717 x 2759 with 345,434 non-zeros
  • m2 of size 204717 x 4000 with 414,863 non-zeros

Calculation of crossproduct between m1 and m2 ( t(m1) %*% m2 ) using Intel i7-4600M and Ubuntu 13.10.

  • SparseBoolMatrix takes 190ms (Java 7).
  • R Matrix package takes 700ms (R 3.1.0, Matrix_1.1-3).

Measured Java code:

m1.prod( m2 );

Measured R code:

crossprod(m1, m2)

Notes:

  • In R the matrices m1 and m2 are sparse column-oriented matrices (created using sparseMatrix).
  • The Matrix package in R uses SuiteSparse under its hood, so the crossproduct is running in optimised C code.
  • The measured computation time is only for crossproduct (not for loading the matrices or other stuff).

sparsematrixproduct's People

Contributors

jaak-s avatar

Watchers

 avatar  avatar

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.