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