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)
- pattern (:±) :: () => (WithField ℝ Manifold x, SimpleSpace (Needle x)) => Interior x -> [Needle x] -> Shade x
- data Shade' x = Shade' {
- _shade'Ctr :: !(Interior x)
- _shade'Narrowness :: !(Metric x)
- (|±|) :: WithField ℝ EuclidSpace x => x -> [Needle x] -> Shade' x
- class IsShade shade where
- shadeCtr :: Lens' (shade x) (Interior x)
- occlusion :: (PseudoAffine x, SimpleSpace (Needle x), s ~ Scalar (Needle x), RealDimension s) => shade x -> x -> s
- factoriseShade :: (Manifold x, SimpleSpace (Needle x), Manifold y, SimpleSpace (Needle y), Scalar (Needle x) ~ Scalar (Needle y)) => shade (x, y) -> (shade x, shade y)
- coerceShade :: (Manifold x, Manifold y, LocallyCoercible x y) => shade x -> shade y
- linIsoTransformShade :: (LinearManifold x, LinearManifold y, SimpleSpace x, SimpleSpace y, Scalar x ~ Scalar y) => (x +> y) -> shade x -> shade y
- shadeExpanse :: Lens' (Shade x) (Metric' x)
- shadeNarrowness :: Lens' (Shade' x) (Metric x)
- fullShade :: WithField ℝ PseudoAffine x => Interior x -> Metric' x -> Shade x
- fullShade' :: WithField ℝ PseudoAffine x => Interior x -> Metric x -> Shade' x
- pointsShades :: (WithField ℝ PseudoAffine x, SimpleSpace (Needle x)) => [Interior x] -> [Shade x]
- pointsShade's :: forall x. (WithField ℝ PseudoAffine x, SimpleSpace (Needle x)) => [Interior x] -> [Shade' x]
- pointsCovers :: forall x. (WithField ℝ PseudoAffine x, SimpleSpace (Needle x)) => [Interior x] -> [Shade x]
- pointsCover's :: forall x. (WithField ℝ PseudoAffine x, SimpleSpace (Needle x)) => [Interior x] -> [Shade' x]
- coverAllAround :: forall x. (WithField ℝ PseudoAffine x, SimpleSpace (Needle x)) => Interior x -> [Needle x] -> Shade x
- intersectShade's :: forall y. Refinable y => NonEmpty (Shade' y) -> Maybe (Shade' y)
- class (WithField ℝ PseudoAffine y, SimpleSpace (Needle y)) => Refinable y where
- mixShade's :: forall y. (WithField ℝ Manifold y, SimpleSpace (Needle y)) => NonEmpty (Shade' y) -> Maybe (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, SimpleSpace (Needle x)) => [x] -> ShadeTree x
- onlyLeaves :: WithField ℝ PseudoAffine x => ShadeTree x -> [x]
- indexShadeTree :: forall x. WithField ℝ Manifold x => ShadeTree x -> Int -> Either Int ([ShadeTree x], x)
- positionIndex :: forall x. (WithField ℝ Manifold x, SimpleSpace (Needle x)) => Maybe (Metric x) -> ShadeTree x -> x -> Maybe (Int, ([ShadeTree x], x))
- onlyNodes :: forall x. (WithField ℝ PseudoAffine x, SimpleSpace (Needle x)) => ShadeTree x -> Trees 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)
- class HasFlatView f where
- type FlatView f x
- flatView :: f x -> FlatView f x
- superFlatView :: f x -> [[x]]
- shadesMerge :: forall x. (WithField ℝ Manifold x, SimpleSpace (Needle x)) => ℝ -> [Shade x] -> [Shade x]
- smoothInterpolate :: forall x y. (WithField ℝ Manifold x, WithField ℝ LinearManifold y, SimpleSpace (Needle x)) => NonEmpty (x, y) -> x -> y
- allTwigs :: forall x. WithField ℝ PseudoAffine x => ShadeTree x -> [Twig x]
- twigsWithEnvirons :: forall x. (WithField ℝ Manifold x, SimpleSpace (Needle x)) => ShadeTree x -> [(Twig x, TwigEnviron x)]
- type Twig x = (Int, ShadeTree x)
- type TwigEnviron x = [Twig x]
- seekPotentialNeighbours :: forall x. (WithField ℝ PseudoAffine x, SimpleSpace (Needle x)) => ShadeTree x -> x `Shaded` [Int]
- completeTopShading :: forall x y. (WithField ℝ PseudoAffine x, WithField ℝ PseudoAffine y, SimpleSpace (Needle x), SimpleSpace (Needle y)) => (x `Shaded` y) -> [Shade' (x, y)]
- flexTwigsShading :: forall x y f. (WithField ℝ Manifold x, WithField ℝ Manifold y, SimpleSpace (Needle x), SimpleSpace (Needle y), Applicative f) => (Shade' (x, y) -> f (x, (Shade' y, LocalLinear x y))) -> (x `Shaded` y) -> f (x `Shaded` y)
- coerceShadeTree :: forall x y. (LocallyCoercible x y, Manifold x, Manifold y) => ShadeTree x -> ShadeTree y
- data WithAny x y = WithAny {
- _untopological :: y
- _topological :: !x
- type Shaded x y = ShadeTree (x `WithAny` y)
- fmapShaded :: (y -> υ) -> (x `Shaded` y) -> x `Shaded` υ
- joinShaded :: ((x `WithAny` y) `Shaded` z) -> x `Shaded` (y, z)
- constShaded :: y -> ShadeTree x -> x `Shaded` y
- zipTreeWithList :: ShadeTree x -> [y] -> x `Shaded` y
- stripShadedUntopological :: (x `Shaded` y) -> ShadeTree x
- stiAsIntervalMapping :: (x ~ ℝ, y ~ ℝ) => (x `Shaded` y) -> [(x, ((y, Diff y), LinearMap ℝ x y))]
- spanShading :: forall x y. (WithField ℝ Manifold x, WithField ℝ Manifold y, SimpleSpace (Needle x), SimpleSpace (Needle y)) => (Shade x -> Shade y) -> ShadeTree x -> x `Shaded` y
- estimateLocalJacobian :: forall x y. (WithField ℝ Manifold x, Refinable y, SimpleSpace (Needle x), SimpleSpace (Needle y)) => Metric x -> [(Local x, Shade' y)] -> Maybe (Shade' (LocalLinear x y))
- type DifferentialEqn x y = Shade (x, y) -> LocalDifferentialEqn x y
- data LocalDifferentialEqn x y = LocalDifferentialEqn {
- _predictDerivatives :: Maybe (Shade' (LocalLinear x y))
- _rescanDerivatives :: Shade' (LocalLinear x y) -> Shade' y -> Maybe (Shade' y)
- propagateDEqnSolution_loc :: forall x y. (WithField ℝ Manifold x, Refinable y, Geodesic (Interior y), SimpleSpace (Needle x)) => DifferentialEqn x y -> LocalDataPropPlan x (Shade' y) -> Maybe (Shade' y)
- data LocalDataPropPlan x y = LocalDataPropPlan {
- _sourcePosition :: !(Interior x)
- _targetPosOffset :: !(Needle x)
- _sourceData, _targetAPrioriData :: !y
- _relatedData :: [(Needle x, y)]
- rangeOnGeodesic :: forall i m. (WithField ℝ PseudoAffine m, Geodesic m, SimpleSpace (Needle m), WithField ℝ IntervalLike i, SimpleSpace (Needle i)) => m -> m -> Maybe (Shade i -> Shade m)
- 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]
- data 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 | |
|
ImpliesMetric Shade Source | |
IsShade Shade Source | |
(Show (Interior x), Show (Metric' x), WithField ℝ PseudoAffine x) => Show (Shade x) Source | |
PseudoAffine x => Semimanifold (Shade x) Source | |
(WithField ℝ PseudoAffine x, Geodesic (Interior x), SimpleSpace (Needle x)) => Geodesic (Shade x) Source | |
type MetricRequirement Shade x = (Manifold x, SimpleSpace (Needle x)) Source | |
type Interior (Shade x) = Shade x | |
type Needle (Shade x) = Needle x Source |
pattern (:±) :: () => (WithField ℝ Manifold x, SimpleSpace (Needle x)) => Interior x -> [Needle x] -> Shade x Source
Span a Shade
from a center point and multiple deviation-vectors.
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' | |
|
ImpliesMetric Shade' Source | |
IsShade Shade' Source | |
(Show (Interior x), Show (Metric x), WithField ℝ PseudoAffine x) => Show (Shade' x) Source | |
AffineManifold x => Semimanifold (Shade' x) Source | |
(WithField ℝ AffineManifold x, Geodesic x, SimpleSpace (Needle x)) => Geodesic (Shade' x) Source | |
type MetricRequirement Shade' x = (Manifold x, SimpleSpace (Needle x)) Source | |
type Interior (Shade' x) = Shade' x | |
type Needle (Shade' x) = Diff x Source |
(|±|) :: WithField ℝ EuclidSpace x => x -> [Needle x] -> Shade' x Source
Similar to ':±', but instead of expanding the shade, each vector restricts it. Iff these form a orthogonal basis (in whatever sense applicable), then both methods will be equivalent.
Note that '|±|' is only possible, as such, in an inner-product space; in
general you need reciprocal vectors (Needle'
) to define a Shade'
.
class IsShade shade where Source
shadeCtr :: Lens' (shade x) (Interior x) Source
occlusion :: (PseudoAffine x, SimpleSpace (Needle 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, SimpleSpace (Needle x), Manifold y, SimpleSpace (Needle y), Scalar (Needle x) ~ Scalar (Needle y)) => shade (x, y) -> (shade x, shade y) Source
coerceShade :: (Manifold x, Manifold y, LocallyCoercible x y) => shade x -> shade y Source
linIsoTransformShade :: (LinearManifold x, LinearManifold y, SimpleSpace x, SimpleSpace y, Scalar x ~ Scalar y) => (x +> y) -> shade x -> shade y Source
Lenses
shadeExpanse :: Lens' (Shade x) (Metric' x) Source
shadeNarrowness :: Lens' (Shade' x) (Metric x) Source
Construction
fullShade' :: WithField ℝ PseudoAffine x => Interior x -> Metric x -> Shade' x Source
pointsShades :: (WithField ℝ PseudoAffine x, SimpleSpace (Needle x)) => [Interior x] -> [Shade x] Source
Attempt to find a Shade
that describes the distribution of 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. Note that some points will be “outside” of the shade,
as happens for a normal distribution with some statistical likelyhood.
(Use pointsCovers
if you need to prevent that.)
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 result type is a list.
pointsShade's :: forall x. (WithField ℝ PseudoAffine x, SimpleSpace (Needle x)) => [Interior x] -> [Shade' x] Source
pointsCovers :: forall x. (WithField ℝ PseudoAffine x, SimpleSpace (Needle x)) => [Interior x] -> [Shade x] Source
Like pointsShades
, but ensure that all points are actually in
the shade, i.e. if [
is the result then
Shade
x₀ ex]
for all metric
(recipMetric ex) (p-x₀) ≤ 1p
in the list.
pointsCover's :: forall x. (WithField ℝ PseudoAffine x, SimpleSpace (Needle x)) => [Interior x] -> [Shade' x] Source
coverAllAround :: forall x. (WithField ℝ PseudoAffine x, SimpleSpace (Needle x)) => Interior x -> [Needle x] -> Shade x Source
Evaluation
Misc
class (WithField ℝ PseudoAffine y, SimpleSpace (Needle y)) => Refinable y where Source
Class of manifolds which can use Shade'
as a basic set type.
This is easily possible for vector spaces with the default implementations.
Nothing
subShade' :: Shade' y -> Shade' y -> Bool Source
a
means subShade'
b ≡ Truea
is fully contained in b
, i.e. from
follows also minusLogOcclusion'
a p < 1minusLogOcclusion' b p < 1
.
refineShade' :: Shade' y -> Shade' y -> Maybe (Shade' y) Source
Intersection between two shades.
convolveShade' :: Shade' y -> Shade' (Needle y) -> Shade' y Source
Refinable ℝ Source | |
Refinable ℝ⁰ Source | |
Refinable ℝ⁴ Source | |
Refinable ℝ³ Source | |
Refinable ℝ² Source | |
Refinable ℝ¹ Source | |
(Refinable a, (~) * (Interior a) a, Refinable b, (~) * (Interior b) b, (~) * (Scalar (DualVector (DualVector (Needle b)))) (Scalar (DualVector (DualVector (Needle a))))) => Refinable (a, b) Source | |
(SimpleSpace a, SimpleSpace b, (~) * (Scalar a) ℝ, (~) * (Scalar b) ℝ, (~) * (Scalar (DualVector a)) ℝ, (~) * (Scalar (DualVector b)) ℝ, (~) * (Scalar (DualVector (DualVector a))) ℝ, (~) * (Scalar (DualVector (DualVector b))) ℝ) => Refinable (LinearMap ℝ a b) Source |
mixShade's :: forall y. (WithField ℝ Manifold y, SimpleSpace (Needle y)) => NonEmpty (Shade' y) -> Maybe (Shade' y) Source
Weakened version of intersectShade's
. What this function calculates is
rather the weighted mean of ellipsoid regions. If you interpret the
shades as uncertain physical measurements with normal distribution,
it gives the maximum-likelyhood result for multiple measurements of the
same quantity.
Shade trees
PlainLeaves [x] | |
DisjointBranches !Int (NonEmpty (ShadeTree x)) | |
OverlappingBranches !Int !(Shade x) (NonEmpty (DBranch x)) |
ImpliesMetric ShadeTree Source | |
(WithField ℝ PseudoAffine x, Show x, Show (Interior x), Show (Needle' x), Show (Metric' x)) => Show (ShadeTree x) Source | |
Generic (ShadeTree x) Source | |
(WithField ℝ Manifold x, SimpleSpace (Needle x)) => Monoid (ShadeTree x) Source | |
(NFData x, NFData (Needle' x)) => NFData (ShadeTree x) Source | |
AffineManifold x => Semimanifold (ShadeTree x) Source | Experimental. There might be a more powerful instance possible. |
(WithField ℝ Manifold x, SimpleSpace (Needle x)) => Semigroup (ShadeTree x) Source | WRT union. |
type MetricRequirement ShadeTree x = (WithField ℝ PseudoAffine x, SimpleSpace (Needle x)) Source | |
type Rep (ShadeTree x) Source | |
type Interior (ShadeTree x) = ShadeTree x | |
type Needle (ShadeTree x) = Diff x Source |
fromLeafPoints :: forall x. (WithField ℝ Manifold x, SimpleSpace (Needle x)) => [x] -> ShadeTree x Source
Build a quite nicely balanced tree from a cloud of points, on any real manifold.
onlyLeaves :: WithField ℝ PseudoAffine x => ShadeTree x -> [x] Source
Left (and, typically, also right) inverse of fromLeafNodes
.
indexShadeTree :: forall x. WithField ℝ Manifold x => ShadeTree x -> Int -> Either Int ([ShadeTree x], x) Source
The leaves of a shade tree are numbered. For a given index, this function attempts to find the leaf with that ID, within its immediate environment.
:: (WithField ℝ Manifold x, SimpleSpace (Needle x)) | |
=> Maybe (Metric x) | For deciding (at the lowest level) what “close” means; this is optional for any tree of depth >1. |
-> ShadeTree x | The tree to index into |
-> x | Position to look up |
-> Maybe (Int, ([ShadeTree x], x)) | Index of the leaf near to the query point, the “path” of environment trees leading down to its position (in decreasing order of size), and actual position of the found node. |
“Inverse indexing” of a tree. This is roughly a nearest-neighbour search, but not guaranteed to give the correct result unless evaluated at the precise position of a tree leaf.
View helpers
onlyNodes :: forall x. (WithField ℝ PseudoAffine x, SimpleSpace (Needle x)) => ShadeTree x -> Trees x Source
Imitate the specialised ShadeTree
structure with a simpler, generic tree.
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
class HasFlatView f where Source
flatView :: f x -> FlatView f x Source
superFlatView :: f x -> [[x]] Source
:: (WithField ℝ Manifold x, SimpleSpace (Needle 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 :: forall x y. (WithField ℝ Manifold x, WithField ℝ LinearManifold y, SimpleSpace (Needle x)) => NonEmpty (x, y) -> x -> y Source
twigsWithEnvirons :: forall x. (WithField ℝ Manifold x, SimpleSpace (Needle x)) => ShadeTree x -> [(Twig x, TwigEnviron x)] Source
type TwigEnviron x = [Twig x] Source
seekPotentialNeighbours :: forall x. (WithField ℝ PseudoAffine x, SimpleSpace (Needle x)) => ShadeTree x -> x `Shaded` [Int] Source
completeTopShading :: forall x y. (WithField ℝ PseudoAffine x, WithField ℝ PseudoAffine y, SimpleSpace (Needle x), SimpleSpace (Needle y)) => (x `Shaded` y) -> [Shade' (x, y)] Source
flexTwigsShading :: forall x y f. (WithField ℝ Manifold x, WithField ℝ Manifold y, SimpleSpace (Needle x), SimpleSpace (Needle y), Applicative f) => (Shade' (x, y) -> f (x, (Shade' y, LocalLinear x y))) -> (x `Shaded` y) -> f (x `Shaded` y) Source
coerceShadeTree :: forall x y. (LocallyCoercible x y, Manifold x, Manifold y) => ShadeTree x -> ShadeTree 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 | |
(AdditiveGroup x, Monoid y) => AdditiveGroup (WithAny x y) Source | |
(VectorSpace x, Monoid y) => VectorSpace (WithAny x y) Source | |
AffineSpace x => AffineSpace (WithAny x y) Source | |
Semimanifold x => Semimanifold (WithAny x y) Source | |
PseudoAffine x => PseudoAffine (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 Interior (WithAny x y) = WithAny (Interior x) y Source | |
type Needle (WithAny x y) = Needle x Source |
fmapShaded :: (y -> υ) -> (x `Shaded` y) -> x `Shaded` υ Source
joinShaded :: ((x `WithAny` y) `Shaded` z) -> x `Shaded` (y, z) Source
constShaded :: y -> ShadeTree x -> x `Shaded` y Source
zipTreeWithList :: ShadeTree x -> [y] -> x `Shaded` y Source
stripShadedUntopological :: (x `Shaded` y) -> ShadeTree x Source
stiAsIntervalMapping :: (x ~ ℝ, y ~ ℝ) => (x `Shaded` y) -> [(x, ((y, Diff y), LinearMap ℝ x y))] Source
spanShading :: forall x y. (WithField ℝ Manifold x, WithField ℝ Manifold y, SimpleSpace (Needle x), SimpleSpace (Needle y)) => (Shade x -> Shade y) -> ShadeTree x -> x `Shaded` y Source
estimateLocalJacobian :: forall x y. (WithField ℝ Manifold x, Refinable y, SimpleSpace (Needle x), SimpleSpace (Needle y)) => Metric x -> [(Local x, Shade' y)] -> Maybe (Shade' (LocalLinear x y)) Source
type DifferentialEqn x y = Shade (x, y) -> LocalDifferentialEqn x y Source
data LocalDifferentialEqn x y Source
LocalDifferentialEqn | |
|
propagateDEqnSolution_loc :: forall x y. (WithField ℝ Manifold x, Refinable y, Geodesic (Interior y), SimpleSpace (Needle x)) => DifferentialEqn x y -> LocalDataPropPlan x (Shade' y) -> Maybe (Shade' y) Source
data LocalDataPropPlan x y Source
LocalDataPropPlan | |
|
rangeOnGeodesic :: forall i m. (WithField ℝ PseudoAffine m, Geodesic m, SimpleSpace (Needle m), WithField ℝ IntervalLike i, SimpleSpace (Needle i)) => m -> m -> Maybe (Shade i -> Shade m) 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
data AutoTriang n x Source
breakdownAutoTriang :: forall n n' x. (KnownNat n', n ~ S n') => AutoTriang n x -> [Simplex n x] Source