Skip to content

Commit

Permalink
Merge pull request #115 from lehins/v1.0-dl-switch-to-st
Browse files Browse the repository at this point in the history
v1.0.0
  • Loading branch information
lehins committed Aug 1, 2021
2 parents 3a76215 + 11604bc commit 28f174f
Show file tree
Hide file tree
Showing 125 changed files with 5,402 additions and 4,970 deletions.
118 changes: 0 additions & 118 deletions .azure/job.yml

This file was deleted.

58 changes: 0 additions & 58 deletions .azure/pipelines.yml

This file was deleted.

2 changes: 1 addition & 1 deletion .github/ISSUE_TEMPLATE/feature_request.md
@@ -1,6 +1,6 @@
---
name: Feature Request
about: Request a feature be added to massiv or massiv-io
about: Request a feature be added to massiv
---

Make sure that you are using the latest release: https://hackage.haskell.org/package/massiv
Expand Down
2 changes: 1 addition & 1 deletion .github/PULL_REQUEST_TEMPLATE.md
@@ -1,4 +1,4 @@
Please include this checklist whenever changes are introduced to either `massiv` or `massiv-io` packages:
Please include this checklist whenever changes are introduced to either `massiv` or `massiv-test` packages:

* [ ] Bump up the version in cabal file
* [ ] Any changes that could be relevant to users have been recorded in the `CHANGELOG.md`
Expand Down
24 changes: 20 additions & 4 deletions .github/workflows/haskell.yml
Expand Up @@ -18,7 +18,7 @@ jobs:
fail-fast: false
matrix:
os: [ubuntu-latest]
resolver: [nightly, lts-17, lts-16, lts-14, lts-12]
resolver: [nightly, lts-18, lts-16, lts-14, lts-12]
include:
- resolver: lts-12
ghc: 8.4.4
Expand All @@ -27,15 +27,18 @@ jobs:
stack-yaml: stack-extra-deps.yaml
- resolver: lts-16
ghc: 8.8.4
- resolver: lts-17
stack-yaml: stack-extra-deps.yaml
- resolver: lts-18
ghc: 8.10.4

# Latest stable for MacOS: ghc-8.8.4
- resolver: lts-16
os: macos-latest
stack-yaml: stack-extra-deps.yaml
# Latest stable for Windows: ghc-8.6.4
- resolver: lts-14
os: windows-latest
stack-yaml: stack-extra-deps.yaml

env:
STACK_YAML: stack.yaml
Expand Down Expand Up @@ -96,6 +99,18 @@ jobs:
[ -n "${{ matrix.ghc }}" ] && [ "${{ matrix.os }}" == "ubuntu-latest" ] && STACK_ARGS="$STACK_ARGS --system-ghc"
[ -n "${{ matrix.stack-yaml }}" ] && STACK_YAML=${{ matrix.stack-yaml }}
stack $STACK_ARGS runghc git-modtime.hs
- name: Build
env:
COVERALLS_TOKEN: ${{ secrets.COVERALLS_TOKEN }}
run: |
set -ex
[ -n "${{ matrix.ghc }}" ] && [ "${{ matrix.os }}" == "ubuntu-latest" ] && STACK_ARGS="$STACK_ARGS --system-ghc"
[ -n "${{ matrix.stack-yaml }}" ] && STACK_YAML=${{ matrix.stack-yaml }}
if [ "${{ matrix.os }}.${{ matrix.resolver }}" == "ubuntu-latest.lts-14" ] && [ -n "${COVERALLS_TOKEN}" ]; then
stack $STACK_ARGS build massiv-test:tests --coverage --test --no-run-tests --haddock --no-haddock-deps
else
stack $STACK_ARGS build --test --no-run-tests --bench --no-run-benchmarks --haddock --no-haddock-deps
fi
- name: Tests
env:
COVERALLS_TOKEN: ${{ secrets.COVERALLS_TOKEN }}
Expand All @@ -109,15 +124,16 @@ jobs:
curl -L https://github.com/rubik/stack-hpc-coveralls/releases/download/v0.0.6.1/shc-linux-x64-8.8.4.tar.bz2 | tar xj shc
./shc --repo-token="$COVERALLS_TOKEN" --partial-coverage --fetch-coverage combined custom
else
stack $STACK_ARGS test massiv-test:tests massiv:doctests --bench --no-run-benchmarks --haddock --no-haddock-deps
stack $STACK_ARGS test massiv:doctests
stack $STACK_ARGS test massiv-test:tests
fi
massiv-examples:

