Introduce homogeneous coordinates
This commit is contained in:
parent
acd0cb6aa5
commit
4b293d7e2a
5 changed files with 69 additions and 0 deletions
|
|
@ -19,6 +19,10 @@ export
|
|||
dimEq : (v : Vector n a) -> n = dim v
|
||||
dimEq v = cong head $ shapeEq v
|
||||
|
||||
export
|
||||
withDim : {0 n' : Nat} -> Vector n' a -> ((n : Nat) -> Vector n a -> b) -> b
|
||||
withDim v f = f (dim v) (rewrite sym (dimEq v) in v)
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
-- Vector constructors
|
||||
--------------------------------------------------------------------------------
|
||||
|
|
@ -31,6 +35,11 @@ vector v = rewrite sym (lengthCorrect v)
|
|||
rewrite lengthCorrect v in -- there is only 1 axis
|
||||
rewrite multOneLeftNeutral n in v
|
||||
|
||||
export
|
||||
toVect : Vector n a -> Vect n a
|
||||
toVect v = believe_me $ Vect.fromList $ toList v
|
||||
|
||||
|
||||
export
|
||||
basis : Num a => {n : _} -> (i : Fin n) -> Vector n a
|
||||
basis i = fromFunction _ (\[j] => if i == j then 1 else 0)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue