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

Stability experimental conal@conal.net, andygill@ku.edu

Data.VectorSpace

Description

Vector spaces

Synopsis

# Documentation

class AdditiveGroup v => VectorSpace v s | v -> s whereSource

Vector space `v` over a scalar field `s`. Extends `AdditiveGroup` with scalar multiplication.

Methods

(*^) :: s -> v -> vSource

Scale a vector

Instances

 VectorSpace Double Double VectorSpace Float Float (RealFloat v, VectorSpace v s) => VectorSpace (Complex v) s VectorSpace v s => VectorSpace (a -> v) s (VectorSpace u s, VectorSpace v s) => VectorSpace (u, v) s (HasTrie u, VectorSpace v s, AdditiveGroup (:->: u v)) => VectorSpace (:->: u v) s (HasBasis a s, HasTrie (Basis a), VectorSpace u s, VectorSpace s s) => VectorSpace (:> a u) (:> a s) (VectorSpace u s, VectorSpace v s, VectorSpace w s) => VectorSpace (u, v, w) s

(^/) :: (Fractional s, VectorSpace v s) => v -> s -> vSource

Vector divided by scalar

(^*) :: VectorSpace v s => v -> s -> vSource

Vector multiplied by scalar

class VectorSpace v s => InnerSpace v s whereSource

Methods

(<.>) :: v -> v -> sSource

Inner/dot product

Instances

 InnerSpace Double Double InnerSpace Float Float (RealFloat v, InnerSpace v s, AdditiveGroup s) => InnerSpace (Complex v) s (InnerSpace u s, InnerSpace v s, AdditiveGroup s) => InnerSpace (u, v) s (InnerSpace u s, InnerSpace s s', VectorSpace s s, HasBasis a s, HasTrie (Basis a)) => InnerSpace (:> a u) (:> a s) (InnerSpace u s, InnerSpace v s, InnerSpace w s, AdditiveGroup s) => InnerSpace (u, v, w) s

lerp :: (VectorSpace v s, Num s) => v -> v -> s -> vSource

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

magnitudeSq :: InnerSpace v s => v -> sSource

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

magnitude :: (InnerSpace v s, Floating s) => v -> sSource

Length of a vector. See also `magnitudeSq`.

normalized :: (InnerSpace v s, Floating s) => v -> vSource

Vector in same direction as given one but with length of one. If given the zero vector, then return it.