Add more array utility functions

This commit is contained in:
Kiana Sheibani 2022-06-14 20:21:37 -04:00
parent 03d06a42aa
commit acd0cb6aa5
Signed by: toki
GPG key ID: 6CB106C25E86A9F7
4 changed files with 57 additions and 10 deletions

View file

@ -11,6 +11,14 @@ Vector : Nat -> Type -> Type
Vector n = Array [n]
public export
dim : Vector n a -> Nat
dim = head . shape
export
dimEq : (v : Vector n a) -> n = dim v
dimEq v = cong head $ shapeEq v
--------------------------------------------------------------------------------
-- Vector constructors
--------------------------------------------------------------------------------
@ -107,3 +115,4 @@ export
perp : Neg a => Vector 2 a -> Vector 2 a -> a
perp a b = a.x * b.y - a.y * b.x