vector-space-0.7.3: Vector & affine spaces, linear maps, and derivatives (requires ghc 6.9 or better)

Stabilityexperimental
Maintainerconal@conal.net, andygill@ku.edu

Data.VectorSpace

Description

Vector spaces

This version uses associated types instead of fundeps and requires ghc-6.10 or later

Synopsis

Documentation

class AdditiveGroup v => VectorSpace v whereSource

Vector space v.

Associated Types

type Scalar v :: *Source

Methods

(*^) :: Scalar v -> v -> vSource

Scale a vector

Instances

(^/) :: (VectorSpace v, s ~ Scalar v, Fractional s) => v -> s -> vSource

Vector divided by scalar

(^*) :: (VectorSpace v, s ~ Scalar v) => v -> s -> vSource

Vector multiplied by scalar

class VectorSpace v => InnerSpace v whereSource

Adds inner (dot) products.

Methods

(<.>) :: v -> v -> Scalar vSource

Inner/dot product

Instances

InnerSpace Double 
InnerSpace Float 
(s ~ Scalar v, RealFloat v, InnerSpace v, AdditiveGroup s) => InnerSpace (Complex v) 
(InnerSpace a, AdditiveGroup (Scalar a)) => InnerSpace (Maybe a) 
InnerSpace v => InnerSpace (a -> v) 
(s ~ Scalar u, s ~ Scalar v, InnerSpace u, InnerSpace v, AdditiveGroup (Scalar v)) => InnerSpace (u, v) 
(s ~ Scalar u, InnerSpace u, AdditiveGroup s, HasBasis a, HasTrie (Basis a)) => InnerSpace (:> a u) 
(s ~ Scalar u, s ~ Scalar v, s ~ Scalar w, InnerSpace u, InnerSpace v, InnerSpace w, AdditiveGroup s) => InnerSpace (u, v, w) 
(s ~ Scalar u, s ~ Scalar v, s ~ Scalar w, s ~ Scalar x, InnerSpace u, InnerSpace v, InnerSpace w, InnerSpace x, AdditiveGroup s) => InnerSpace (u, v, w, x) 

lerp :: VectorSpace v => v -> v -> Scalar v -> vSource

Linear interpolation between a (when t==0) and b (when t==1).

magnitudeSq :: (InnerSpace v, s ~ Scalar v) => v -> sSource

Square of the length of a vector. Sometimes useful for efficiency. See also magnitude.

magnitude :: (InnerSpace v, s ~ Scalar v, Floating s) => v -> sSource

Length of a vector. See also magnitudeSq.

normalized :: (InnerSpace v, s ~ Scalar v, Floating s) => v -> vSource

Vector in same direction as given one but with length of one. If given the zero vector, then return it.