mir-algorithm 3.22.4
Dlang Core Library
To use this package, run the following command in your project's root directory:
						Manual usage
						
						Put the following dependency into your project's dependences section:
					
Mir Algorithm
API Documentation
Blogs
- Tasty D - Multidimensional Arrays in D
- Tasty D - Using External D Libraries in D Scripts and Projects
- Tasty D - Pretty-printing D Arrays
- Shigeki Karita - D言語で数値計算 mir-algorithm
- Shigeki Karita - D言語(mir)でNumPyを拡張する (mir-pybuffer integration)
- Mir Blog (deprecated)
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 mir.stdio;
    matrix.writeln;
    // prints [[1.0, 0.0, 0.0, 0.0], [0.0, 1.0, 0.0, 0.0], [0.0, 0.0, 1.0, 6.0]]
}
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);
}
- 3.22.4 released 4 months ago
- libmir/mir-algorithm
- Apache-2.0
- 2020 Ilia Ki, Kaleidic Associates Advisory Limited, Symmetry Investments
- Authors:
- Dependencies:
- mir-core
- Versions:
- 
						
 Show all 635 versions3.22.4 2025-Jun-12 3.22.3 2024-Dec-17 3.22.2 2024-Dec-17 3.22.1 2024-Apr-23 3.22.0 2023-Aug-09 
- Download Stats:
- 
						- 
								96 downloads today 
- 
								868 downloads this week 
- 
								4244 downloads this month 
- 
								790437 downloads total 
 
- 
								
- Score:
- 4.9
- Short URL:
- mir-algorithm.dub.pm