Copyright | (c) Justus Sagemüller 2015 |
---|---|
License | GPL v3 |
Maintainer | (@) sagemueller $ geo.uni-koeln.de |
Stability | experimental |
Portability | portable |
Safe Haskell | None |
Language | Haskell2010 |
- data Shade x = Shade {
- _shadeCtr :: !(Interior x)
- _shadeExpanse :: !(Metric' x)
- data Shade' x = Shade' {
- _shade'Ctr :: !(Interior x)
- _shade'Narrowness :: !(Metric x)
- class IsShade shade where
- shadeCtr :: Functor f (->) (->) => (Interior x -> f (Interior x)) -> shade x -> f (shade x)
- occlusion :: (Manifold x, s ~ Scalar (Needle x), RealDimension s) => shade x -> x -> s
- factoriseShade :: (Manifold x, RealDimension (Scalar (Needle x)), Manifold y, RealDimension (Scalar (Needle y))) => shade (x, y) -> (shade x, shade y)
- shadeExpanse :: Functor f (->) (->) => (Metric' x -> f (Metric' x)) -> Shade x -> f (Shade x)
- shadeNarrowness :: Functor f (->) (->) => (Metric x -> f (Metric x)) -> Shade' x -> f (Shade' x)
- fullShade :: WithField ℝ Manifold x => x -> Metric' x -> Shade x
- fullShade' :: WithField ℝ Manifold x => x -> Metric x -> Shade' x
- pointsShades :: WithField ℝ Manifold x => [x] -> [Shade x]
- intersectShade's :: forall y. WithField ℝ Manifold y => [Shade' y] -> Option (Shade' y)
- data ShadeTree x
- = PlainLeaves [x]
- | DisjointBranches !Int (NonEmpty (ShadeTree x))
- | OverlappingBranches !Int !(Shade x) (NonEmpty (DBranch x))
- fromLeafPoints :: forall x. WithField ℝ Manifold x => [x] -> ShadeTree x
- onlyNodes :: WithField ℝ Manifold x => ShadeTree x -> Trees x
- onlyLeaves :: WithField ℝ Manifold x => ShadeTree x -> [x]
- type SimpleTree = GenericTree Maybe []
- type Trees = GenericTree [] []
- type NonEmptyTree = GenericTree NonEmpty []
- newtype GenericTree c b x = GenericTree {
- treeBranches :: c (x, GenericTree b b x)
- sShSaw :: WithField ℝ Manifold x => ShadeTree x -> ShadeTree x -> Sawboneses x
- chainsaw :: WithField ℝ Manifold x => Cutplane x -> ShadeTree x -> Sawbones x
- class HasFlatView f where
- type FlatView f x
- flatView :: f x -> FlatView f x
- superFlatView :: f x -> [[x]]
- shadesMerge :: WithField ℝ Manifold x => ℝ -> [Shade x] -> [Shade x]
- smoothInterpolate :: (WithField ℝ Manifold x, WithField ℝ LinearManifold y) => NonEmpty (x, y) -> x -> y
- twigsWithEnvirons :: forall x. WithField ℝ Manifold x => ShadeTree x -> [(ShadeTree x, [ShadeTree x])]
- completeTopShading :: (WithField ℝ Manifold x, WithField ℝ Manifold y) => (x `Shaded` y) -> [Shade' (x, y)]
- flexTwigsShading :: forall x y f. (WithField ℝ Manifold x, WithField ℝ Manifold y, Applicative f) => (Shade' (x, y) -> f (x, (Shade' y, LocalLinear x y))) -> (x `Shaded` y) -> f (x `Shaded` y)
- data WithAny x y = WithAny {
- _untopological :: y
- _topological :: !x
- type Shaded x y = ShadeTree (x `WithAny` y)
- stiAsIntervalMapping :: (x ~ ℝ, y ~ ℝ) => (x `Shaded` y) -> [(x, ((y, Diff y), Linear ℝ x y))]
- spanShading :: forall x y. (WithField ℝ Manifold x, WithField ℝ Manifold y) => (Shade x -> Shade y) -> ShadeTree x -> x `Shaded` y
- type DifferentialEqn x y = Shade' (x, y) -> Shade' (LocalLinear x y)
- filterDEqnSolution_static :: forall x y. (WithField ℝ Manifold x, WithField ℝ Manifold y) => DifferentialEqn x y -> (x `Shaded` y) -> Option (x `Shaded` y)
- type TriangBuild t n x = TriangT t (S n) x (State (Map (SimplexIT t n x) (Metric x, ISimplex (S n) x)))
- doTriangBuild :: KnownNat n => (forall t. TriangBuild t n x ()) -> [Simplex (S n) x]
- singleFullSimplex :: forall t n x. (KnownNat n, WithField ℝ Manifold x) => ISimplex n x -> FullTriang t n x (SimplexIT t n x)
- autoglueTriangulation :: forall t n n' n'' x. (KnownNat n'', WithField ℝ Manifold x, n ~ S n', n' ~ S n'') => (forall t'. TriangBuild t' n' x ()) -> TriangBuild t n' x ()
- data AutoTriang n x
- elementaryTriang :: forall n n' x. (KnownNat n', n ~ S n', WithField ℝ EuclidSpace x) => Simplex n x -> AutoTriang n x
- breakdownAutoTriang :: forall n n' x. (KnownNat n', n ~ S n') => AutoTriang n x -> [Simplex n x]
Shades
A Shade
is a very crude description of a region within a manifold. It
can be interpreted as either an ellipsoid shape, or as the Gaussian peak
of a normal distribution (use http://hackage.haskell.org/package/manifold-random
for actually sampling from that distribution).
For a precise description of an arbitrarily-shaped connected subset of a manifold,
there is Region
, whose implementation is vastly more complex.
Shade | |
|
A “co-shade” can describe ellipsoid regions as well, but unlike
Shade
it can be unlimited / infinitely wide in some directions.
It does OTOH need to have nonzero thickness, which Shade
needs not.
Shade' | |
|
class IsShade shade where Source
shadeCtr :: Functor f (->) (->) => (Interior x -> f (Interior x)) -> shade x -> f (shade x) Source
occlusion :: (Manifold x, s ~ Scalar (Needle x), RealDimension s) => shade x -> x -> s Source
Check the statistical likelihood-density of a point being within a shade. This is taken as a normal distribution.
factoriseShade :: (Manifold x, RealDimension (Scalar (Needle x)), Manifold y, RealDimension (Scalar (Needle y))) => shade (x, y) -> (shade x, shade y) Source
Lenses
shadeExpanse :: Functor f (->) (->) => (Metric' x -> f (Metric' x)) -> Shade x -> f (Shade x) Source
shadeNarrowness :: Functor f (->) (->) => (Metric x -> f (Metric x)) -> Shade' x -> f (Shade' x) Source
Construction
pointsShades :: WithField ℝ Manifold x => [x] -> [Shade x] Source
Attempt to find a Shade
that “covers” the given points.
At least in an affine space (and thus locally in any manifold), this can be used to
estimate the parameters of a normal distribution from which some points were
sampled.
For nonconnected manifolds it will be necessary to yield separate shades for each connected component. And for an empty input list, there is no shade! Hence the list result.
Evaluation
Misc
Shade trees
PlainLeaves [x] | |
DisjointBranches !Int (NonEmpty (ShadeTree x)) | |
OverlappingBranches !Int !(Shade x) (NonEmpty (DBranch x)) |
Generic (ShadeTree x) Source | |
WithField ℝ Manifold x => Monoid (ShadeTree x) Source | |
(NFData x, NFData (Needle' x)) => NFData (ShadeTree x) Source | |
WithField ℝ Manifold x => Semigroup (ShadeTree x) Source | WRT union. |
AffineManifold x => Semimanifold (ShadeTree x) Source | Experimental. There might be a more powerful instance possible. |
type Rep (ShadeTree x) Source | |
type Needle (ShadeTree x) = Diff x Source | |
type Interior (ShadeTree x) = ShadeTree x |
fromLeafPoints :: forall x. WithField ℝ Manifold x => [x] -> ShadeTree x Source
Build a quite nicely balanced tree from a cloud of points, on any real manifold.
Simple view helpers
onlyNodes :: WithField ℝ Manifold x => ShadeTree x -> Trees x Source
Imitate the specialised ShadeTree
structure with a simpler, generic tree.
onlyLeaves :: WithField ℝ Manifold x => ShadeTree x -> [x] Source
Left (and, typically, also right) inverse of fromLeafNodes
.
Auxiliary types
type SimpleTree = GenericTree Maybe [] Source
SimpleTree
x ≅ Maybe (x,Trees
x)
type Trees = GenericTree [] [] Source
type NonEmptyTree = GenericTree NonEmpty [] Source
NonEmptyTree
x ≅ (x,Trees
x)
newtype GenericTree c b x Source
GenericTree | |
|
(Functor c, Functor b) => Functor (GenericTree c b) Source | |
(Foldable c, Foldable b) => Foldable (GenericTree c b) Source | |
(Traversable c, Traversable b) => Traversable (GenericTree c b) Source | |
Show (c (x, GenericTree b b x)) => Show (GenericTree c b x) Source | |
Generic (GenericTree c b x) Source | |
MonadPlus c => Monoid (GenericTree c b x) Source | |
(NFData x, Foldable c, Foldable b) => NFData (GenericTree c b x) Source | |
MonadPlus c => Semigroup (GenericTree c b x) Source | |
type Rep (GenericTree c b x) Source |
Misc
:: WithField ℝ Manifold x | |
=> ShadeTree x | “Reference tree”, defines the cut regions.
Must be at least one level of |
-> ShadeTree x | Tree to take the actual contents from. |
-> Sawboneses x | All points within each region, plus those from the boundaries of each neighbouring region. |
Saw a tree into the domains covered by the respective branches of another tree.
class HasFlatView f where Source
flatView :: f x -> FlatView f x Source
superFlatView :: f x -> [[x]] Source
:: WithField ℝ Manifold x | |
=> ℝ | How near (inverse normalised distance, relative to shade expanse) two shades must be to be merged. If this is zero, any shades in the same connected region of a manifold are merged. |
-> [Shade x] | A list of n shades. |
-> [Shade x] | m ≤ n shades which cover at least the same area. |
Attempt to reduce the number of shades to fewer (ideally, a single one). In the simplest cases these should guaranteed cover the same area; for non-flat manifolds it only works in a heuristic sense.
smoothInterpolate :: (WithField ℝ Manifold x, WithField ℝ LinearManifold y) => NonEmpty (x, y) -> x -> y Source
twigsWithEnvirons :: forall x. WithField ℝ Manifold x => ShadeTree x -> [(ShadeTree x, [ShadeTree x])] Source
completeTopShading :: (WithField ℝ Manifold x, WithField ℝ Manifold y) => (x `Shaded` y) -> [Shade' (x, y)] Source
flexTwigsShading :: forall x y f. (WithField ℝ Manifold x, WithField ℝ Manifold y, Applicative f) => (Shade' (x, y) -> f (x, (Shade' y, LocalLinear x y))) -> (x `Shaded` y) -> f (x `Shaded` y) Source
Essentially the same as (x,y)
, but not considered as a product topology.
The Semimanifold
etc. instances just copy the topology of x
, ignoring y
.
WithAny | |
|
AdditiveGroup x => Monad (WithAny x) Source | |
Functor (WithAny x) Source | |
AdditiveGroup x => Applicative (WithAny x) Source | |
(Show x, Show y) => Show (WithAny x y) Source | |
Generic (WithAny x y) Source | |
(NFData x, NFData y) => NFData (WithAny x y) Source | |
(VectorSpace x, Monoid y) => VectorSpace (WithAny x y) Source | |
(AdditiveGroup x, Monoid y) => AdditiveGroup (WithAny x y) Source | |
AffineSpace x => AffineSpace (WithAny x y) Source | |
PseudoAffine x => PseudoAffine (WithAny x y) Source | |
Semimanifold x => Semimanifold (WithAny x y) Source | |
type Rep (WithAny x y) Source | |
type Scalar (WithAny x y) = Scalar x Source | |
type Diff (WithAny x y) = Diff x Source | |
type Needle (WithAny x y) = Needle x Source | |
type Interior (WithAny x y) = WithAny (Interior x) y Source |
stiAsIntervalMapping :: (x ~ ℝ, y ~ ℝ) => (x `Shaded` y) -> [(x, ((y, Diff y), Linear ℝ x y))] Source
spanShading :: forall x y. (WithField ℝ Manifold x, WithField ℝ Manifold y) => (Shade x -> Shade y) -> ShadeTree x -> x `Shaded` y Source
type DifferentialEqn x y = Shade' (x, y) -> Shade' (LocalLinear x y) Source
filterDEqnSolution_static :: forall x y. (WithField ℝ Manifold x, WithField ℝ Manifold y) => DifferentialEqn x y -> (x `Shaded` y) -> Option (x `Shaded` y) Source
Triangulation-builders
type TriangBuild t n x = TriangT t (S n) x (State (Map (SimplexIT t n x) (Metric x, ISimplex (S n) x))) Source
doTriangBuild :: KnownNat n => (forall t. TriangBuild t n x ()) -> [Simplex (S n) x] Source
singleFullSimplex :: forall t n x. (KnownNat n, WithField ℝ Manifold x) => ISimplex n x -> FullTriang t n x (SimplexIT t n x) Source
autoglueTriangulation :: forall t n n' n'' x. (KnownNat n'', WithField ℝ Manifold x, n ~ S n', n' ~ S n'') => (forall t'. TriangBuild t' n' x ()) -> TriangBuild t n' x () Source
BUGGY: this does connect the supplied triangulations, but it doesn't choose the right boundary simplices yet. Probable cause: inconsistent internal numbering of the subsimplices.
data AutoTriang n x Source
elementaryTriang :: forall n n' x. (KnownNat n', n ~ S n', WithField ℝ EuclidSpace x) => Simplex n x -> AutoTriang n x Source
breakdownAutoTriang :: forall n n' x. (KnownNat n', n ~ S n') => AutoTriang n x -> [Simplex n x] Source