Skip to content
Dlang Core Library
D C++ Meson
Branch: master
Clone or download

Latest commit

jmh530 Housekeeping (#258)
* Remove tabs

* Fix typo

* Attempt to fix Circle CI failure
Latest commit bed9830 May 25, 2020

Files

Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
.circleci fix ci Mar 29, 2020
cpp_example New documentation engine (#229) Mar 27, 2020
images add logos May 23, 2017
include/mir fix C++ headers Jan 20, 2020
source/mir Housekeeping (#258) May 25, 2020
subprojects rework C++ headers Feb 2, 2019
.gitignore update ci Mar 28, 2020
.gitmodules add documentation generation Feb 6, 2017
.travis.yml Update .travis.yml Apr 23, 2020
LICENSE change license to Boost Dec 26, 2016
README.md Update README.md Apr 23, 2020
appveyor.yml merge with mir-runtime (#222) Nov 26, 2019
dub.sdl secure memory ops (#248) Apr 27, 2020
index.d add mir.date (#236) Apr 19, 2020
meson.build secure memory ops (#248) Apr 27, 2020
ndslice.graffle fix issues #1 #30 and libmir/mir#333 Mar 11, 2017
ndslice.svg fix issues #1 #30 and libmir/mir#333 Mar 11, 2017

README.md

codecov.io Build Status Circle CI

Dub downloads Dub downloads License Latest version Bountysource

Mir Algorithm

API Documentation

Blogs

Mir Type System for .NET

Example (3 sec)

/+dub.sdl:
dependency "mir-algorithm" version="~>2.0.0"
+/

void main()
{
    import mir.ndslice;

    auto matrix = slice!double(3, 4);
    matrix[] = 0;
    matrix.diagonal[] = 1;

    auto row = matrix[2];
    row[3] = 6;
    assert(matrix[2, 3] == 6); // D & C index order
    
    import std.stdio;
    matrix.writeln; // [[1, 0, 0, 0], [0, 1, 0, 0], [0, 0, 1, 6]]
}

Open on run.dlang.io

Example (30 sec)

/+dub.sdl:
dependency "mir-algorithm" version="~>2.0.0"
+/
void main()
{
    import mir.ndslice;
    import std.stdio : writefln;

    enum fmt = "%(%(%.2f %)\n%)\n";

    // Magic sqaure. 
    // `a` is lazy, each element is computed on-demand.
    auto a = magic(5).as!float;
    writefln(fmt, a);

    // 5x5 grid on sqaure [1, 2] x [0, 1] with values x * x + y. 
    // `b` is lazy, each element is computed on-demand.
    auto b = linspace!float([5, 5], [1f, 2f], [0f, 1f]).map!"a * a + b";
    writefln(fmt, b);

    // allocate a 5 x 5 contiguous matrix
    auto c = slice!float(5, 5);

    c[] = transposed(a + b / 2); // no memory allocations here
    // 1. b / 2 - lazy element-wise operation with scalars
    // 2. a + (...) - lazy element-wise operation with other slices
    // Both slices must be `contiguous` or one-dimensional.
    // 3. transposed(...) - trasposes matrix view. The result is `universal` (numpy-like) matrix.
    // 5. c[] = (...) -- performs element-wise assignment.
    writefln(fmt, c);
}

Open on run.dlang.io

Our sponsors

       

You can’t perform that action at this time.