subhask- Type safe interface for programming in subcategories of Hask

Safe HaskellNone



This module defines the algebra over various types of balls in metric spaces



printTriDistances :: (Show (Scalar m), Metric m) => m -> m -> m -> IO () Source

Useful for identifying tree metrics.

printQuadDistances :: (Ord (Scalar t), Show (Scalar t), Metric t) => t -> t -> t -> t -> IO () Source

There are three distinct perfect matchings in every complete 4 node graph. A metric is a tree metric iff two of these perfect matchings have the same weight. This is called the 4 points condition. printQuadDistances :: (Ord (Scalar m), Show (Scalar m), Metric m) => m -> m -> m -> m -> IO ()

data Ball v Source

The closed balls in metric space. Note that since we are not assuming any special structure, addition is rather inefficient.

FIXME: There are several valid ways to perform the addition; which should we use? We could add Lattice instances in a similar way as we could with Box if we added an empty element; should we do this?




radius :: !(Scalar v)
center :: !v

newtype BanachBall v Source

FIXME: In a Banach space we can make Ball addition more efficient by moving the center to an optimal location.


BanachBall (Ball v)