Data.VectorSpace
 Stability experimental Maintainer conal@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 where Source
Vector space v over a scalar field s
Methods
 zeroV :: v Source
The zero vector
 (*^) :: s -> v -> v Source
Scale a vector
 (^+^) :: v -> v -> v Source
 negateV :: v -> v Source
Instances
 VectorSpace Double Double VectorSpace Float Float (RealFloat v, VectorSpace v s) => VectorSpace (Complex v) s VectorSpace v s => VectorSpace (a -> v) s (VectorSpace u s, VectorSpace v s) => VectorSpace ((,) u v) s VectorSpace u s => VectorSpace (a :> u) (a :> s) (VectorSpace u s, VectorSpace v s, VectorSpace w s) => VectorSpace ((,,) u v w) s
 (^-^) :: VectorSpace v s => v -> v -> v Source

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

Vector subtraction

 (^/) :: (Fractional s, VectorSpace v s) => v -> s -> v Source
Vector divided by scalar
 (^*) :: VectorSpace v s => v -> s -> v Source
Vector multiplied by scalar
 class VectorSpace v s => InnerSpace v s | v -> s where Source
Methods
 (<.>) :: v -> v -> s Source
Inner/dot product
Instances
 InnerSpace Double Double InnerSpace Float Float (RealFloat v, InnerSpace v s, VectorSpace s s') => InnerSpace (Complex v) s (InnerSpace u s, InnerSpace v s, VectorSpace s s') => InnerSpace ((,) u v) s (InnerSpace u s, InnerSpace v s, InnerSpace w s, VectorSpace s s') => InnerSpace ((,,) u v w) s
 lerp :: (VectorSpace v s, Num s) => v -> v -> s -> v Source
Linear interpolation between a (when t==0) and b (when t==1).
 magnitudeSq :: InnerSpace v s => v -> s Source
Square of the length of a vector. Sometimes useful for efficiency. See also magnitude.
 magnitude :: (InnerSpace v s, Floating s) => v -> s Source