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

Copyright(c) Conal Elliott and Andy J Gill 2008
LicenseBSD3
Maintainerconal@conal.net, andygill@ku.edu
Stabilityexperimental
Safe HaskellSafe
LanguageHaskell98

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 where Source #

Vector space v.

Associated Types

type Scalar v :: * Source #

Methods

(*^) :: Scalar v -> v -> v infixr 7 Source #

Scale a vector

(*^) :: (Generic v, VectorSpace (VRep v), Scalar (VRep v) ~ Scalar v) => Scalar v -> v -> v infixr 7 Source #

Scale a vector

Instances
VectorSpace Double Source # 
Instance details

Defined in Data.VectorSpace

Associated Types

type Scalar Double :: * Source #

VectorSpace Float Source # 
Instance details

Defined in Data.VectorSpace

Associated Types

type Scalar Float :: * Source #

Methods

(*^) :: Scalar Float -> Float -> Float Source #

VectorSpace Int Source # 
Instance details

Defined in Data.VectorSpace

Associated Types

type Scalar Int :: * Source #

Methods

(*^) :: Scalar Int -> Int -> Int Source #

VectorSpace Integer Source # 
Instance details

Defined in Data.VectorSpace

Associated Types

type Scalar Integer :: * Source #

VectorSpace CSChar Source # 
Instance details

Defined in Data.VectorSpace

Associated Types

type Scalar CSChar :: * Source #

VectorSpace CShort Source # 
Instance details

Defined in Data.VectorSpace

Associated Types

type Scalar CShort :: * Source #

VectorSpace CInt Source # 
Instance details

Defined in Data.VectorSpace

Associated Types

type Scalar CInt :: * Source #

Methods

(*^) :: Scalar CInt -> CInt -> CInt Source #

VectorSpace CLong Source # 
Instance details

Defined in Data.VectorSpace

Associated Types

type Scalar CLong :: * Source #

Methods

(*^) :: Scalar CLong -> CLong -> CLong Source #

VectorSpace CLLong Source # 
Instance details

Defined in Data.VectorSpace

Associated Types

type Scalar CLLong :: * Source #

VectorSpace CFloat Source # 
Instance details

Defined in Data.VectorSpace

Associated Types

type Scalar CFloat :: * Source #

VectorSpace CDouble Source # 
Instance details

Defined in Data.VectorSpace

Associated Types

type Scalar CDouble :: * Source #

VectorSpace CIntMax Source # 
Instance details

Defined in Data.VectorSpace

Associated Types

type Scalar CIntMax :: * Source #

VectorSpace v => VectorSpace (Maybe v) Source # 
Instance details

Defined in Data.VectorSpace

Associated Types

type Scalar (Maybe v) :: * Source #

Methods

(*^) :: Scalar (Maybe v) -> Maybe v -> Maybe v Source #

Integral a => VectorSpace (Ratio a) Source # 
Instance details

Defined in Data.VectorSpace

Associated Types

type Scalar (Ratio a) :: * Source #

Methods

(*^) :: Scalar (Ratio a) -> Ratio a -> Ratio a Source #

(RealFloat v, VectorSpace v) => VectorSpace (Complex v) Source # 
Instance details

Defined in Data.VectorSpace

Associated Types

type Scalar (Complex v) :: * Source #

Methods

(*^) :: Scalar (Complex v) -> Complex v -> Complex v Source #

VectorSpace v => VectorSpace (a -> v) Source # 
Instance details

Defined in Data.VectorSpace

Associated Types

type Scalar (a -> v) :: * Source #

Methods

(*^) :: Scalar (a -> v) -> (a -> v) -> a -> v Source #

(VectorSpace u, s ~ Scalar u, VectorSpace v, s ~ Scalar v) => VectorSpace (u, v) Source # 
Instance details

Defined in Data.VectorSpace

Associated Types

type Scalar (u, v) :: * Source #

Methods

(*^) :: Scalar (u, v) -> (u, v) -> (u, v) Source #