runs-on: ubuntu-latest

env:
STACK_ARGS: '--resolver lts-16.31'
STACK_ARGS: '--resolver lts-18.3'
steps:
- uses: actions/checkout@v2

Expand Down
1 change: 1 addition & 0 deletions .gitignore
Expand Up @@ -18,3 +18,4 @@ cabal.sandbox.config
.stack-work*
cabal.project.local
bench-*.html
massiv-examples/files/*
46 changes: 16 additions & 30 deletions Quickref.md
Expand Up @@ -4,10 +4,10 @@

Everyone is well accustomed to the fact that the order of indices corresponds to the number of
dimensions an array can have in the reverse order, eg in `C`: `arr[i][j][k]` will mean that a
3-dimensional array is indexed at an outer most 3rd dimension with index `i`, 2nd dimension `j` and
the inner most 1st dimension `k`. In case of a 3d world `i` points to a page, `j` to a column and
`k` to the row, but the astraction scales pretty well to any dimension as long as we agree on the
order of things. Below are two ways to index an array in massiv:
3-dimensional array is indexed at an outermost 3rd dimension with index `i`, 2nd dimension `j` and
the innermost 1st dimension `k`. In the case of a 3D world `i` points to a page, `j` to a row and
`k` to a column, but the astraction scales naturally to any dimension as long as we agree on the
order of things. Below are various ways to index an array in massiv:

```haskell
λ> arr = makeArrayR U Seq (Sz (2 :> 3 :. 4)) $ \ (i :> j :. k) -> i + j ^ k
Expand All @@ -16,41 +16,27 @@ order of things. Below are two ways to index an array in massiv:
λ> arr !> 1 !> 2
(Array M Seq (Sz1 (4))
[ 2,3,5,9 ])
λ> arr !> 1 !> 2 !> 3
λ> arr !> 1 !> 2 ! 3
9
```

Former does the lookup of an element in the array, while the latter slices the array until it gets to
the actual element. Normally they are equivalent, but since implemnetation i svastly different,
difference in performance could be expected.
Former does the lookup of an element in the array, while the latter slices the array until it gets
to a row and only then looks up the actual element.

Most important thing to agree upon is the fact that at the end of the day we do represent data in a
linear row-major fashion, so the above indexing technique translates into a linear index that will
get mapped into an element in memory at some point.
Data is represented in a linear row-major fashion, so the above indexing technique translates into a
linear index that will get mapped into an element in memory at some point.


## Hierarchy

### Class dependency

```
Construct (D, DL, DS, DI, DW, B, N, P, U, S, LN) -> Ragged (L)
\
Load (DL, DS, DI, DW, L, LN) -> Source (D) -> Manifest (M) -`-> Mutable (B, N, P, U, S)
|\
| `> StrideLoad (D, DI, DW, M, B, N, P, U, S)
|\
| `> Extract (D, DS, DI, M, B, N, P, U, S)
|\
| `> Slice (D, M, B, N, P, U, S)
|\
| `> OuterSlice (D, M, B, N, P, U, S, L)
\
`> InnerSlice (D, M, B, N, P, U, S)
Stream (D, DS, B, N, P, U, S, L, LN)
Resize (D, DL, DI, B, N, P, U, S)
Size (D, DL, DI, B, BN, BL, P, U, S)
Shape (D, DL, DS, DI, DW, B, BN, BL, P, U, S, L, LN)
StrideLoad (DI, DW) -> Load (DL, DS, L) -> Source (D) -> Manifest (B, BN, BL, P, U, S)
\
`-> Stream (D, B, BN, BL, P, U, S, L)
```

## Computation
Expand All @@ -62,7 +48,7 @@ to that:
construction or conversion, eg. from a list or vector
* array computation strategy will be combined according to its `Monoid` instance when two or more
arrays are being joined together by some operation into another one.
* Most of functions will respect the inner computation strategy, while other will ignore it due to
* Most functions will respect the inner computation strategy, while others will ignore it due to
their specific nature.

## Naming Conventions
Expand Down Expand Up @@ -106,7 +92,7 @@ argument. Functions with the `Inner` suffix use dimension `1`.
### Conversion from `array`

Here is an example of how to convert a nested boxed array from `array` package to a
rectangular `Matrix` with parallellization:
rectangular `Matrix` with parallelization:


```haskell
Expand Down

0 comments on commit 28f174f

Please sign in to comment.