Copyright | 2014 Edward Kmett Charles Durham [2015..2020] Trevor L. McDonell |
---|---|
License | BSD-style (see the file LICENSE) |
Maintainer | Trevor L. McDonell <trevor.mcdonell@gmail.com> |
Stability | experimental |
Portability | non-portable |
Safe Haskell | None |
Language | Haskell2010 |
Free metric spaces
Synopsis
- class Metric f => Metric f where
- dot :: forall a. (Num a, Box f a) => Exp (f a) -> Exp (f a) -> Exp a
- quadrance :: forall a. (Num a, Box f a) => Exp (f a) -> Exp a
- qd :: forall a. (Num a, Box f a) => Exp (f a) -> Exp (f a) -> Exp a
- distance :: forall a. (Floating a, Box f a) => Exp (f a) -> Exp (f a) -> Exp a
- norm :: forall a. (Floating a, Box f a) => Exp (f a) -> Exp a
- signorm :: forall a. (Floating a, Box f a) => Exp (f a) -> Exp (f a)
- type IsMetric f a = (Metric f, Box f a)
- normalize :: (Elt (f a), Floating a, IsMetric f a, Epsilon a) => Exp (f a) -> Exp (f a)
- project :: forall f a. (Floating a, IsMetric f a) => Exp (f a) -> Exp (f a) -> Exp (f a)
Documentation
>>>
:set -XPatternSynonyms
>>>
import Data.Array.Accelerate.Linear.V2 ( pattern V2_ )
>>>
import Linear.V2
class Metric f => Metric f where Source #
Free and sparse inner product/metric spaces.
Nothing
dot :: forall a. (Num a, Box f a) => Exp (f a) -> Exp (f a) -> Exp 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 :: Exp (V2 Int)) `dot` (V2_ 3 4 :: Exp (V2 Int))
11
quadrance :: forall a. (Num a, Box f a) => Exp (f a) -> Exp a Source #
Compute the squared norm. The name quadrance arises from Norman J. Wildberger's rational trigonometry.
qd :: forall a. (Num a, Box f a) => Exp (f a) -> Exp (f a) -> Exp a Source #
Compute the quadrance
of the difference
distance :: forall a. (Floating a, Box f a) => Exp (f a) -> Exp (f a) -> Exp a Source #
Compute the distance between two vectors in a metric space
norm :: forall a. (Floating a, Box f a) => Exp (f a) -> Exp a Source #
Compute the norm of a vector in a metric space
signorm :: forall a. (Floating a, Box f a) => Exp (f a) -> Exp (f a) Source #
Convert a non-zero vector to unit vector.