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

Stabilityexperimental
Maintainerconal@conal.net

Data.Basis

Description

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

Synopsis

Documentation

class VectorSpace v s => HasBasis v s whereSource

Associated Types

type Basis v :: *Source

Representation of the canonical basis for v

Methods

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.

Instances

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.