Data.VectorSpace
 Stability experimental Maintainer conal@conal.net, andygill@ku.edu
Description
Vector spaces
Synopsis
module Data.AdditiveGroup
class AdditiveGroup v => VectorSpace v s | v -> s where
 (*^) :: s -> v -> v
(^/) :: (Fractional s, VectorSpace v s) => v -> s -> v
(^*) :: VectorSpace v s => v -> s -> v
class VectorSpace v s => InnerSpace 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
Documentation
module Data.AdditiveGroup
 class AdditiveGroup v => VectorSpace v s | v -> s where Source
Vector space v over a scalar field s. Extends AdditiveGroup with scalar multiplication.
Methods
 (*^) :: s -> v -> v Source
Scale a vector
Instances
 VectorSpace Double Double VectorSpace Float Float (RealFloat v, VectorSpace v s) => VectorSpace (Complex v) s VectorSpace u s => VectorSpace (Vector2 u) s VectorSpace u s => VectorSpace (Vector3 u) s (VectorSpace u s, VectorSpace v s) => VectorSpace ((,) u v) s (VectorSpace v s, LMapDom u s) => VectorSpace (u :-* v) s (LMapDom a s, VectorSpace u s) => VectorSpace (a :> u) s (LMapDom a s, VectorSpace u s, VectorSpace s s) => VectorSpace (a :> u) (a :> s) (VectorSpace u s, VectorSpace v s, VectorSpace w s) => VectorSpace ((,,) u v w) s
 (^/) :: (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 where Source
Adds inner (dot) products.
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, AdditiveGroup s) => InnerSpace (Vector2 u) s (InnerSpace u s, AdditiveGroup s) => InnerSpace (Vector3 u) s (InnerSpace u s, InnerSpace v s, VectorSpace s s') => InnerSpace ((,) u v) s (InnerSpace u s, InnerSpace s s', VectorSpace s s, LMapDom a s) => InnerSpace (a :> u) (a :> 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
Length of a vector. See also magnitudeSq.
 normalized :: (InnerSpace v s, Floating s) => v -> v Source
Vector in same direction as given one but with length of one. If given the zero vector, then return it.
Produced by Haddock version 2.3.0