Skip to content
higher-kinded numbers
Haskell
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
src/NumHask
test
.ghci
.gitattributes
.gitignore
.hlint.yaml
.projectile
.travis.yml
.weeder.yaml
LICENSE
Setup.hs
numhask-array.cabal
readme.md
stack.yaml

readme.md

numhask-array

Build Status Hackage

Arrays are higher-kinded numbers that can be indexed into with an Int list. Higher-kinded numbers are things with a non-primitive type that we wish to use the usual numerical operators on (+,-,*,/,abs).

This is an experimental library that:

  • allows shape to be specified at both the type and value level.
  • provides operators at value and type level to help manipulate shapes.
  • Provides fixed and dynamic arrays with the same API.

Performance experiments are located in numhask-bench

Usefulness of the array language that results from this treatment is yet to be explored.

API of an array language

https://en.wikipedia.org/wiki/APL_(programming_language)

See http://hiperfit.dk/pdf/array14_final.pdf for context and a sketch of an intermediate typed array language effort.

The operators that result from using the Representable type - separation of size tracking at compile level, from computational at runtime - ends up looking like APL.

Matrix multiplication in APL is +.x and in numhask-array is dot sum (*). There is a slight increase in abstraction by explicitly exposing the fold in the algorithm, but the expressions are both very neat and abstracted away from the specialisation of multiplying matrices.

References

https://blog.plover.com/prog/apl-matrix-product.html

https://en.wikipedia.org/wiki/Tensor_contraction

https://en.wikipedia.org/wiki/Tensor_(intrinsic_definition)#Definition:_Tensor_Product_of_Vector_Spaces

You can’t perform that action at this time.