manifolds-0.4.5.0: Coordinate-free hypersurfaces

Copyright(c) Justus Sagemüller 2015
LicenseGPL v3
Maintainer(@) sagemueller $ geo.uni-koeln.de
Stabilityexperimental
Portabilityportable
Safe HaskellNone
LanguageHaskell2010

Data.SimplicialComplex

Contents

Description

 

Synopsis

Simplices

data Simplex :: Nat -> * -> * where Source #

An n-simplex is a connection of n+1 points in a simply connected region of a manifold.

Constructors

ZS :: !x -> Simplex Z x 
(:<|) :: KnownNat n => !x -> !(Simplex n x) -> Simplex (S n) x infixr 5 

Instances

Functor (Simplex n) Source # 

Methods

fmap :: (a -> b) -> Simplex n a -> Simplex n b #

(<$) :: a -> Simplex n b -> Simplex n a #

Show x => Show (Simplex n x) Source # 

Methods

showsPrec :: Int -> Simplex n x -> ShowS #

show :: Simplex n x -> String #

showList :: [Simplex n x] -> ShowS #

Construction

(.<.) :: x -> x -> Simplex One x infixr 5 Source #

Use this together with :<| to easily build simplices, like you might construct lists. E.g. (0,0) :<| (1,0) .<. (0,1) :: Simplex Two ℝ².

makeSimplex :: forall x n. KnownNat n => (x ^ S n) -> Simplex n x Source #

makeSimplex' :: forall x n. KnownNat n => [x] -> Option (Simplex n x) Source #

Deconstruction

simplexVertices :: forall x n. Simplex n x -> x ^ S n Source #

simplexVertices' :: forall x n. Simplex n x -> [x] Source #

Simplicial complexes

data Triangulation (n :: Nat) (x :: *) Source #

An n-dimensional abstract simplicial complex is a collection of n-simplices which are “glued together” in some way. The preferred way to construct such complexes is to run a TriangT builder.

Instances

Functor (Triangulation n) Source # 

Methods

fmap :: (a -> b) -> Triangulation n a -> Triangulation n b #

(<$) :: a -> Triangulation n b -> Triangulation n a #

Show x => Show (Triangulation n x) Source # 
KnownNat n => Semigroup (Triangulation n x) Source #

Combine two triangulations (assumed as disjoint) to a single, non-connected complex.

KnownNat n => Monoid (Triangulation n x) Source # 

Triangulation-builder monad

data TriangT t n x m y Source #

A “conservative” state monad containing a Triangulation. It can be extended by new simplices, which can then be indexed using SimplexIT. The universally-quantified t argument ensures you can't index simplices that don't actually exist in this triangulation.

Instances

MonadTrans (TriangT t n x) Source # 

Methods

lift :: Monad m => m a -> TriangT t n x m a #

(Functor m, Monad m ((->) LiftedRep LiftedRep)) => Monad (TriangT t n x m) Source # 

Methods

(>>=) :: TriangT t n x m a -> (a -> TriangT t n x m b) -> TriangT t n x m b #

(>>) :: TriangT t n x m a -> TriangT t n x m b -> TriangT t n x m b #

return :: a -> TriangT t n x m a #

fail :: String -> TriangT t n x m a #

Functor m => Functor (TriangT t n x m) Source # 

Methods

fmap :: (a -> b) -> TriangT t n x m a -> TriangT t n x m b #

(<$) :: a -> TriangT t n x m b -> TriangT t n x m a #

(Functor m, Monad m ((->) LiftedRep LiftedRep)) => Applicative (TriangT t n x m) Source # 

Methods

pure :: a -> TriangT t n x m a #

(<*>) :: TriangT t n x m (a -> b) -> TriangT t n x m a -> TriangT t n x m b #

liftA2 :: (a -> b -> c) -> TriangT t n x m a -> TriangT t n x m b -> TriangT t n x m c #

(*>) :: TriangT t n x m a -> TriangT t n x m b -> TriangT t n x m b #

(<*) :: TriangT t n x m a -> TriangT t n x m b -> TriangT t n x m a #

evalTriangT :: forall n x m y. (KnownNat n, HaskMonad m) => (forall t. TriangT t n x m y) -> m y Source #

runTriangT :: forall n x m y. (forall t. TriangT t n x m y) -> Triangulation n x -> m (y, Triangulation n x) Source #

doTriangT :: forall n x m y. KnownNat n => (forall t. TriangT t n x m y) -> m (y, Triangulation n x) Source #

getTriang :: forall t n k x m. (HaskMonad m, KnownNat k, KnownNat n) => TriangT t n x m (Option (Triangulation k x)) Source #

Subsimplex-references

