linear-0.4.2.1: Linear Algebra

Safe HaskellSafe-Inferred

Linear.Metric

Synopsis

Documentation

class Applicative f => Metric f whereSource

A free inner product/metric space

Methods

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

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

quadrance :: Num a => f a -> aSource

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

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

Compute the quadrance of the difference

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

Compute the distance between two vectors in a metric space

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

Compute the norm of a vector in a metric space

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

Convert a non-zero vector to unit vector.

normalize :: (Floating a, Metric f, Epsilon a) => f a -> f aSource

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