linear-accelerate-0.7.0.0: Lifting linear vector spaces into Accelerate

Copyright2014 Edward Kmett Charles Durham
[2015..2020] Trevor L. McDonell
LicenseBSD-style (see the file LICENSE)
MaintainerTrevor L. McDonell <trevor.mcdonell@gmail.com>
Stabilityexperimental
Portabilitynon-portable
Safe HaskellNone
LanguageHaskell2010

Data.Array.Accelerate.Linear.Metric

Description

Free metric spaces

Synopsis

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.

Minimal complete definition

Nothing

Methods

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.

Instances
Metric Plucker Source # 
Instance details

Defined in Data.Array.Accelerate.Linear.Plucker

Methods

dot :: (Num a, Box Plucker a) => Exp (Plucker a) -> Exp (Plucker a) -> Exp a Source #

quadrance :: (Num a, Box Plucker a) => Exp (Plucker a) -> Exp a Source #

qd :: (Num a, Box Plucker a) => Exp (Plucker a) -> Exp (Plucker a) -> Exp a Source #

distance :: (Floating a, Box Plucker a) => Exp (Plucker a) -> Exp (Plucker a) -> Exp a Source #

norm :: (Floating a, Box Plucker a) => Exp (Plucker a) -> Exp a Source #

signorm :: (Floating a, Box Plucker a) => Exp (Plucker a) -> Exp (Plucker a) Source #

Metric Quaternion Source # 
Instance details

Defined in Data.Array.Accelerate.Linear.Quaternion

Metric V0 Source # 
Instance details

Defined in Data.Array.Accelerate.Linear.V0

Methods

dot :: (Num a, Box V0 a) => Exp (V0 a) -> Exp (V0 a) -> Exp a Source #

quadrance :: (Num a, Box V0 a) => Exp (V0 a) -> Exp a Source #

qd :: (Num a, Box V0 a) => Exp (V0 a) -> Exp (V0 a) -> Exp a Source #

distance :: (Floating a, Box V0 a) => Exp (V0 a) -> Exp (V0 a) -> Exp a Source #

norm :: (Floating a, Box V0 a) => Exp (V0 a) -> Exp a Source #

signorm :: (Floating a, Box V0 a) => Exp (V0 a) -> Exp (V0 a) Source #

Metric V4 Source # 
Instance details

Defined in Data.Array.Accelerate.Linear.V4

Methods

dot :: (Num a, Box V4 a) => Exp (V4 a) -> Exp (V4 a) -> Exp a Source #

quadrance :: (Num a, Box V4 a) => Exp (V4 a) -> Exp a Source #

qd :: (Num a, Box V4 a) => Exp (V4 a) -> Exp (V4 a) -> Exp a Source #

distance :: (Floating a, Box V4 a) => Exp (V4 a) -> Exp (V4 a) -> Exp a Source #

norm :: (Floating a, Box V4 a) => Exp (V4 a) -> Exp a Source #

signorm :: (Floating a, Box V4 a) => Exp (V4 a) -> Exp (V4 a) Source #

Metric V3 Source # 
Instance details

Defined in Data.Array.Accelerate.Linear.V3

Methods

dot :: (Num a, Box V3 a) => Exp (V3 a) -> Exp (V3 a) -> Exp a Source #

quadrance :: (Num a, Box V3 a) => Exp (V3 a) -> Exp a Source #

qd :: (Num a, Box V3 a) => Exp (V3 a) -> Exp (V3 a) -> Exp a Source #

distance :: (Floating a, Box V3 a) => Exp (V3 a) -> Exp (V3 a) -> Exp a Source #

norm :: (Floating a, Box V3 a) => Exp (V3 a) -> Exp a Source #

signorm :: (Floating a, Box V3 a) => Exp (V3 a) -> Exp (V3 a) Source #

Metric V2 Source # 
Instance details

Defined in Data.Array.Accelerate.Linear.V2

Methods

dot :: (Num a, Box V2 a) => Exp (V2 a) -> Exp (V2 a) -> Exp a Source #

quadrance :: (Num a, Box V2 a) => Exp (V2 a) -> Exp a Source #

qd :: (Num a, Box V2 a) => Exp (V2 a) -> Exp (V2 a) -> Exp a Source #

distance :: (Floating a, Box V2 a) => Exp (V2 a) -> Exp (V2 a) -> Exp a Source #

norm :: (Floating a, Box V2 a) => Exp (V2 a) -> Exp a Source #

signorm :: (Floating a, Box V2 a) => Exp (V2 a) -> Exp (V2 a) Source #

Metric V1 Source # 
Instance details

Defined in Data.Array.Accelerate.Linear.V1

Methods

dot :: (Num a, Box V1 a) => Exp (V1 a) -> Exp (V1 a) -> Exp a Source #

quadrance :: (Num a, Box V1 a) => Exp (V1 a) -> Exp a Source #

qd :: (Num a, Box V1 a) => Exp (V1 a) -> Exp (V1 a) -> Exp a Source #

distance :: (Floating a, Box V1 a) => Exp (V1 a) -> Exp (V1 a) -> Exp a Source #

norm :: (Floating a, Box V1 a) => Exp (V1 a) -> Exp a Source #

signorm :: (Floating a, Box V1 a) => Exp (V1 a) -> Exp (V1 a) Source #

type IsMetric f a = (Metric f, Box f a) Source #

normalize :: (Elt (f a), Floating a, IsMetric f a, Epsilon a) => Exp (f a) -> Exp (f a) Source #

Normalize a Metric functor to have unit norm. This function does not change the functor if its norm is 0 or 1.

project :: forall f a. (Floating a, IsMetric f a) => Exp (f a) -> Exp (f a) -> Exp (f a) Source #

project u v computes the projection of v onto u.