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




Basis of a vector space, as an associated type. This version works with Data.VectorSpace, thus avoiding a bug in ghc-6.9..



class VectorSpace v s => HasBasis v s whereSource

Associated Types

type Basis v :: *Source

Representation of the canonical basis for v


basisValue :: Basis v -> vSource

Interpret basis rep as a vector

decompose :: v -> [(Basis v, s)]Source

Extract coordinates

decompose' :: v -> Basis v -> sSource

Experimental version. More elegant definitions, and friendly to infinite-dimensional vector spaces.


HasBasis Double Double 
HasBasis Float Float 
(Eq a, HasBasis u s) => HasBasis (a -> u) s 
(HasBasis u s, HasBasis v s) => HasBasis (u, v) s 
(HasBasis u s, HasBasis v s, HasBasis w s) => HasBasis (u, v, w) s 

linearCombo :: VectorSpace v s => [(v, s)] -> vSource

Linear combination

recompose :: HasBasis v s => [(Basis v, s)] -> vSource

Turn a basis decomposition back into a vector.