Introduce homogeneous coordinates

This commit is contained in:
Kiana Sheibani 2022-06-15 00:33:19 -04:00
parent acd0cb6aa5
commit 4b293d7e2a
Signed by: toki
GPG key ID: 6CB106C25E86A9F7
5 changed files with 69 additions and 0 deletions

View file

@ -87,6 +87,10 @@ export
shapeEq : (arr : Array s a) -> s = shape arr
shapeEq (MkArray _ _ _ _) = Refl
export
withShape : {0 s' : Vect rk Nat} -> Array s' a -> ((s : Vect rk Nat) -> Array s a -> b) -> b
withShape arr f = f (shape arr) (rewrite sym (shapeEq arr) in arr)
-- Get a list of all coordinates
getAllCoords' : Vect rk Nat -> List (Vect rk Nat)
getAllCoords' = traverse (\case Z => []; S n => [0..n])