Skip to content

Releases: libmir/mir-algorithm

v0.8.0

18 Feb 09:11
@9il 9il
Compare
Choose a tag to compare

New modules

New API

  • mir.series (former mir.timeseries) was enhanced with map like primitives and merge function.
  • eachUpper and eachLower was added to mir.ndslice.algorithm by @jmh530
  • antidiagonal was added to mir.ndslice.topology
  • ndslice overloaded operators was improved. [???]-like operators was added fo const and immutable ndslices.

Acknowledgments

  • John Hall
  • Sebastian Wilzbach
  • Shigeki Karita

Part of this work has been sponsored by Symmetry Investments and Kaleidic Associates.

ndslice.fuse, qualifier propagation rework

09 Feb 17:55
@9il 9il
cab488e
Compare
Choose a tag to compare
add mir.ndslice.fuse and a a huge work on qualifier propagation  (#127)

* add mir.qualifier

* ditto

* add mir.qualifier

* ditto

* fix few bugs

* update join

* prepare docs

* fix bugs

* fix optmath

* add import

* fix makefile

* ditto

* ditto

* fix docs

* add fuse instead of join, improve API with fused slices, optimize ndslice.algorithm, fix few minor bugs

* Update spline.d

* Update spline.d

* Update pchip.d

v0.7.0

12 Dec 23:00
Compare
Choose a tag to compare

New Modules since v0.6.21

API Changes since v0.6.21

Removed Modules

  • mir.interpolation, mir.interpolation.linear, mir.interpolation. Migrate to replacements.

Other Changes since v0.6.21

Fixed since v0.7.0-alpha10

  • Fix in mir.ndslice.topology.map for compilation failing in cases where chained map calls couldn't be coalesced due to capturing multiple contexts (seemingly a compiler bug in some cases) #111

Fixed since v0.6.21

v0.7.0-alpha7

31 Oct 14:24
Compare
Choose a tag to compare

Non-LDC simd and asm fixes; fix some memory utils on Windows

Add stdcSlice, stdcUninitSlice

28 Aug 14:43
@9il 9il
Compare
Choose a tag to compare
v0.6.11

Merge branch 'master' of https://github.com/libmir/mir-algorithm

add index operator [] support for const and immutable ndslices

20 Aug 06:32
@9il 9il
Compare
Choose a tag to compare
struct Foo
{
    ContiguousSlice!(1, int) bar;

    int get(size_t i) immutable
    {
        return bar[i];
    }

    int get(size_t i) const
    {
        return bar[i];
    }
}

@safe ndslice; shortcuts; topology.pairwise instead of isSorted and isStrictlyMonotonic

13 May 07:58
@9il 9il
Compare
Choose a tag to compare

Slice is safe now

User-defined iterators must care about their safety except bounds checks.
Bounds are checked in ndslice code.

Deprecations

  • tuple was renamed to refTuple
  • isSorted and isStrictlyMonotonic are deprecated. Use pairwise and all instead.

[float.nan, 1].isSorted is true both for Mir and Phobos, but it must be false.
*.pairwise!"a <= b".all solves this issue explicitly.

import mir.ndslice.algorithm: all;
import mir.ndslice.slice;
import mir.ndslice.sorting: sort;
import mir.ndslice.topology: pairwise;

auto arr = [1, 1, 2].sliced;

assert(arr.pairwise!"a <= b".all);
assert(!arr.pairwise!"a < b".all);

arr = [4, 3, 2, 1].sliced;

assert(!arr.pairwise!"a <= b".all);
assert(!arr.pairwise!"a < b".all);

sort(arr);

assert(arr.pairwise!"a <= b".all);
assert(arr.pairwise!"a < b".all);

New API

  • pairwise - pairwise map for vectors. It is shortcut for topology.slide.
  • Slice.field - returns underlying array for contiguous ndslices
  • Definition shortcuts for Slice
    • UniversalVector
    • ContiguousMatrix
    • CanonicalMatrix
    • UniversalMatrix
    • ContiguousTensor
    • CanonicalTensor
    • UniversalTensor

Interpolation , Time-seres and more

08 May 08:35
@9il 9il
Compare
Choose a tag to compare

New modules

  • mir.interpolation
  • mir.interpolation.linear
  • mir.interpolation.pchip
  • mir.timeseries
  • mir.ndslice.mutation for transposeInPlace

New functions for existing modules

  • mir.ndslice.topology: diff
  • mir.ndslice.topology: slide
  • mir.ndslice.algorithm: findIndex
  • mir.ndslice.algorithm: minPos, maxPos
  • mir.ndslice.algorithm: minIndex, maxIndex
  • mir.ndslice.algorithm: minmaxPos
  • mir.ndslice.algorithm: minmaxIndex

New features

  • Syntax sugar for indexed and cartesian v0.5.1
  • Syntax sugar for map + RefTuple combination v0.5.0
  • Specialisation for map!"a".

Bug fixes

  • front!1/back!1 was wrong for Canonical and Contiguous slices.

Syntax sugar for `indexed` and `cartesian`

05 May 15:18
@9il 9il
Compare
Choose a tag to compare
import mir.ndslice.allocation: slice;
auto sli = slice!int(4, 3);
auto idx = slice!(size_t[2])(3);
idx[] = [
    cast(size_t[2])[0, 2],
    cast(size_t[2])[3, 1],
    cast(size_t[2])[2, 0]];

// equivalent to:
// import mir.ndslice.topology: indexed;
// sli.indexed(indx)[] = 1;
sli[idx][] = 1;

assert(sli == [
    [0, 0, 1],
    [0, 0, 0],
    [1, 0, 0],
    [0, 1, 0],
    ]);

foreach (row; sli[[1, 3].sliced])
    row[] += 2;

assert(sli == [
    [0, 0, 1],
    [2, 2, 2], // <--  += 2
    [1, 0, 0],
    [2, 3, 2], // <--  += 2
    ]);
import mir.ndslice.topology: iota;
import mir.ndslice.allocation: slice;
auto sli = slice!int(5, 6);

// equivalent to
// import mir.ndslice.topology: indexed, cartesian;
// auto a = [0, sli.length!0 / 2, sli.length!0 - 1].sliced;
// auto b = [0, sli.length!1 / 2, sli.length!1 - 1].sliced;
// auto c = cartesian(a, b);
// auto minor = sli.indexed(c);
auto minor = sli[[0, $ / 2, $ - 1].sliced, [0, $ / 2, $ - 1].sliced];

minor[] = iota([3, 3], 1);

assert(sli == [
//   ↓     ↓        ↓︎
    [1, 0, 0, 2, 0, 3], // <---
    [0, 0, 0, 0, 0, 0],
    [4, 0, 0, 5, 0, 6], // <---
    [0, 0, 0, 0, 0, 0],
    [7, 0, 0, 8, 0, 9], // <---
    ]);

Syntax sugar for map + RefTuple combination

02 May 09:06
@9il 9il
Compare
Choose a tag to compare

map on top of ndslice composed of RefTuples recognises it and passes list of args instead of single tuple.

Old:

    auto c = cartesian(a, b)
        .map!"a.a + a.b";

New:

    auto c = cartesian(a, b)
        .map!"a + b";