data SimplexIT (t :: *) (n :: Nat) (x :: *) Source #

Instances

Eq (SimplexIT t n x) Source # 

Methods

(==) :: SimplexIT t n x -> SimplexIT t n x -> Bool #

(/=) :: SimplexIT t n x -> SimplexIT t n x -> Bool #

Ord (SimplexIT t n x) Source # 

Methods

compare :: SimplexIT t n x -> SimplexIT t n x -> Ordering #

(<) :: SimplexIT t n x -> SimplexIT t n x -> Bool #

(<=) :: SimplexIT t n x -> SimplexIT t n x -> Bool #

(>) :: SimplexIT t n x -> SimplexIT t n x -> Bool #

(>=) :: SimplexIT t n x -> SimplexIT t n x -> Bool #

max :: SimplexIT t n x -> SimplexIT t n x -> SimplexIT t n x #

min :: SimplexIT t n x -> SimplexIT t n x -> SimplexIT t n x #

Show (SimplexIT t n x) Source # 

Methods

showsPrec :: Int -> SimplexIT t n x -> ShowS #

show :: SimplexIT t n x -> String #

showList :: [SimplexIT t n x] -> ShowS #

simplexITList :: forall t m n k x. (HaskMonad m, KnownNat k, KnownNat n) => TriangT t n x m [SimplexIT t k x] Source #

lookSimplex :: forall t m n k x. (HaskMonad m, KnownNat k, KnownNat n) => SimplexIT t k x -> TriangT t n x m (Simplex k x) Source #

lookSplxFacesIT :: forall t m n k x. (HaskMonad m, KnownNat k, KnownNat n) => SimplexIT t (S k) x -> TriangT t n x m (SimplexIT t k x ^ S (S k)) Source #

Reference the k-faces of a given simplex in a triangulation.

lookSupersimplicesIT :: forall t m n k j x. (HaskMonad m, KnownNat k, KnownNat j, KnownNat n) => SimplexIT t k x -> TriangT t n x m [SimplexIT t j x] Source #

tgetSimplexIT :: SimplexIT t n x -> Int Source #

A unique (for the given dimension) ID of a triagulation's simplex. It is the index where that simplex can be found in the simplexITList.

lookVertexIT :: forall t m n x. (HaskMonad m, KnownNat n) => SimplexIT t Z x -> TriangT t n x m x Source #

lookSplxVerticesIT :: forall t m n k x. (HaskMonad m, KnownNat k, KnownNat n) => SimplexIT t k x -> TriangT t n x m (SimplexIT t Z x ^ S k) Source #

sharedBoundary :: forall t m n k x. (HaskMonad m, KnownNat k, KnownNat n) => SimplexIT t (S k) x -> SimplexIT t (S k) x -> TriangT t n x m (Option (SimplexIT t k x)) Source #

distinctSimplices :: forall t m n k x. (HaskMonad m, KnownNat k, KnownNat n) => SimplexIT t (S k) x -> SimplexIT t (S k) x -> TriangT t n x m (Option (NeighbouringSimplices t k x)) Source #

type NeighbouringSimplices t n x = ((SimplexIT t Z x, SimplexIT t Z x), SimplexIT t n x) Source #

Building triangulations

disjointTriangulation :: forall t m n x. (KnownNat n, HaskMonad m) => Triangulation n x -> TriangT t n x m [SimplexIT t n x] Source #

Import an entire triangulation, as disjoint from everything already in the monad.

mixinTriangulation :: forall t m f k n x. (KnownNat n, KnownNat k, HaskMonad m, Functor f (->) (->)) => (forall s. TriangT s n x m (f (SimplexIT s k x))) -> TriangT t n x m (f (SimplexIT t k x)) Source #

Import a triangulation like with disjointTriangulation, together with references to some of its subsimplices.

Misc util

liftInTriangT :: forall t n x m μ y. (HaskMonad m, MonadTrans μ) => TriangT t n x m y -> TriangT t n x (μ m) y Source #

unliftInTriangT :: forall t n x m μ y. (HaskMonad m, MonadTrans μ) => (forall m' a. μ m a -> m a) -> TriangT t n x (μ m) y -> TriangT t n x m y Source #

data Nat Source #

Mainly intended to be used as a data kind. Of course, we'd rather use GHC.TypeLits naturals, but they aren't mature enough yet.

Instances

Eq Nat Source # 

Methods

(==) :: Nat -> Nat -> Bool #

(/=) :: Nat -> Nat -> Bool #

type Zero = Z Source #

Type-level zero of kind Nat.

type One = S Zero Source #

type Two = S One Source #

type Three = S Two Source #

type Succ = S Source #