linear-1.4: Linear Algebra

Portabilityportable
Stabilityprovisional
MaintainerEdward Kmett <ekmett@gmail.com>
Safe HaskellTrustworthy

Linear.Affine

Description

Operations on affine spaces.

Synopsis

Documentation

class Additive (Diff p) => Affine p whereSource

An affine space is roughly a vector space in which we have forgotten or at least pretend to have forgotten the origin.

 a .+^ (b .-. a)  =  b@
 (a .+^ u) .+^ v  =  a .+^ (u ^+^ v)@
 (a .-. b) ^+^ v  =  (a .+^ v) .-. q@

Associated Types

type Diff p :: * -> *Source

Methods

(.-.) :: Num a => p a -> p a -> Diff p aSource

Get the difference between two points as a vector offset.

(.+^) :: Num a => p a -> Diff p a -> p aSource

Add a vector offset to a point.

(.-^) :: Num a => p a -> Diff p a -> p aSource

Subtract a vector offset from a point.

qdA :: (Affine p, Foldable (Diff p), Num a) => p a -> p a -> aSource

Compute the quadrance of the difference (the square of the distance)

distanceA :: (Floating a, Foldable (Diff p), Affine p) => p a -> p a -> aSource

Distance between two points in an affine space

newtype Point f a Source

A handy wrapper to help distinguish points from vectors at the type level

Constructors

P (f a) 

Instances

Monad f => Monad (Point f) 
Functor f => Functor (Point f) 
Applicative f => Applicative (Point f) 
Foldable f => Foldable (Point f) 
Traversable f => Traversable (Point f) 
Generic1 (Point f) 
Apply f => Apply (Point f) 
Bind f => Bind (Point f) 
Additive f => Additive (Point f) 
Metric f => Metric (Point f) 
Core f => Core (Point f) 
R1 f => R1 (Point f) 
R2 f => R2 (Point f) 
R3 f => R3 (Point f) 
R4 f => R4 (Point f) 
Additive f => Affine (Point f) 
Eq (f a) => Eq (Point f a) 
Fractional (f a) => Fractional (Point f a) 
Num (f a) => Num (Point f a) 
Ord (f a) => Ord (Point f a) 
Read (f a) => Read (Point f a) 
Show (f a) => Show (Point f a) 
Ix (f a) => Ix (Point f a) 
Generic (Point f a) 
Storable (f a) => Storable (Point f a) 
Epsilon (f a) => Epsilon (Point f a) 

lensP :: Functor f => (g a -> f (g a)) -> Point g a -> f (Point g a)Source

origin :: (Additive f, Num a) => Point f aSource

Vector spaces have origins.