diff --git a/.travis.yml b/.travis.yml index 18ed080f..4c3a8422 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,6 +1,5 @@ language: d -dist: trusty -sudo: false +sudo: required packages: - pkg-config d: @@ -15,28 +14,29 @@ branches: env: - ARCH="x86_64" matrix: - # include: - # - {os: linux, d: ldc-beta, env: ARCH="x86", addons: {apt: {packages: [[gcc-multilib]]}}} - # - {os: linux, d: ldc, env: ARCH="x86", addons: {apt: {packages: [[gcc-multilib]]}}} - # - {os: linux, d: dmd-beta, env: ARCH="x86", addons: {apt: {packages: [[gcc-multilib]]}}} - # - {os: linux, d: dmd, env: ARCH="x86", addons: {apt: {packages: [[gcc-multilib]]}}} + include: + - {os: linux, d: ldc-beta, env: ARCH="x86", addons: {apt: {packages: [[gcc-multilib]]}}} + - {os: linux, d: ldc, env: ARCH="x86", addons: {apt: {packages: [[gcc-multilib]]}}} + - {os: linux, d: dmd-beta, env: ARCH="x86", addons: {apt: {packages: [[gcc-multilib]]}}} + - {os: linux, d: dmd, env: ARCH="x86", addons: {apt: {packages: [[gcc-multilib]]}}} allow_failures: - {d: dmd-nightly} - {d: ldc-beta} - {d: gdc} install: - - pyenv global system 3.6 - - pip3 install 'meson>=0.45' - - mkdir .ntmp - - curl -L https://github.com/ninja-build/ninja/releases/download/v1.8.2/ninja-linux.zip -o .ntmp/ninja-linux.zip - - unzip .ntmp/ninja-linux.zip -d .ntmp -before_script: - - export PATH=$PATH:$PWD/.ntmp + - curl -L "https://github.com/ninja-build/ninja/releases/download/v1.7.2/ninja-linux.zip" -o ninja-linux.zip + - sudo unzip ninja-linux.zip -d /usr/local/bin + - sudo chmod 755 /usr/local/bin/ninja + - sudo add-apt-repository -y ppa:deadsnakes/ppa + - sudo apt-get -y update + - sudo apt-get -y install python3.6 + - curl https://bootstrap.pypa.io/get-pip.py | sudo python3.6 + - sudo pip3 install meson script: # - travis_wait 100 dub test --arch "$ARCH" + - travis_wait 100 dub test --arch "$ARCH" --build=unittest-cov - ./test_examples.sh - meson build && cd build && ninja -j4 && ninja -j4 test -v && cd .. # TODO: 32bit meson test -# - travis_wait 100 dub test --arch "$ARCH" --build=unittest-cov # - travis_wait 100 dub test --arch "$ARCH" --build=unittest-release after_success: diff --git a/doc/Makefile b/doc/Makefile index 2726e0d2..08bccc22 100644 --- a/doc/Makefile +++ b/doc/Makefile @@ -29,7 +29,7 @@ MIR_PACKAGES = mir mir/ndslice mir/ndslice/connect mir/internal mir/math mir/mat PACKAGE_mir = bitmanip bitop conv functional primitives range series utility qualifier range -PACKAGE_mir_array = primitives +PACKAGE_mir_array = allocation primitives PACKAGE_mir_combinatorics = package PACKAGE_mir_algorithm = iteration setops PACKAGE_mir_container = binaryheap diff --git a/source/mir/algorithm/iteration.d b/source/mir/algorithm/iteration.d index 102cf5d7..9bf5ca74 100644 --- a/source/mir/algorithm/iteration.d +++ b/source/mir/algorithm/iteration.d @@ -12,8 +12,8 @@ $(T2 cmp, Compares two slices.) $(T2 count, Counts elements in a slices according to a predicate.) $(T2 each, Iterates all elements.) $(T2 eachLower, Iterates lower triangle of matrix.) -$(T2 eachUpper, Iterates upper triangle of matrix.) $(T2 eachUploPair, Iterates upper and lower pairs of elements in square matrix.) +$(T2 eachUpper, Iterates upper triangle of matrix.) $(T2 equal, Compares two slices for equality.) $(T2 find, Finds backward index.) $(T2 findIndex, Finds index.) @@ -24,6 +24,7 @@ $(T2 minIndex, Finds index of the minimum.) $(T2 minmaxIndex, Finds indexes of the minimum and the maximum.) $(T2 minmaxPos, Finds backward indexes of the minimum and the maximum.) $(T2 minPos, Finds backward index of the minimum.) +$(T2 nBitsToCount, Сount bits until set bit count is reached.) $(T2 reduce, Accumulates all elements.) $(T2 uniq, Iterates over the unique elements in a range, which is assumed sorted.) ) @@ -498,6 +499,8 @@ const: } /++ +Сount bits until set bit count is reached. Works with ndslices created with $(REF bitwise, mir,ndslice,topology), $(REF bitSlice, mir,ndslice,allocation). +Returns: bit count if set bit count is reached or `-1` otherwise. +/ sizediff_t nBitsToCount(Field, I)(Slice!(FieldIterator!(BitField!(Field, I))) bitSlice, size_t count) { @@ -1686,6 +1689,8 @@ Params: See_also: $(LREF find), $(LREF any). +Optimization: + `findIndex!"a"` has accelerated specialization for slices created with $(REF bitwise, mir,ndslice,topology), $(REF bitSlice, mir,ndslice,allocation). +/ template findIndex(alias pred) { @@ -1774,6 +1779,9 @@ See_also: $(LREF findIndex), $(LREF any), $(REF Slice.backward, mir,ndslice,slice). + +Optimization: + `find!"a"` has accelerated specialization for slices created with $(REF bitwise, mir,ndslice,topology), $(REF bitSlice, mir,ndslice,allocation). +/ template find(alias pred) { @@ -1946,6 +1954,8 @@ Like $(LREF find), but only returns whether or not the search was successful. Params: pred = The predicate. +Optimization: + `any!"a"` has accelerated specialization for slices created with $(REF bitwise, mir,ndslice,topology), $(REF bitSlice, mir,ndslice,allocation). +/ template any(alias pred = "a") { @@ -2103,7 +2113,8 @@ Checks if all of the elements verify `pred`. Params: pred = The predicate. - +Optimization: + `all!"a"` has accelerated specialization for slices created with $(REF bitwise, mir,ndslice,topology), $(REF bitSlice, mir,ndslice,allocation). +/ template all(alias pred = "a") { diff --git a/source/mir/ndslice/field.d b/source/mir/ndslice/field.d index ce29e524..8506e8bc 100644 --- a/source/mir/ndslice/field.d +++ b/source/mir/ndslice/field.d @@ -7,8 +7,8 @@ An ndslice can be created on top of a field using $(SUBREF slice, slicedField). $(BOOKTABLE $(H2 Fields), $(TR $(TH Field Name) $(TH Used By)) -$(T2 BitpackField, $(SUBREF topology, bitpack)) $(T2 BitField, $(SUBREF topology, bitwise)) +$(T2 BitpackField, $(SUBREF topology, bitpack)) $(T2 CycleField, $(SUBREF topology, cycle) (2 kinds)) $(T2 LinspaceField, $(SUBREF topology, linspace)) $(T2 MagicField, $(SUBREF topology, magic)) diff --git a/source/mir/ndslice/package.d b/source/mir/ndslice/package.d index 686fd60d..60c06d98 100644 --- a/source/mir/ndslice/package.d +++ b/source/mir/ndslice/package.d @@ -127,13 +127,14 @@ $(TR $(TDNW $(SUBMODULE topology) $(BR) $(SUBREF topology, assumeContiguous) $(SUBREF topology, bitpack) $(SUBREF topology, bitwise) - $(SUBREF topology, bytegroup) $(SUBREF topology, blocks) $(SUBREF topology, byDim) - $(SUBREF topology, canonical) - $(SUBREF topology, cartesian) + $(SUBREF topology, bytegroup) $(SUBREF topology, cached) $(SUBREF topology, cachedGC) + $(SUBREF topology, canonical) + $(SUBREF topology, cartesian) + $(SUBREF topology, cycle) $(SUBREF topology, diagonal) $(SUBREF topology, diff) $(SUBREF topology, evertPack) @@ -143,11 +144,12 @@ $(TR $(TDNW $(SUBMODULE topology) $(BR) $(SUBREF topology, ipack) $(SUBREF topology, kronecker) $(SUBREF topology, linspace) + $(SUBREF topology, magic) $(SUBREF topology, map) $(SUBREF topology, mapSubSlices) - $(SUBREF topology, magic) $(SUBREF topology, member) $(SUBREF topology, ndiota) + $(SUBREF topology, orthogonalReduceField) $(SUBREF topology, pack) $(SUBREF topology, pairwise) $(SUBREF topology, pairwiseMapSubSlices) @@ -237,12 +239,14 @@ $(TR $(TDNW $(SUBMODULE iterator) $(TR $(TDNW $(SUBMODULE field) $(BR) $(SMALL Declarations)) $(TD - $(SUBREF field, BitpackField) $(SUBREF field, BitField) + $(SUBREF field, BitpackField) + $(SUBREF field, CycleField) $(SUBREF field, LinspaceField) $(SUBREF field, MagicField) $(SUBREF field, MapField) $(SUBREF field, ndIotaField) + $(SUBREF field, OrthogonalReduceField) $(SUBREF field, RepeatField) ) ) diff --git a/source/mir/ndslice/topology.d b/source/mir/ndslice/topology.d index c9d89f0b..a806d421 100644 --- a/source/mir/ndslice/topology.d +++ b/source/mir/ndslice/topology.d @@ -16,13 +16,16 @@ $(T2 assumeContiguous, Converts a slice to contiguous $(SUBREF slice, SliceKind) $(BOOKTABLE $(H2 Sequence Selectors), $(TR $(TH Function Name) $(TH Description)) -$(T2 repeat, Slice with identical values) +$(T2 cycle, Cycle repeates 1-dimensional field/range/array/slice in a fixed length 1-dimensional slice) $(T2 iota, Contiguous Slice with initial flattened (contiguous) index.) -$(T2 ndiota, Contiguous Slice with initial multidimensional index.) $(T2 linspace, Evenly spaced numbers over a specified interval.) $(T2 magic, Magic square.) +$(T2 ndiota, Contiguous Slice with initial multidimensional index.) +$(T2 repeat, Slice with identical values) ) +. + $(BOOKTABLE $(H2 Products), $(TR $(TH Function Name) $(TH Description)) @@ -1894,7 +1897,7 @@ version(mir_test) unittest } /++ -Cycle creates 1-dimensional slice over the range. +Cycle repeates 1-dimensional field/range/array/slice in a fixed length 1-dimensional slice. +/ auto cycle(Field)(Field field, size_t loopLength, size_t length) if (!isSlice!Field && !is(Field : T[], T)) diff --git a/test_examples.sh b/test_examples.sh index 089592b4..8ec66b66 100755 --- a/test_examples.sh +++ b/test_examples.sh @@ -2,12 +2,10 @@ set -euo pipefail -if [ ! -e test_extractor.d ] ; then - wget https://raw.githubusercontent.com/dlang/tools/6b7ef76d679563e6fccef2a6b437008d96459e95/tests_extractor.d -fi +dub fetch dtools # extract examples -dub ./tests_extractor.d -i source -o out +dub run dtools:tests_extractor -- -i source -o out # compile the examples for file in $(find out -name "*.d") ; do