nervestaple / vectorious

High performance linear algebra.

Home Page:https://mateogianolio.com/vectorious/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

vectorious

Backers on Open Collective Sponsors on Open Collective version CDNJS travis maintainability test coverage

A high performance linear algebra library, written in JavaScript and optimized with C++ bindings to BLAS.

Usage

greenkeeper

In node.js
$ npm install vectorious
var v = require('vectorious'),
    Matrix = v.Matrix,
    Vector = v.Vector,
    BLAS = v.BLAS; // access BLAS routines

Will use your local BLAS copy (if any). Some notes for different operating systems:

In browser

Download a release and use it like this:

<script src="vectorious.min.js"></script>

Or if you prefer to use a CDN:

<script src="https://cdnjs.cloudflare.com/ajax/libs/vectorious/4.8.1/vectorious.min.js"></script>
<script>
  var A = new Matrix([[1], [2], [3]]),
      B = new Matrix([[1, 3, 5]]),
      C = A.multiply(B);

  console.log('C:', C.toArray());
  /* C: [
    [1, 3, 5],
    [2, 6, 10],
    [3, 9, 15]
  ] */
</script>

Examples

Basic

Machine learning

Documentation

The documentation is located in the wiki section of this repository.

Go to wiki.

Benchmarks

Internal benchmarks are located in the wiki section of this repository.

Go to wiki.

Compared to other libraries

Note: I'm in the process of creating better benchmarks and plots. Until then, below you'll find a simple comparison between vectorious and three other popular linear algebra libraries.

The following benchmarks compare Vectorious 4.1.0 with three popular matrix/vector libraries:

The graphs show operations per second on the vertical (y) axis.

Below is a graph comparing the vector operations add, angle, dot, magnitude (aka L2-norm), normalize and scale.

The operations were performed on vectors generated with Vector.random(1048576).

Vector operations

Below is a graph comparing the matrix operations add, scale and transpose.

The operations were performed on matrices generated with Matrix.random(512, 512).

Matrix operations

Contributors

This project exists thanks to all the people who contribute. [Contribute].

Backers

Thank you to all our backers! 🙏 [Become a backer]

Sponsors

Support this project by becoming a sponsor. Your logo will show up here with a link to your website. [Become a sponsor]

About

High performance linear algebra.

https://mateogianolio.com/vectorious/

License:MIT License


Languages

Language:JavaScript 100.0%