Copyright | (C) 2012-2015 Edward Kmett |
---|---|
License | BSD-style (see the file LICENSE) |
Maintainer | Edward Kmett <ekmett@gmail.com> |
Stability | experimental |
Portability | non-portable |
Safe Haskell | Trustworthy |
Language | Haskell2010 |
Linear.Metric
Description
Free metric spaces
Documentation
class Additive f => Metric f where Source #
Free and sparse inner product/metric spaces.
Minimal complete definition
Nothing
Methods
dot :: Num a => f a -> f a -> a Source #
Compute the inner product of two vectors or (equivalently)
convert a vector f a
into a covector f a -> a
.
>>>
V2 1 2 `dot` V2 3 4
11
quadrance :: Num a => f a -> a Source #
Compute the squared norm. The name quadrance arises from Norman J. Wildberger's rational trigonometry.
qd :: Num a => f a -> f a -> a Source #
Compute the quadrance of the difference
distance :: Floating a => f a -> f a -> a Source #
Compute the distance between two vectors in a metric space
norm :: Floating a => f a -> a Source #
Compute the norm of a vector in a metric space
signorm :: Floating a => f a -> f a Source #
Convert a non-zero vector to unit vector.
Instances
Metric [] Source # | |
Metric Maybe Source # | |
Defined in Linear.Metric | |
Metric Identity Source # | |
Metric ZipList Source # | |
Metric Vector Source # | |
Metric IntMap Source # | |
Metric V1 Source # | |
Metric V2 Source # | |
Metric V3 Source # | |
Metric V4 Source # | |
Metric V0 Source # | |
Metric Quaternion Source # | |
Defined in Linear.Quaternion Methods dot :: Num a => Quaternion a -> Quaternion a -> a Source # quadrance :: Num a => Quaternion a -> a Source # qd :: Num a => Quaternion a -> Quaternion a -> a Source # distance :: Floating a => Quaternion a -> Quaternion a -> a Source # norm :: Floating a => Quaternion a -> a Source # signorm :: Floating a => Quaternion a -> Quaternion a Source # | |
Metric Plucker Source # | |
(Hashable k, Eq k) => Metric (HashMap k) Source # | |
Defined in Linear.Metric Methods dot :: Num a => HashMap k a -> HashMap k a -> a Source # quadrance :: Num a => HashMap k a -> a Source # qd :: Num a => HashMap k a -> HashMap k a -> a Source # distance :: Floating a => HashMap k a -> HashMap k a -> a Source # norm :: Floating a => HashMap k a -> a Source # signorm :: Floating a => HashMap k a -> HashMap k a Source # | |
Ord k => Metric (Map k) Source # | |
Defined in Linear.Metric | |
Metric f => Metric (Point f) Source # | |
Dim n => Metric (V n) Source # | |
(Metric f, Metric g) => Metric (Product f g) Source # | |
Defined in Linear.Metric Methods dot :: Num a => Product f g a -> Product f g a -> a Source # quadrance :: Num a => Product f g a -> a Source # qd :: Num a => Product f g a -> Product f g a -> a Source # distance :: Floating a => Product f g a -> Product f g a -> a Source # norm :: Floating a => Product f g a -> a Source # signorm :: Floating a => Product f g a -> Product f g a Source # | |
(Metric f, Metric g) => Metric (Compose f g) Source # | |
Defined in Linear.Metric Methods dot :: Num a => Compose f g a -> Compose f g a -> a Source # quadrance :: Num a => Compose f g a -> a Source # qd :: Num a => Compose f g a -> Compose f g a -> a Source # distance :: Floating a => Compose f g a -> Compose f g a -> a Source # norm :: Floating a => Compose f g a -> a Source # signorm :: Floating a => Compose f g a -> Compose f g a Source # |