vector-space-0.8.3: Vector & affine spaces, linear maps, and derivatives

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

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 Double 
VectorSpace Float 
(AdditiveGroup (Ratio a), Integral a) => VectorSpace (Ratio a) 
(AdditiveGroup (Complex v), RealFloat v, VectorSpace v) => VectorSpace (Complex v) 
(AdditiveGroup (Maybe v), VectorSpace v) => VectorSpace (Maybe v) 
(AdditiveGroup (a -> v), VectorSpace v) => VectorSpace (a -> v) 
(AdditiveGroup (u, v), VectorSpace u, ~ * s (Scalar u), VectorSpace v, ~ * s (Scalar v)) => VectorSpace (u, v) 
(AdditiveGroup (:->: a v), HasTrie a, VectorSpace v) => VectorSpace (:->: a v) 
(AdditiveGroup (:-* u v), HasTrie (Basis u), VectorSpace v) => VectorSpace (:-* u v) 
(AdditiveGroup (:> a u), HasBasis a, HasTrie (Basis a), VectorSpace u, AdditiveGroup (Scalar u)) => VectorSpace (:> a u) 
(AdditiveGroup (u, v, w), VectorSpace u, ~ * s (Scalar u), VectorSpace v, ~ * s (Scalar v), VectorSpace w, ~ * s (Scalar w)) => VectorSpace (u, v, w) 
(AdditiveGroup (u, v, w, x), VectorSpace u, ~ * s (Scalar u), VectorSpace v, ~ * s (Scalar v), VectorSpace w, ~ * s (Scalar w), VectorSpace x, ~ * s (Scalar x)) => VectorSpace (u, v, w, x) 

(^/) :: (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 
(VectorSpace (Ratio a), Integral a) => InnerSpace (Ratio a) 
(VectorSpace (Complex v), RealFloat v, InnerSpace v, ~ * s (Scalar v), AdditiveGroup s) => InnerSpace (Complex v) 
(VectorSpace (Maybe a), InnerSpace a, AdditiveGroup (Scalar a)) => InnerSpace (Maybe a) 
(VectorSpace (a -> v), InnerSpace v) => InnerSpace (a -> v) 
(VectorSpace (u, v), InnerSpace u, ~ * s (Scalar u), InnerSpace v, ~ * s (Scalar v), AdditiveGroup (Scalar v)) => InnerSpace (u, v) 
(VectorSpace (:> a u), InnerSpace u, ~ * s (Scalar u), AdditiveGroup s, HasBasis a, HasTrie (Basis a)) => InnerSpace (:> a u) 
(VectorSpace (u, v, w), InnerSpace u, ~ * s (Scalar u), InnerSpace v, ~ * s (Scalar v), InnerSpace w, ~ * s (Scalar w), AdditiveGroup s) => InnerSpace (u, v, w) 
(VectorSpace (u, v, w, x), InnerSpace u, ~ * s (Scalar u), InnerSpace v, ~ * s (Scalar v), InnerSpace w, ~ * s (Scalar w), InnerSpace x, ~ * s (Scalar 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.

project :: (InnerSpace v, s ~ Scalar v, Fractional s) => v -> v -> vSource

project u v computes the projection of v onto u.