Linear Algebra Library for Ruby/Numo::NArray
Clone or download
Latest commit da2c864 Jan 10, 2019

Numo::Linalg : Linear Algebra library with BLAS/LAPACK binding to Numo::NArray

Binder Build Status

GitHub | RubyGems

Under development!


This is a binding of BLAS/LAPACK for Numo::NArray using dynamic linking loader. This desgin allows you to change backend libraries without re-compiling.

Numo::Linalg API

  • Matrix and vector products
    • dot, matmul
  • Decomposition
    • lu, lu_fact, lu_inv, lu_solve, ldl, cholesky, cho_fact, cho_inv, cho_solve, qr, svd, svdvals, orth, null_space
  • Matrix eigenvalues
    • eig, eigh, eigvals, eigvalsh
  • Norms and other numbers
    • norm, cond, det, slogdet, matrix_rank, matrix_power
  • Solving equations and inverting matrices
    • solve, lstsq, inv, pinv

Low-level modules


  • Install Numo::NArray

  • Install LAPACK or alternative package.

    • Numo::Linalg requires C-interface CBLAS and LAPACKE interface. These are included in LAPACK package.

    • Recommended: use one of following faster libraries:

    • Note that the performance depends on the backend library as shown in benchmark.

  • Install Numo::Linalg

$ gem install numo-linalg


$ git clone
$ cd linalg
$ rake build
$ gem install pkg/numo-linalg-*.gem


  • Load Numo::Linalg module with default backend:
require "numo/linalg"


  • Masahiro Tanaka
  • Makoto Kishimoto
  • Atsushi Tatsuma


  • This work is partly supported by 2016 Ruby Association Grant.


  • More functions
  • write test
  • Documentation