linear-1.20.7: Linear Algebra

Linear.Affine

Description

Operations on affine spaces.

Synopsis

# Documentation

class Additive (Diff p) => Affine p where #

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@

Minimal complete definition

Associated Types

type Diff p :: * -> * #

Methods

(.-.) :: Num a => p a -> p a -> Diff p a infixl 6 #

Get the difference between two points as a vector offset.

(.+^) :: Num a => p a -> Diff p a -> p a infixl 6 #

Add a vector offset to a point.

(.-^) :: Num a => p a -> Diff p a -> p a infixl 6 #

Subtract a vector offset from a point.

Instances

 Affine [] # Associated Typestype Diff ([] :: * -> *) :: * -> * # Methods(.-.) :: Num a => [a] -> [a] -> Diff [] a #(.+^) :: Num a => [a] -> Diff [] a -> [a] #(.-^) :: Num a => [a] -> Diff [] a -> [a] # # Associated Typestype Diff (Maybe :: * -> *) :: * -> * # Methods(.-.) :: Num a => Maybe a -> Maybe a -> Diff Maybe a #(.+^) :: Num a => Maybe a -> Diff Maybe a -> Maybe a #(.-^) :: Num a => Maybe a -> Diff Maybe a -> Maybe a # # Associated Typestype Diff (Identity :: * -> *) :: * -> * # Methods(.-.) :: Num a => Identity a -> Identity a -> Diff Identity a #(.+^) :: Num a => Identity a -> Diff Identity a -> Identity a #(.-^) :: Num a => Identity a -> Diff Identity a -> Identity a # # Associated Typestype Diff (Complex :: * -> *) :: * -> * # Methods(.-.) :: Num a => Complex a -> Complex a -> Diff Complex a #(.+^) :: Num a => Complex a -> Diff Complex a -> Complex a #(.-^) :: Num a => Complex a -> Diff Complex a -> Complex a # # Associated Typestype Diff (ZipList :: * -> *) :: * -> * # Methods(.-.) :: Num a => ZipList a -> ZipList a -> Diff ZipList a #(.+^) :: Num a => ZipList a -> Diff ZipList a -> ZipList a #(.-^) :: Num a => ZipList a -> Diff ZipList a -> ZipList a # # Associated Typestype Diff (IntMap :: * -> *) :: * -> * # Methods(.-.) :: Num a => IntMap a -> IntMap a -> Diff IntMap a #(.+^) :: Num a => IntMap a -> Diff IntMap a -> IntMap a #(.-^) :: Num a => IntMap a -> Diff IntMap a -> IntMap a # # Associated Typestype Diff (Vector :: * -> *) :: * -> * # Methods(.-.) :: Num a => Vector a -> Vector a -> Diff Vector a #(.+^) :: Num a => Vector a -> Diff Vector a -> Vector a #(.-^) :: Num a => Vector a -> Diff Vector a -> Vector a # # Associated Typestype Diff (V0 :: * -> *) :: * -> * # Methods(.-.) :: Num a => V0 a -> V0 a -> Diff V0 a #(.+^) :: Num a => V0 a -> Diff V0 a -> V0 a #(.-^) :: Num a => V0 a -> Diff V0 a -> V0 a # # Associated Typestype Diff (V1 :: * -> *) :: * -> * # Methods(.-.) :: Num a => V1 a -> V1 a -> Diff V1 a #(.+^) :: Num a => V1 a -> Diff V1 a -> V1 a #(.-^) :: Num a => V1 a -> Diff V1 a -> V1 a # # Associated Typestype Diff (V2 :: * -> *) :: * -> * # Methods(.-.) :: Num a => V2 a -> V2 a -> Diff V2 a #(.+^) :: Num a => V2 a -> Diff V2 a -> V2 a #(.-^) :: Num a => V2 a -> Diff V2 a -> V2 a # # Associated Typestype Diff (V3 :: * -> *) :: * -> * # Methods(.-.) :: Num a => V3 a -> V3 a -> Diff V3 a #(.+^) :: Num a => V3 a -> Diff V3 a -> V3 a #(.-^) :: Num a => V3 a -> Diff V3 a -> V3 a # # Associated Typestype Diff (V4 :: * -> *) :: * -> * # Methods(.-.) :: Num a => V4 a -> V4 a -> Diff V4 a #(.+^) :: Num a => V4 a -> Diff V4 a -> V4 a #(.-^) :: Num a => V4 a -> Diff V4 a -> V4 a # # Associated Typestype Diff (Plucker :: * -> *) :: * -> * # Methods(.-.) :: Num a => Plucker a -> Plucker a -> Diff Plucker a #(.+^) :: Num a => Plucker a -> Diff Plucker a -> Plucker a #(.-^) :: Num a => Plucker a -> Diff Plucker a -> Plucker a # # Associated Typestype Diff (Quaternion :: * -> *) :: * -> * # Methods(.-.) :: Num a => Quaternion a -> Quaternion a -> Diff Quaternion a #(.+^) :: Num a => Quaternion a -> Diff Quaternion a -> Quaternion a #(.-^) :: Num a => Quaternion a -> Diff Quaternion a -> Quaternion a # Affine ((->) b) # Associated Typestype Diff ((->) b :: * -> *) :: * -> * # Methods(.-.) :: Num a => (b -> a) -> (b -> a) -> Diff ((->) b) a #(.+^) :: Num a => (b -> a) -> Diff ((->) b) a -> b -> a #(.-^) :: Num a => (b -> a) -> Diff ((->) b) a -> b -> a # Ord k => Affine (Map k) # Associated Typestype Diff (Map k :: * -> *) :: * -> * # Methods(.-.) :: Num a => Map k a -> Map k a -> Diff (Map k) a #(.+^) :: Num a => Map k a -> Diff (Map k) a -> Map k a #(.-^) :: Num a => Map k a -> Diff (Map k) a -> Map k a # (Eq k, Hashable k) => Affine (HashMap k) # Associated Typestype Diff (HashMap k :: * -> *) :: * -> * # Methods(.-.) :: Num a => HashMap k a -> HashMap k a -> Diff (HashMap k) a #(.+^) :: Num a => HashMap k a -> Diff (HashMap k) a -> HashMap k a #(.-^) :: Num a => HashMap k a -> Diff (HashMap k) a -> HashMap k a # Additive f => Affine (Point f) # Associated Typestype Diff (Point f :: * -> *) :: * -> * # Methods(.-.) :: Num a => Point f a -> Point f a -> Diff (Point f) a #(.+^) :: Num a => Point f a -> Diff (Point f) a -> Point f a #(.-^) :: Num a => Point f a -> Diff (Point f) a -> Point f a # Dim * n => Affine (V * n) # Associated Typestype Diff (V * n :: * -> *) :: * -> * # Methods(.-.) :: Num a => V * n a -> V * n a -> Diff (V * n) a #(.+^) :: Num a => V * n a -> Diff (V * n) a -> V * n a #(.-^) :: Num a => V * n a -> Diff (V * n) a -> V * n a #

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

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

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

Distance between two points in an affine space

newtype Point f a #

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

Constructors

 P (f a)

Instances

lensP :: Lens' (Point g a) (g a) #

_Point :: Iso' (Point f a) (f a) #

(.#) :: Coercible b a => (b -> c) -> (a -> b) -> a -> c #

(#.) :: Coercible c b => (b -> c) -> (a -> b) -> a -> c #

unP :: Point f a -> f a #

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

Vector spaces have origins.

relative :: (Additive f, Num a) => Point f a -> Iso' (Point f a) (f a) #

An isomorphism between points and vectors, given a reference point.