(HasTrie a, VectorSpace v) => VectorSpace (a :->: v) Source # 
Instance details

Defined in Data.VectorSpace

Associated Types

type Scalar (a :->: v) :: * Source #

Methods

(*^) :: Scalar (a :->: v) -> (a :->: v) -> a :->: v Source #

(HasTrie (Basis u), VectorSpace v) => VectorSpace (u :-* v) Source # 
Instance details

Defined in Data.LinearMap

Associated Types

type Scalar (u :-* v) :: * Source #

Methods

(*^) :: Scalar (u :-* v) -> (u :-* v) -> u :-* v Source #

(HasBasis a, HasTrie (Basis a), VectorSpace u) => VectorSpace (a :> u) Source # 
Instance details

Defined in Data.Maclaurin

Associated Types

type Scalar (a :> u) :: * Source #

Methods

(*^) :: Scalar (a :> u) -> (a :> u) -> a :> u Source #

VectorSpace a => VectorSpace (Rec0 a s) Source # 
Instance details

Defined in Data.VectorSpace

Associated Types

type Scalar (Rec0 a s) :: * Source #

Methods

(*^) :: Scalar (Rec0 a s) -> Rec0 a s -> Rec0 a s Source #

(VectorSpace u, s ~ Scalar u, VectorSpace v, s ~ Scalar v, VectorSpace w, s ~ Scalar w) => VectorSpace (u, v, w) Source # 
Instance details

Defined in Data.VectorSpace

Associated Types

type Scalar (u, v, w) :: * Source #

Methods

(*^) :: Scalar (u, v, w) -> (u, v, w) -> (u, v, w) Source #

(VectorSpace (f p), VectorSpace (g p), Scalar (f p) ~ Scalar (g p)) => VectorSpace ((f :*: g) p) Source # 
Instance details

Defined in Data.VectorSpace

Associated Types

type Scalar ((f :*: g) p) :: * Source #

Methods

(*^) :: Scalar ((f :*: g) p) -> (f :*: g) p -> (f :*: g) p Source #

(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) Source # 
Instance details

Defined in Data.VectorSpace

Associated Types

type Scalar (u, v, w, x) :: * Source #

Methods

(*^) :: Scalar (u, v, w, x) -> (u, v, w, x) -> (u, v, w, x) Source #

VectorSpace (f p) => VectorSpace (M1 i c f p) Source # 
Instance details

Defined in Data.VectorSpace

Associated Types

type Scalar (M1 i c f p) :: * Source #

Methods

(*^) :: Scalar (M1 i c f p) -> M1 i c f p -> M1 i c f p Source #

(^/) :: (VectorSpace v, s ~ Scalar v, Fractional s) => v -> s -> v infixr 7 Source #

Vector divided by scalar

(^*) :: (VectorSpace v, s ~ Scalar v) => v -> s -> v infixl 7 Source #

Vector multiplied by scalar

class (VectorSpace v, AdditiveGroup (Scalar v)) => InnerSpace v where Source #

Adds inner (dot) products.

Methods

(<.>) :: v -> v -> Scalar v infixr 7 Source #

Inner/dot product

(<.>) :: (Generic v, InnerSpace (VRep v), Scalar (VRep v) ~ Scalar v) => v -> v -> Scalar v infixr 7 Source #

Inner/dot product

Instances
InnerSpace Double Source # 
Instance details

Defined in Data.VectorSpace

InnerSpace Float Source # 
Instance details

Defined in Data.VectorSpace

Methods

(<.>) :: Float -> Float -> Scalar Float Source #

InnerSpace Int Source # 
Instance details

Defined in Data.VectorSpace

Methods

(<.>) :: Int -> Int -> Scalar Int Source #

InnerSpace Integer Source # 
Instance details

Defined in Data.VectorSpace

InnerSpace CSChar Source # 
Instance details

Defined in Data.VectorSpace

InnerSpace CShort Source # 
Instance details

Defined in Data.VectorSpace

InnerSpace CInt Source # 
Instance details

Defined in Data.VectorSpace

