PrimitiveArray-0.5.2.0: Efficient multidimensional arrays

Safe HaskellNone

Data.Array.Repa.Index.Outside

Description

Outside covers subwords for outside calculations. These types of calculations requires quite weird index movements if you want to stay with usual grammars. This remains true if grammars are transformed to Chomsky normal form, only that in said form it is easier to write down the recursions.

TODO basically untested!

Synopsis

Documentation

newtype Outside Source

Outside inverts the usual subword (i,j) system.

TODO do I need to store N ?

Constructors

Outside (Int :. Int) 

Instances

Eq Outside 
Ord Outside 
Show Outside 
Arbitrary Outside 
NFData Outside 
Unbox Outside 
Vector Vector Outside 
MVector MVector Outside 
Arbitrary z => Arbitrary (:. z Outside) 
Shape sh => Shape (:. sh Outside)

Some weird things are going on here. Adding subwords (i,j) and (k,l) yields (i+k,j+l). Normally i==k==0 when calculating space requirements. If you have a subword (3,10) and want the next outer one add (-1,1) and you get what you want. We make NO(!) check that the final subword contains only non-negative indices.

ExtShape sh => ExtShape (:. sh Outside) 

upperTri :: Outside -> IntSource

Size of an upper triangle starting at i and ending at j. (0,N) what be the normal thing to use. Internally, we stell upper triangular matrices.

subwordIndex :: Outside -> Outside -> IntSource

Outside indexing. Given the longest subword and the current subword, calculate a linear index [0,..]. (l,n) in this case means lower bound, length n. And (i,j) is the normal index.

TODO probably doesn't work right with non-zero base ?!