|
|
|
|
|
|
Synopsis |
|
data a :. b = !a :. !b | | class ShowVec v where | | | type Vec2 a = a :. (a :. ()) | | type Vec3 a = a :. Vec2 a | | type Vec4 a = a :. Vec3 a | | type Vec5 a = a :. Vec4 a | | type Vec6 a = a :. Vec5 a | | type Vec7 a = a :. Vec6 a | | type Vec8 a = a :. Vec7 a | | type Vec9 a = a :. Vec8 a | | type Vec10 a = a :. Vec9 a | | type Vec11 a = a :. Vec10 a | | type Vec12 a = a :. Vec11 a | | type Vec13 a = a :. Vec12 a | | type Vec14 a = a :. Vec13 a | | type Vec15 a = a :. Vec14 a | | type Vec16 a = a :. Vec15 a | | type Vec17 a = a :. Vec16 a | | type Vec18 a = a :. Vec17 a | | type Vec19 a = a :. Vec18 a | | class Vec n a v | n a -> v, v -> n a where | | | vec :: Vec n a v => a -> v | | class Access n a v | v -> a where | get :: n -> v -> a | set :: n -> a -> v -> v |
| | class Head v a | v -> a where | | | class Tail v v_ | v -> v_ where | | | class Map a b u v | u -> a, v -> b, b u -> v, a v -> u where | map :: (a -> b) -> u -> v |
| | class ZipWith a b c u v w | u -> a, v -> b, w -> c, u v c -> w where | zipWith :: (a -> b -> c) -> u -> v -> w |
| | class Fold a v | v -> a where | fold :: (a -> a -> a) -> v -> a | foldl :: (b -> a -> b) -> b -> v -> b | foldr :: (a -> b -> b) -> b -> v -> b |
| | class Reverse' p v v' | p v -> v' where | | | class Append v1 v2 v3 | v1 v2 -> v3, v1 v3 -> v2 where | | | class Take n v v' | n v -> v', n v' -> v where | | | class Drop n v v' | n v -> v', n v' -> v where | | | class Last v a | v -> a where | | | class Snoc v a v' | v a -> v', v' -> v a where | | | sum :: (Fold a v, Num a) => v -> a | | product :: (Fold a v, Num a) => v -> a | | maximum :: (Fold a v, Ord a) => v -> a | | minimum :: (Fold a v, Ord a) => v -> a | | toList :: Fold a v => v -> [a] | | type Mat22 a = Vec2 (Vec2 a) | | type Mat23 a = Vec2 (Vec3 a) | | type Mat24 a = Vec2 (Vec4 a) | | type Mat32 a = Vec3 (Vec2 a) | | type Mat33 a = Vec3 (Vec3 a) | | type Mat34 a = Vec3 (Vec4 a) | | type Mat35 a = Vec3 (Vec5 a) | | type Mat36 a = Vec3 (Vec6 a) | | type Mat42 a = Vec4 (Vec2 a) | | type Mat43 a = Vec4 (Vec3 a) | | type Mat44 a = Vec4 (Vec4 a) | | type Mat45 a = Vec4 (Vec5 a) | | type Mat46 a = Vec4 (Vec6 a) | | type Mat47 a = Vec4 (Vec7 a) | | type Mat48 a = Vec4 (Vec8 a) | | matToLists :: (Fold a v, Fold v m) => m -> [[a]] | | matToList :: (Fold a v, Fold v m) => m -> [a] | | matFromLists :: (Vec j a v, Vec i v m) => [[a]] -> m | | matFromList :: forall i j v m a. (Vec i v m, Vec j a v, Nat i) => [a] -> m |
|
|
Documentation |
|
|
The vector constructor. (:.) for vectors is like (:) for lists, and
() takes the place of []. (The list of instances here is not meant to be
readable.)
| Constructors | | Instances | ZipWith a b c (a' :. u) (b' :. v) (c' :. w) => ZipWith a b c (a :. (a' :. u)) (b :. (b' :. v)) (c :. (c' :. w)) | ZipWith a b c (a :. (a :. as)) (b :. ()) (c :. ()) | ZipWith a b c (a :. ()) (b :. (b :. bs)) (c :. ()) | ZipWith a b c (a :. ()) (b :. ()) (c :. ()) | Snoc () a (a :. ()) | Access N0 a (a :. v) | Vec N1 a (a :. ()) | Alternating N1 a (a :. ()) | (Access n a r, Append p (a :. ()) p', GetDiagonal' (Succ n) p' (r :. m) v) => GetDiagonal' n p (r :. (r :. m)) v | Map a b (a' :. u) (b' :. v) => Map a b (a :. (a' :. u)) (b :. (b' :. v)) | Map a b (a :. ()) (b :. ()) | (Append p (a :. v) x, Append p (a :. ()) y, ReplConsec' a y v z) => ReplConsec' a p (a :. v) (x :. z) | (Access n a r, Append p (a :. ()) (a :. p)) => GetDiagonal' n p (r :. ()) (a :. p) | PackedVec Vec4D (Vec4 Double) | PackedVec Vec3D (Vec3 Double) | PackedVec Vec2D (Vec2 Double) | PackedVec Vec4F (Vec4 Float) | PackedVec Vec3F (Vec3 Float) | PackedVec Vec2F (Vec2 Float) | PackedVec Vec4I (Vec4 Int) | PackedVec Vec3I (Vec3 Int) | PackedVec Vec2I (Vec2 Int) | Fold a (a' :. u) => Fold a (a :. (a' :. u)) | Fold a (a :. ()) | (Fractional a, Map (a :. r) r ((a :. r) :. rs) rs_, Map r (a :. r) rs_ ((a :. r) :. rs), Pivot a ((a :. r) :. ((a :. r) :. rs)), GaussElim a rs_) => GaussElim a ((a :. r) :. ((a :. r) :. rs)) | (Num a, Pivot a (r :. ())) => GaussElim a (r :. ()) | (Fractional a, NearZero a, Pivot1 a rs, Tail (a :. r) r, Map (a :. r) r ((a :. r) :. rs) (r :. rs'), Map r (a :. r) (r :. rs') ((a :. r) :. rs), Pivot1 a ((a :. r) :. rs), Pivot a (r :. rs')) => Pivot a ((a :. r) :. rs) | Pivot a (() :. v) | (Fractional a, NearZero a, Map a a (a :. r) (a :. r), ZipWith a a a (a :. r) (a :. r) (a :. r), Map (a :. r) (a :. r) ((a :. r) :. rs) ((a :. r) :. rs), Pivot1 a ((a :. r) :. rs)) => Pivot1 a ((a :. r) :. ((a :. r) :. rs)) | (Fractional a, NearZero a, Map a a (a :. r) (a :. r)) => Pivot1 a ((a :. (a :. r)) :. ()) | (Fractional a, NearZero a) => Pivot1 a ((a :. ()) :. ()) | (Num a, Num (a :. (a :. (a :. v))), Fold a (a :. (a :. (a :. v))), Alternating (Succ (Succ (Succ n))) a (a :. (a :. (a :. v))), DropConsec (a :. (a :. (a :. v))) vv, Map (a :. (a :. (a :. v))) vv ((a :. (a :. (a :. v))) :. ((a :. (a :. (a :. v))) :. m)) vmt, Transpose vmt vm, Map ((a :. (a :. v)) :. ((a :. (a :. v)) :. m_)) a vm (a :. (a :. (a :. v))), Det' a ((a :. (a :. v)) :. ((a :. (a :. v)) :. m_)), Vec (Succ (Succ (Succ n))) a (a :. (a :. (a :. v))), Vec (Succ (Succ (Succ n))) (a :. (a :. (a :. v))) ((a :. (a :. (a :. v))) :. ((a :. (a :. (a :. v))) :. ((a :. (a :. (a :. v))) :. m)))) => Det' a ((a :. (a :. (a :. v))) :. ((a :. (a :. (a :. v))) :. ((a :. (a :. (a :. v))) :. m))) | Num a => Det' a ((a :. (a :. ())) :. ((a :. (a :. ())) :. ())) | Reverse' (a :. p) v v' => Reverse' p (a :. v) v' | (Append p (a :. v) x, Append p (a :. ()) y, DropConsec' y (a :. v) z) => DropConsec' p (a :. (a :. v)) (x :. z) | DropConsec' p (a :. ()) (p :. ()) | (SetDiagonal' (Succ n) v m, Access n a r) => SetDiagonal' n (a :. v) (r :. m) | Access n a v => Access (Succ n) a (a :. v) | Vec (Succ n) a (a' :. v) => Vec (Succ (Succ n)) a (a :. (a' :. v)) | (Num a, Alternating n a (a :. v)) => Alternating (Succ n) a (a :. (a :. v)) | Take n v v' => Take (Succ n) (a :. v) (a :. v') | (Eq a, Eq b) => Eq (a :. b) | (Fractional a, Ord (a :. u), ZipWith a a a (a :. u) (a :. u) (a :. u), Map a a (a :. u) (a :. u), Vec (Succ l) a (a :. u), Show (a :. u)) => Fractional (a :. u) | (Eq (a :. u), Show (a :. u), Num a, Map a a (a :. u) (a :. u), ZipWith a a a (a :. u) (a :. u) (a :. u), Vec (Succ l) a (a :. u)) => Num (a :. u) | (Ord a, Ord b) => Ord (a :. b) | (Read a, Read b) => Read (a :. b) | (Show a, ShowVec v) => Show (a :. v) | (Vec (Succ (Succ n)) a (a :. (a :. v)), Storable a, Storable (a :. v)) => Storable (a :. (a :. v)) | Storable a => Storable (a :. ()) | (Show a, ShowVec v) => ShowVec (a :. v) | (Map (a :. r) r ((a :. r) :. rs) rs_, Map r (a :. r) rs_ ((a :. r) :. rs), Fold ((,) a (a :. r)) aas, ZipWith a a a (a :. r) (a :. r) (a :. r), Map a a (a :. r) (a :. r), ZipWith a (a :. r) ((,) a (a :. r)) r ((a :. r) :. rs) aas, Num a, BackSubstitute' rs_) => BackSubstitute' ((a :. r) :. ((a :. r) :. rs)) | BackSubstitute' ((a :. r) :. ()) | (Map (a :. r) r ((a :. r) :. rs) rs_, Map r (a :. r) rs_ ((a :. r) :. rs), Fold ((,) a (a :. r)) aas, ZipWith a a a (a :. r) (a :. r) (a :. r), Map a a (a :. r) (a :. r), ZipWith a (a :. r) ((,) a (a :. r)) r ((a :. r) :. rs) aas, Num a, NearZero a, BackSubstitute rs_) => BackSubstitute ((a :. r) :. ((a :. r) :. rs)) | BackSubstitute ((a :. r) :. ()) | Last (a' :. v) a => Last (a :. (a' :. v)) a | Last (a :. ()) a | Tail (a :. as) as | Head (a :. as) a | Transpose' vs vs' => Transpose' (() :. vs) vs' | Snoc v a (a :. v) => Snoc (a :. v) a (a :. (a :. v)) | Append (a' :. v1) v2 v3 => Append (a :. (a' :. v1)) v2 (a :. v3) | Append (a :. ()) v (a :. v) | (Head xss_h xss_hh, Map xss_h xss_hh (xss_h :. xss_t) xs', Tail xss_h xss_ht, Map xss_h xss_ht (xss_h :. xss_t) xss_, Transpose' (xs :. xss_) xss') => Transpose' ((x :. xs) :. (xss_h :. xss_t)) ((x :. xs') :. xss') | Transpose' ((x :. ()) :. ()) ((x :. ()) :. ()) | (Vec (Succ n) s (s :. ra), Vec (Succ m) (s :. ra) ((s :. ra) :. a), Vec (Succ m) s (s :. rb), Vec (Succ n) (s :. rb) ((s :. rb) :. b), Transpose' ((s :. ra) :. a) ((s :. rb) :. b)) => Transpose ((s :. ra) :. a) ((s :. rb) :. b) |
|
|
|
|
Helper to keep parentheses at bay. Just use show as usual.
| | Methods | | | Instances | |
|
|
Vector Types
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class Vec n a v | n a -> v, v -> n a where | Source |
|
The type constraint Vec n a v infers the vector type v from the
length n, a type-level natural, and underlying component type a.
So x :: Vec N4 a v => v declares x to be a 4-vector of as.
| | Methods | | Make a uniform vector of a given length. n is a type-level natural.
Use vec when the length can be inferred.
| | | turn a list into a vector of inferred length
| | | get a vector element, which one is determined at runtime
| | | set a vector element, which one is determined at runtime
|
| | Instances | |
|
|
|
Make a uniform vector. The length is inferred.
|
|
class Access n a v | v -> a where | Source |
|
get or set a vector element, known at compile
time. Use the Nat types to access vector components. For instance, get n0
gets the x component, set n2 44 sets the z component to 44.
| | Methods | | | Instances | |
|
|
List-like functions
|
|
class Head v a | v -> a where | Source |
|
The first element.
| | Methods | | | Instances | |
|
|
class Tail v v_ | v -> v_ where | Source |
|
All but the first element.
| | Methods | | | Instances | |
|
|
class Map a b u v | u -> a, v -> b, b u -> v, a v -> u where | Source |
|
Apply a function over each element in a vector. Constraint Map a b u v
states that u is a vector of as, v is a vector of bs with the same
length as u, and the function is of type a -> b.
| | Methods | map :: (a -> b) -> u -> v | Source |
|
| | Instances | |
|
|
class ZipWith a b c u v w | u -> a, v -> b, w -> c, u v c -> w where | Source |
|
Combine two vectors using a binary function. The length of the result is
the min of the lengths of the arguments. The constraint ZipWith a b c u v
w states that u is a vector of as, v is a vector of bs, w is a
vector of cs, and the binary function is of type a -> b -> c.
| | Methods | zipWith :: (a -> b -> c) -> u -> v -> w | Source |
|
| | Instances | |
|
|
class Fold a v | v -> a where | Source |
|
Fold a function over a vector.
| | Methods | fold :: (a -> a -> a) -> v -> a | Source |
| | foldl :: (b -> a -> b) -> b -> v -> b | Source |
| | foldr :: (a -> b -> b) -> b -> v -> b | Source |
|
| | Instances | |
|
|
class Reverse' p v v' | p v -> v' where | Source |
|
| Methods | reverse' :: p -> v -> v' | Source |
|
| | Instances | |
|
|
class Append v1 v2 v3 | v1 v2 -> v3, v1 v3 -> v2 where | Source |
|
Append two vectors
| | Methods | append :: v1 -> v2 -> v3 | Source |
|
| | Instances | |
|
|
class Take n v v' | n v -> v', n v' -> v where | Source |
|
take n v constructs a vector from the first n elements of v. n is a
type-level natural. For example take n3 v makes a 3-vector of the first
three elements of v.
| | Methods | | | Instances | |
|
|
class Drop n v v' | n v -> v', n v' -> v where | Source |
|
drop n v strips the first n elements from v. n is a type-level
natural. For example drop n2 v drops the first two elements.
| | Methods | | | Instances | |
|
|
class Last v a | v -> a where | Source |
|
Get the last element, usually significant for some reason (quaternions,
homogenous coordinates, whatever)
| | Methods | | | Instances | |
|
|
class Snoc v a v' | v a -> v', v' -> v a where | Source |
|
snoc v a appends the element a to the end of v.
| | Methods | | | Instances | |
|
|
|
sum of vector elements
|
|
|
product of vector elements
|
|
|
maximum vector element
|
|
|
minimum vector element
|
|
|
|
Matrix Types
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
convert a matrix to a list-of-lists
|
|
|
convert a matrix to a list in row-major order
|
|
|
convert a list-of-lists into a matrix
|
|
matFromList :: forall i j v m a. (Vec i v m, Vec j a v, Nat i) => [a] -> m | Source |
|
convert a list into a matrix. (row-major order)
|
|
Produced by Haddock version 2.3.0 |