Methods

(<.>) :: CInt -> CInt -> Scalar CInt Source #

InnerSpace CLong Source # 
Instance details

Defined in Data.VectorSpace

Methods

(<.>) :: CLong -> CLong -> Scalar CLong Source #

InnerSpace CLLong Source # 
Instance details

Defined in Data.VectorSpace

InnerSpace CFloat Source # 
Instance details

Defined in Data.VectorSpace

InnerSpace CDouble Source # 
Instance details

Defined in Data.VectorSpace

InnerSpace CIntMax Source # 
Instance details

Defined in Data.VectorSpace

InnerSpace a => InnerSpace (Maybe a) Source # 
Instance details

Defined in Data.VectorSpace

Methods

(<.>) :: Maybe a -> Maybe a -> Scalar (Maybe a) Source #

Integral a => InnerSpace (Ratio a) Source # 
Instance details

Defined in Data.VectorSpace

Methods

(<.>) :: Ratio a -> Ratio a -> Scalar (Ratio a) Source #

(RealFloat v, InnerSpace v) => InnerSpace (Complex v) Source # 
Instance details

Defined in Data.VectorSpace

Methods

(<.>) :: Complex v -> Complex v -> Scalar (Complex v) Source #

InnerSpace v => InnerSpace (a -> v) Source # 
Instance details

Defined in Data.VectorSpace

Methods

(<.>) :: (a -> v) -> (a -> v) -> Scalar (a -> v) Source #

(InnerSpace u, s ~ Scalar u, InnerSpace v, s ~ Scalar v) => InnerSpace (u, v) Source # 
Instance details

Defined in Data.VectorSpace

Methods

(<.>) :: (u, v) -> (u, v) -> Scalar (u, v) Source #

(InnerSpace u, s ~ Scalar u, AdditiveGroup s, HasBasis a, HasTrie (Basis a)) => InnerSpace (a :> u) Source # 
Instance details

Defined in Data.Maclaurin

Methods

(<.>) :: (a :> u) -> (a :> u) -> Scalar (a :> u) Source #

InnerSpace a => InnerSpace (Rec0 a s) Source # 
Instance details

Defined in Data.VectorSpace

Methods

(<.>) :: Rec0 a s -> Rec0 a s -> Scalar (Rec0 a s) Source #

(InnerSpace u, s ~ Scalar u, InnerSpace v, s ~ Scalar v, InnerSpace w, s ~ Scalar w) => InnerSpace (u, v, w) Source # 
Instance details

Defined in Data.VectorSpace

Methods

(<.>) :: (u, v, w) -> (u, v, w) -> Scalar (u, v, w) Source #

(InnerSpace (f p), InnerSpace (g p), Scalar (f p) ~ Scalar (g p), Num (Scalar (f p))) => InnerSpace ((f :*: g) p) Source # 
Instance details

Defined in Data.VectorSpace

Methods

(<.>) :: (f :*: g) p -> (f :*: g) p -> Scalar ((f :*: g) p) Source #

(InnerSpace u, s ~ Scalar u, InnerSpace v, s ~ Scalar v, InnerSpace w, s ~ Scalar w, InnerSpace x, s ~ Scalar x) => InnerSpace (u, v, w, x) Source # 
Instance details

Defined in Data.VectorSpace

Methods

(<.>) :: (u, v, w, x) -> (u, v, w, x) -> Scalar (u, v, w, x) Source #

InnerSpace (f p) => InnerSpace (M1 i c f p) Source # 
Instance details

Defined in Data.VectorSpace

Methods

(<.>) :: M1 i c f p -> M1 i c f p -> Scalar (M1 i c f p) Source #

lerp :: VectorSpace v => v -> v -> Scalar v -> v Source #

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

linearCombo :: VectorSpace v => [(v, Scalar v)] -> v Source #

Linear combination of vectors

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

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

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

Length of a vector. See also magnitudeSq.

normalized :: (InnerSpace v, s ~ Scalar v, 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.

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

project u v computes the projection of v onto u.