linear-1.8.1: Linear Algebra

Portability portable provisional Edward Kmett Trustworthy

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.

Instances

 Affine [] Affine Maybe Affine Complex Affine ZipList Affine Identity Affine IntMap Affine Vector Affine V0 Affine V1 Affine V2 Affine V3 Affine V4 Affine Plucker Affine Quaternion Affine ((->) b) (Eq k, Hashable k) => Affine (HashMap k) Ord k => Affine (Map k) Dim n => Affine (V n) Additive f => Affine (Point f)

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) Distributive f => Distributive (Point f) Representable f => Representable (Point f) Apply f => Apply (Point f) Bind f => Bind (Point f) Additive f => Additive (Point f) Metric f => Metric (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 :: Lens' (Point g a) (g a)Source

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

Vector spaces have origins.