HORIZON HASKELLDocslts/ghc-10.0.xfc4e5982026-10-11Search names, modules, packages, or :: a typeCtrl K

GHC 10.0.0.20260917 · lts/ghc-10.0.x · fc4e598 · 2026-10-11

Modulelinear-1.23.3Haskell2010

Linear.Metric

Free metric spaces

  • 1 class
  • 2 values
  • Packagelinear-1.23.3
  • 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, …