HORIZON HASKELLDocslts/ghc-10.0.x8fef28d2026-11-02Search packagesCtrl K
Theme: |

GHC 10.0.0.20260917 · lts/ghc-10.0.x · 8fef28d · 2026-11-02

Modulelinear-1.23.3Haskell2010

Linear.Metric

Free metric spaces

Synopsis
  • 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, …