Subwords span upper triangular tables. A subword (i,j) is legal iff i<=j.
NOTE Using more complicated shapes has a number of benefits. We don't need to specify triangular or rectangular tables anymore. A rectangular one-dimensional table with a subword as shape actually does create space as required for subwords.
TODO subword indexing is currently hardcoded to be zero-based. See
TODO consider replacing (
quot 2) with (
TODO all the QuickCheck stuff is missing
A subword wraps a simple pair.
Subwords always yield the upper-triangular part of a rect-angular array.
This gives the quite curious effect that (0,N) points to the `
index, while (0,0) and (N,N) both point to the smallest. We do, however, use
(0,0) as the smallest as (0,k) gives successively smaller upper triangular
|Vector Vector Subword|
|MVector MVector Subword|
|(PrimMonad m, Stack m Subword xs, MPrimArrayOps arr Subword e) => Stack m Subword (:. xs (MutArr m (arr Subword e), Subword -> m e))|
|(Monad m, MPrimArrayOps arr Subword e, Stack m Subword (:. xs (MutArr m (arr Subword e)))) => UpperTriS m (:. xs (MutArr m (arr Subword e)))|
TODO Insert check that all extends are the same!
|Arbitrary z => Arbitrary (:. z Subword)|
|Shape sh => Shape (:. sh Subword)|
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 Subword)|
Size of an upper triangle starting at
i and ending at
j. (0,N) what
be the normal thing to use.