HORIZON HASKELLDocslts/ghc-9.10.xc74966e2026-09-27Search names, modules, packages, or :: a typeCtrl K

GHC 9.10.3 · lts/ghc-9.10.x · c74966e · 2026-09-27

Modulelinear-1.22Haskell2010

Linear.Metric

Free metric spaces

  • 1 class
  • 2 values
  • Packagelinear-1.22
  • Exports3
  • LanguageHaskell2010
  • LicenceBSD-3-Clause
  • SourceMetric.hs
classclass Additive f => Metric (f :: Type -> Type) where
#

Free and sparse inner product/metric spaces.

Methods

  • dot :: Num a => f a -> f a -> a

    Compute the inner product of two vectors or (equivalently) convert a vector f a into a covector f a -> a.

    Example1 expression
    V2 1 2 `dot` V2 3 411
  • quadrance :: Num a => f a -> a

    Compute the squared norm. The name quadrance arises from Norman J. Wildberger's rational trigonometry.

  • qd :: Num a => f a -> f a -> a

    Compute the quadrance of the difference

  • distance :: Floating a => f a -> f a -> a

    Compute the distance between two vectors in a metric space

  • norm :: Floating a => f a -> a

    Compute the norm of a vector in a metric space

  • signorm :: Floating a => f a -> f a

    Convert a non-zero vector to unit vector.

Instances19Metric, …