by libmir

libmir / mir

Mir (backports): Sparse tensors, Hoffman

201 Stars 18 Forks Last release: almost 2 years ago (v3.0.0) Boost Software License 1.0 515 Commits 79 Releases

Available items

No Items, yet!

The developer of this repository has not created any items for sale yet. Need a bug fixed? Help with integration? A different license? Create a request here:

❗️ ndslice was reworked and moved to Mir-Algorithm.

The last Mir version with old ndslice is


❗️ Mir GLAS was moved to https://github.com/libmir/mir-glas.

Dub downloads License Bountysource Latest version codecov.io Circle CI


Generic Numerical Library for Science and Machine Learning.

Separated Mir Projects
  • Mir Algorithm - Multidimensional arrays (ndslice), iterators, algorithms.
  • Mir Random - Professional Random Number Generators
  • Mir GLAS - Linear Algebra Library (Experimental, not supported for now)
  • Mir BLAS - Bindings to libraries with CBLAS API like OpenBLAS and Intel MKL.
  • Mir LAPACK - Bindings to libraries with LAPACK API like OpenBLAS and Intel MKL.
  • Mir Optim - Nonlinear Solvers.
  • Mir CPUID - CPU Identification routines (less buggy then Phobos).


Documentation API can be found here.


  • mir.glas
    - Generic Linear Algebra Subroutines
  • mir.sparse
    Sparse Tensors
    • Sparse
      - DOK format
    • Different ranges for COO format
    • CompressedTensor
      - CSR/CSC formats
  • mir.sparse.blas
    - Sparse BLAS for
  • mir.model.lda.hoffman
    - Online variational Bayes for latent Dirichlet allocation (Online VB LDA) for sparse documents. LDA is used for topic modeling.
  • mir.combinatorics
    Combinations, combinations with repeats, cartesian power, permutations.


| | Linux | Mac OS X | Windows | |-----------|-------|----------|---------| | 64-bit | Build Status | Build Status | Build status | | 32-bit | Build Status | N/A | N/A |


dependency "mir" version="~>3.1.0"
import std.stdio;
import mir.combinatorics;
void main(string[] args)
    writeln([1, 2].combinations);

Fast setup with the dub package manager

Latest version

Dub is the D's package manager. You can create a new project with:

dub init 

Now you need to edit the

as dependency.
    "dependencies": {
        "mir": "~>"
    "dflags-ldc": ["-mcpu=native"]

Now you can create an

file in the
folder and run your code with
dub --compiler=ldmd2
and can be added for a performance boost:
dub --compiler=ldmd2 --build=release

is a shell on top of LDC (LLVM D Compiler).

"dflags-ldc": ["-mcpu=native"]
allows LDC to optimize Mir for your CPU.


See our TODO List. Mir is very young and we are open for contributing to source code, documentation, examples and benchmarks.

We use cookies. If you continue to browse the site, you agree to the use of cookies. For more information on our use of cookies please see our Privacy Policy.