linear-1.21.5: Linear Algebra

Linear.Affine

Description

Operations on affine spaces.

Synopsis

# Documentation

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

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 :: * -> * Source #

Methods

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

Get the difference between two points as a vector offset.

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

Add a vector offset to a point.

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

Subtract a vector offset from a point.

#### Instances

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

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

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

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

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

Instances details

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

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

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

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

unP :: Point f a -> f a Source #

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

Vector spaces have origins.

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

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