vector-space-0.16: Vector & affine spaces, linear maps, and derivatives
Copyright (c) Conal Elliott and Andy J Gill 2008
License BSD3
Maintainer conal@conal.net, andygill@ku.edu
Stability experimental
Safe Haskell Safe-Inferred
Language Haskell98

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 .

Minimal complete definition

Nothing

Associated Types

type Scalar v :: * Source #

type Scalar v = Scalar (VRep v)

Methods

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

Scale a vector

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

Instances

Instances details
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 #

VectorSpace Int Source #
Instance details

Defined in Data.VectorSpace

Associated Types

type Scalar 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 #

VectorSpace CLong Source #
Instance details

Defined in Data.VectorSpace

Associated Types

type Scalar 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 #

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

Defined in Data.VectorSpace

Associated Types

type Scalar ( Ratio a) Source #

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

Defined in Data.VectorSpace

Associated Types

type Scalar ( 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 #

( 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 #

( 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.

Minimal complete definition

Nothing

Methods

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

Inner/dot product

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

Instances

Instances details
InnerSpace Double Source #
Instance details

Defined in Data.VectorSpace

InnerSpace Float Source #
Instance details

Defined in Data.VectorSpace

InnerSpace Int Source #
Instance details

Defined in Data.VectorSpace

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

InnerSpace CLong Source #
Instance details

Defined in Data.VectorSpace

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

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

Defined in Data.VectorSpace

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

Defined in Data.VectorSpace

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

( 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 .