4 | %hide Data.Vect.transpose
6 | -- todo this isn't necessary anymore?
7 | -- Needed to define transposition, and diagonal elements
8 | {-
9 | Lists -> not Naperian! Their shape isn't uniform (they can be of different lengths)
10 | Stream -> Naperian, and is represented by Nat
11 | Vect n ->Naperian, and are represented by Fin n
13 | BinTree in general is not Naperian, but if we restrict to trees of a particular shape, then they are Naperian
15 | Naperian functors arise out of containers with a unit shape
16 | * Would ragged shapes imply dependent types?
17 | -}
49 | -- reshapeTensorANap : {shape : Vect n Nat} -> {newShape : Vect m Nat}
50 | -- -> TensorA shape a
51 | -- -> (newShape : Vect n Nat)
52 | -- -> {auto prf : prod shape = prod newShape}
53 | -- -> TensorA newShape a
54 | -- reshapeTensorANap t newShape = let tR = lookup t in tabulate ?aa
55 | --
56 | -- reshapeIndex : {shape : Vect n Nat} -> {newShape : Vect m Nat}
57 | -- -> {auto prf : prod shape = prod newShape}
58 | -- -> IndexT newShape
59 | -- -> IndexT shape
60 | -- reshapeIndex [] = ?reshapeIndex_rhs_0
61 | -- reshapeIndex (x :: xs) = ?reshapeIndex_rhs_1
64 | -- mapNats : {t, t' : Vect n Nat} -> {auto prf : prod t = prod t'}
65 | -- -> Fin (prod t) -> Fin (prod t')
66 | -- mapNats i = ?mapNats_rhs
69 | -- reshapeIndex' : IndexT [2, 3]
70 | -- -> IndexT [6]
71 | -- reshapeIndex' (i :: j :: Nil) = ?yuu :: Nil
73 | -- tensorPositionsEx : TensorA [3, 3, 3] (IndexT [3, 3, 3])
74 | -- tensorPositionsEx = positions
76 | -- not sure how to represent Pair, it's curried?
77 | -- Naperian (Pair) where
78 | -- Log = Bool
79 | -- lookup = pairLookup
80 | -- tabulate f = (f False, f True)
84 | {-
85 | a
86 | x y
88 | a' a''
89 | x' y' x'' y''
91 | transposed would be
94 | a
95 | a' a''
97 | x y
98 | x' x'' y' y''
100 | ---
102 | If it was ragged we would not be able to transpose it
103 | -}