vector-space-0.0.1: Vector & affine spaces, plusSource codeContentsIndex
Data.VectorSpace
Stabilityexperimental
Maintainerconal@conal.net, andygill@ku.edu
Description
Vector spaces
Synopsis
class VectorSpace v s | v -> s where
zeroV :: v
(*^) :: s -> v -> v
(^+^) :: v -> v -> v
negateV :: v -> v
(^-^) :: VectorSpace v s => v -> v -> v
(^/) :: (Fractional s, VectorSpace v s) => v -> s -> v
(^*) :: VectorSpace v s => v -> s -> v
class VectorSpace v s => InnerSpace v s | v -> s where
(<.>) :: v -> v -> s
lerp :: (VectorSpace v s, Num s) => v -> v -> s -> v
magnitudeSq :: InnerSpace v s => v -> s
magnitude :: (InnerSpace v s, Floating s) => v -> s
normalized :: (InnerSpace v s, Floating s) => v -> v
type :-* a b = a -> b
Documentation
class VectorSpace v s | v -> s whereSource
Vector space v over a scalar field s
Methods
zeroV :: vSource
The zero vector
(*^) :: s -> v -> vSource
Scale a vector
(^+^) :: v -> v -> vSource
Add vectors
negateV :: v -> vSource
Additive inverse
show/hide Instances
(^-^) :: VectorSpace v s => v -> v -> vSource

Convenience. Maybe add methods later. class VectorSpace s s => Scalar s

Vector subtraction

(^/) :: (Fractional s, VectorSpace v s) => v -> s -> vSource
Vector divided by scalar
(^*) :: VectorSpace v s => v -> s -> vSource
Vector multiplied by scalar
class VectorSpace v s => InnerSpace v s | v -> s whereSource
Adds inner (dot) products
Methods
(<.>) :: v -> v -> sSource
Inner/dot product
show/hide Instances
lerp :: (VectorSpace v s, Num s) => v -> v -> s -> vSource
Linear interpolation between a (when t==0) and b (when t==1).
magnitudeSq :: InnerSpace v s => v -> sSource
Square of the length of a vector. Sometimes useful for efficiency. See also magnitude.
magnitude :: (InnerSpace v s, Floating s) => v -> sSource
Length of a vector. See also magnitudeSq.
normalized :: (InnerSpace v s, Floating s) => v -> vSource
Vector in same direction as given one but with length of one. If given the zero vector, then return it.
type :-* a b = a -> bSource
Linear transformations/maps. For now, represented as simple functions. The VectorSpace instance for functions gives the usual meaning for a vector space of linear transformations.
Produced by Haddock version 2.4.2