Copyright | (C) 2012-2015 Edward Kmett |
---|---|

License | BSD-style (see the file LICENSE) |

Maintainer | Edward Kmett <ekmett@gmail.com> |

Stability | experimental |

Portability | non-portable |

Safe Haskell | Trustworthy |

Language | Haskell98 |

Free metric spaces

# Documentation

class Additive f => Metric f where #

Free and sparse inner product/metric spaces.

Nothing

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`

.

`>>>`

11`V2 1 2 `dot` V2 3 4`

dot :: (Foldable f, 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`

.

`>>>`

11`V2 1 2 `dot` V2 3 4`

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.

## Instances

Metric [] # | |

Metric Maybe # | |

Metric ZipList # | |

Metric Identity # | |

Defined in Linear.Metric | |

Metric IntMap # | |

Metric Vector # | |

Metric V1 # | |

Metric V2 # | |

Metric V3 # | |

Metric V4 # | |

Metric V0 # | |

Metric Quaternion # | |

Defined in Linear.Quaternion dot :: Num a => Quaternion a -> Quaternion a -> a # quadrance :: Num a => Quaternion a -> a # qd :: Num a => Quaternion a -> Quaternion a -> a # distance :: Floating a => Quaternion a -> Quaternion a -> a # norm :: Floating a => Quaternion a -> a # signorm :: Floating a => Quaternion a -> Quaternion a # | |

Metric Plucker # | |

Ord k => Metric (Map k) # | |

(Hashable k, Eq k) => Metric (HashMap k) # | |

Defined in Linear.Metric | |

Metric f => Metric (Point f) # | |

Dim n => Metric (V n) # | |

project :: (Metric v, Fractional a) => v a -> v a -> v a #

`project u v`

computes the projection of `v`

onto `u`

.