Copyright | (c) Justus Sagemüller 2016 |
---|---|
License | GPL v3 |
Maintainer | (@) jsagemue $ uni-koeln.de |
Stability | experimental |
Portability | portable |
Safe Haskell | None |
Language | Haskell2010 |
- data Shade x where
- Shade :: (Semimanifold x, SimpleSpace (Needle x)) => {..} -> Shade x
- pattern (:±) :: (Semimanifold x, SimpleSpace (Needle x)) => Interior x -> [Needle x] -> Shade x
- data Shade' x = Shade' {
- _shade'Ctr :: !(Interior x)
- _shade'Narrowness :: !(Metric x)
- (|±|) :: forall x. WithField ℝ EuclidSpace x => x -> [Needle x] -> Shade' x
- class IsShade shade where
- shadeCtr :: IsShade shade => Lens' (shade x) (Interior x)
- shadeExpanse :: Lens' (Shade x) (Metric' x)
- shadeNarrowness :: Lens' (Shade' x) (Metric x)
- fullShade :: (Semimanifold x, SimpleSpace (Needle x)) => Interior x -> Metric' x -> Shade x
- fullShade' :: WithField ℝ SimpleSpace 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 s. (Fractional' s, WithField s PseudoAffine x, SimpleSpace (Needle x)) => Interior x -> [Needle x] -> Shade x
- occlusion :: (IsShade shade, PseudoAffine x, SimpleSpace (Needle x), s ~ Scalar (Needle x), RealFloat' s) => shade x -> x -> s
- prettyShowsPrecShade' :: LtdErrorShow m => Int -> Shade' m -> ShowS
- prettyShowShade' :: LtdErrorShow x => Shade' x -> String
- class Refinable m => LtdErrorShow m where
- factoriseShade :: (IsShade shade, PseudoAffine x, SimpleSpace (Needle x), PseudoAffine y, SimpleSpace (Needle y), Scalar (Needle x) ~ Scalar (Needle y)) => shade (x, y) -> (shade x, shade y)
- orthoShades :: (IsShade shade, PseudoAffine x, SimpleSpace (Needle x), PseudoAffine y, SimpleSpace (Needle y), Scalar (Needle x) ~ Scalar (Needle y)) => shade x -> shade y -> shade (x, y)
- (✠) :: (IsShade shade, PseudoAffine x, SimpleSpace (Needle x), PseudoAffine y, SimpleSpace (Needle y), Scalar (Needle x) ~ Scalar (Needle y)) => shade x -> shade y -> shade (x, y)
- intersectShade's :: forall y. Refinable y => NonEmpty (Shade' y) -> Maybe (Shade' y)
- linIsoTransformShade :: (IsShade shade, SimpleSpace x, SimpleSpace y, Scalar x ~ Scalar y, Num' (Scalar x)) => (x +> y) -> shade x -> shade y
- embedShade :: (IsShade shade, Semimanifold x, Semimanifold y, Object (Affine s) (Interior x), Object (Affine s) (Interior y), SemiInner (Needle x), SimpleSpace (Needle y)) => Embedding (Affine s) (Interior x) (Interior y) -> shade x -> shade y
- projectShade :: (IsShade shade, Semimanifold x, Semimanifold y, Object (Affine s) (Interior x), Object (Affine s) (Interior y), SimpleSpace (Needle x), SemiInner (Needle y)) => Embedding (Affine s) (Interior x) (Interior y) -> shade y -> shade x
- class (WithField ℝ PseudoAffine y, SimpleSpace (Needle y)) => Refinable y where
- subShade' :: Refinable y => Shade' y -> Shade' y -> Bool
- refineShade' :: Refinable y => Shade' y -> Shade' y -> Maybe (Shade' y)
- convolveShade' :: Refinable y => Shade' y -> Shade' (Needle y) -> Shade' y
- coerceShade :: (IsShade shade, Manifold x, Manifold y, LocallyCoercible x y, SimpleSpace (Needle y)) => shade x -> shade y
- mixShade's :: forall y. (WithField ℝ Manifold y, SimpleSpace (Needle y)) => NonEmpty (Shade' y) -> Maybe (Shade' y)
- dualShade :: forall x. (PseudoAffine x, SimpleSpace (Needle x)) => Shade x -> Shade' x
- dualShade' :: forall x. (PseudoAffine x, SimpleSpace (Needle x)) => Shade' x -> Shade x
- wellDefinedShade' :: LinearSpace (Needle x) => Shade' x -> Maybe (Shade' x)
- linearProjectShade :: forall s x y. (Num' s, LinearSpace x, SimpleSpace y, Scalar x ~ s, Scalar y ~ s) => (x +> y) -> Shade x -> Shade y
- shadesMerge :: forall x. (WithField ℝ Manifold x, SimpleSpace (Needle x)) => ℝ -> [Shade x] -> [Shade x]
- pointsShades' :: forall x y. (WithField ℝ PseudoAffine x, SimpleSpace (Needle x)) => Metric' x -> [(x, y)] -> [([(x, y)], Shade x)]
- pseudoECM :: forall x y p. (WithField ℝ PseudoAffine x, SimpleSpace (Needle x), Functor p) => p x -> NonEmpty (x, y) -> (x, ([(x, y)], [(x, y)]))
- convolveMetric :: (Refinable y, Functor p) => p y -> Metric y -> Metric y -> Metric y
- data WithAny x y = WithAny {
- _untopological :: y
- _topological :: !x
- shadeWithAny :: y -> Shade x -> Shade (x `WithAny` y)
- shadeWithoutAnything :: Semimanifold x => Shade (x `WithAny` y) -> Shade x
- 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)
- rangeWithinVertices :: forall s i m t. (RealFrac' s, WithField s PseudoAffine i, WithField s PseudoAffine m, Geodesic i, Geodesic m, SimpleSpace (Needle i), SimpleSpace (Needle m), AffineManifold (Interior i), AffineManifold (Interior m), Object (Affine s) (Interior i), Object (Affine s) (Interior m), Traversable t) => (Interior i, Interior m) -> t (i, m) -> Maybe (Shade i -> Shade m)
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 :: (Semimanifold x, SimpleSpace (Needle x)) => {..} -> Shade x | |
|
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 # | |
LtdErrorShow x => Show (Shade x) Source # | |
(WithField ℝ PseudoAffine x, Geodesic (Interior x), SimpleSpace (Needle x)) => Geodesic (Shade x) Source # | |
type MetricRequirement Shade x Source # | |
type Interior (Shade x) Source # | |
type Needle (Shade x) Source # | |
pattern (:±) :: (Semimanifold x, SimpleSpace (Needle x)) => Interior x -> [Needle x] -> Shade x infixl 6 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 # | |
LtdErrorShow x => Show (Shade' x) Source # | |
AffineManifold x => Semimanifold (Shade' x) Source # | |
LtdErrorShow x => Show (Shade' x) Source # | |
(WithField ℝ AffineManifold x, Geodesic x, SimpleSpace (Needle x)) => Geodesic (Shade' x) Source # | |
type MetricRequirement Shade' x Source # | |
type Interior (Shade' x) Source # | |
type Needle (Shade' x) Source # | |
(|±|) :: forall x. WithField ℝ EuclidSpace x => x -> [Needle x] -> Shade' x infixl 6 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, occlusion, factoriseShade, coerceShade, orthoShades, linIsoTransformShade, projectShade, embedShade
shadeCtr :: Lens' (shade x) (Interior x) Source #
occlusion :: (PseudoAffine x, SimpleSpace (Needle x), s ~ Scalar (Needle x), RealFloat' 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 :: (PseudoAffine x, SimpleSpace (Needle x), PseudoAffine 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, SimpleSpace (Needle y)) => shade x -> shade y Source #
orthoShades :: (PseudoAffine x, SimpleSpace (Needle x), PseudoAffine y, SimpleSpace (Needle y), Scalar (Needle x) ~ Scalar (Needle y)) => shade x -> shade y -> shade (x, y) Source #
ASCII version of '✠'.
linIsoTransformShade :: (SimpleSpace x, SimpleSpace y, Scalar x ~ Scalar y, Num' (Scalar x)) => (x +> y) -> shade x -> shade y Source #
projectShade :: (Semimanifold x, Semimanifold y, Object (Affine s) (Interior x), Object (Affine s) (Interior y), SimpleSpace (Needle x), SemiInner (Needle y)) => Embedding (Affine s) (Interior x) (Interior y) -> shade y -> shade x Source #
Squash a shade down into a lower dimensional space.
embedShade :: (Semimanifold x, Semimanifold y, Object (Affine s) (Interior x), Object (Affine s) (Interior y), SemiInner (Needle x), SimpleSpace (Needle y)) => Embedding (Affine s) (Interior x) (Interior y) -> shade x -> shade y Source #
Lenses
Construction
fullShade :: (Semimanifold x, SimpleSpace (Needle x)) => Interior x -> Metric' x -> Shade x Source #
fullShade' :: WithField ℝ SimpleSpace 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 s. (Fractional' s, WithField s PseudoAffine x, SimpleSpace (Needle x)) => Interior x -> [Needle x] -> Shade x Source #
Evaluation
occlusion :: (IsShade shade, PseudoAffine x, SimpleSpace (Needle x), s ~ Scalar (Needle x), RealFloat' 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.
prettyShowsPrecShade' :: LtdErrorShow m => Int -> Shade' m -> ShowS Source #
prettyShowShade' :: LtdErrorShow x => Shade' x -> String Source #
class Refinable m => LtdErrorShow m where Source #
showsPrecShade'_errorLtdC
LtdErrorShow ℝ Source # | |
LtdErrorShow ℝ⁰ Source # | |
LtdErrorShow ℝ⁴ Source # | |
LtdErrorShow ℝ³ Source # | |
LtdErrorShow ℝ² Source # | |
(LtdErrorShow x, LtdErrorShow y, (~) * (Scalar (DualVector (Needle' x))) (Scalar (DualVector (Needle' y)))) => LtdErrorShow (x, y) Source # | |
(HilbertSpace v, SemiInner v, FiniteDimensional v, LtdErrorShow v, (~) * (Scalar v) ℝ) => LtdErrorShow (LinearMap ℝ v (ℝ, ℝ)) Source # | |
(HilbertSpace v, SemiInner v, FiniteDimensional v, LtdErrorShow v, (~) * (Scalar v) ℝ) => LtdErrorShow (LinearMap ℝ v ℝ) Source # | |
Misc
factoriseShade :: (IsShade shade, PseudoAffine x, SimpleSpace (Needle x), PseudoAffine y, SimpleSpace (Needle y), Scalar (Needle x) ~ Scalar (Needle y)) => shade (x, y) -> (shade x, shade y) Source #
orthoShades :: (IsShade shade, PseudoAffine x, SimpleSpace (Needle x), PseudoAffine y, SimpleSpace (Needle y), Scalar (Needle x) ~ Scalar (Needle y)) => shade x -> shade y -> shade (x, y) Source #
ASCII version of '✠'.
(✠) :: (IsShade shade, PseudoAffine x, SimpleSpace (Needle x), PseudoAffine y, SimpleSpace (Needle y), Scalar (Needle x) ~ Scalar (Needle y)) => shade x -> shade y -> shade (x, y) infixl 5 Source #
Combine two shades on independent subspaces to a shade with the same
properties on the subspaces (see factoriseShade
) and no covariance.
linIsoTransformShade :: (IsShade shade, SimpleSpace x, SimpleSpace y, Scalar x ~ Scalar y, Num' (Scalar x)) => (x +> y) -> shade x -> shade y Source #
embedShade :: (IsShade shade, Semimanifold x, Semimanifold y, Object (Affine s) (Interior x), Object (Affine s) (Interior y), SemiInner (Needle x), SimpleSpace (Needle y)) => Embedding (Affine s) (Interior x) (Interior y) -> shade x -> shade y Source #
projectShade :: (IsShade shade, Semimanifold x, Semimanifold y, Object (Affine s) (Interior x), Object (Affine s) (Interior y), SimpleSpace (Needle x), SemiInner (Needle y)) => Embedding (Affine s) (Interior x) (Interior y) -> shade y -> shade x Source #
Squash a shade down into a lower dimensional space.
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.
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.
convolveMetric :: Functor p => p y -> Metric y -> Metric y -> Metric y Source #
If p
is in a
(red) and δ
is in b
(green),
then p.+~^δ
is in convolveShade' a b
(blue).
convolveShade' :: Shade' y -> Shade' (Needle y) -> Shade' y Source #
Refinable ℝ Source # | |
Refinable ℝ⁰ Source # | |
Refinable ℝ⁴ Source # | |
Refinable ℝ³ Source # | |
Refinable ℝ² Source # | |
Refinable ℝ¹ Source # | |
(Refinable a, Refinable b, (~) * (Scalar (DualVector (DualVector (Needle b)))) (Scalar (DualVector (DualVector (Needle a))))) => Refinable (a, b) Source # | |
(SimpleSpace a, SimpleSpace b, Refinable a, Refinable b, (~) * (Scalar a) ℝ, (~) * (Scalar b) ℝ, (~) * (Scalar (DualVector a)) ℝ, (~) * (Scalar (DualVector b)) ℝ, (~) * (Scalar (DualVector (DualVector a))) ℝ, (~) * (Scalar (DualVector (DualVector b))) ℝ) => Refinable (LinearMap ℝ a b) Source # | |
subShade' :: Refinable y => 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' :: Refinable y => Shade' y -> Shade' y -> Maybe (Shade' y) Source #
Intersection between two shades.
coerceShade :: (IsShade shade, Manifold x, Manifold y, LocallyCoercible x y, SimpleSpace (Needle y)) => shade x -> shade y 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.
dualShade :: forall x. (PseudoAffine x, SimpleSpace (Needle x)) => Shade x -> Shade' x Source #
dualShade' :: forall x. (PseudoAffine x, SimpleSpace (Needle x)) => Shade' x -> Shade x Source #
wellDefinedShade' :: LinearSpace (Needle x) => Shade' x -> Maybe (Shade' x) Source #
linearProjectShade :: forall s x y. (Num' s, LinearSpace x, SimpleSpace y, Scalar x ~ s, Scalar y ~ s) => (x +> y) -> Shade x -> Shade y 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.
pointsShades' :: forall x y. (WithField ℝ PseudoAffine x, SimpleSpace (Needle x)) => Metric' x -> [(x, y)] -> [([(x, y)], Shade x)] Source #
pseudoECM :: forall x y p. (WithField ℝ PseudoAffine x, SimpleSpace (Needle x), Functor p) => p x -> NonEmpty (x, y) -> (x, ([(x, y)], [(x, y)])) Source #
convolveMetric :: (Refinable y, Functor p) => p y -> Metric y -> Metric y -> Metric y Source #
If p
is in a
(red) and δ
is in b
(green),
then p.+~^δ
is in convolveShade' a b
(blue).
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) Source # | |
type Diff (WithAny x y) Source # | |
type Interior (WithAny x y) Source # | |
type Needle (WithAny x y) Source # | |
shadeWithoutAnything :: Semimanifold x => Shade (x `WithAny` y) -> Shade x Source #
Misc
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 #
Warning: This function never worked properly. Use rangeWithinVertices
.
rangeWithinVertices :: forall s i m t. (RealFrac' s, WithField s PseudoAffine i, WithField s PseudoAffine m, Geodesic i, Geodesic m, SimpleSpace (Needle i), SimpleSpace (Needle m), AffineManifold (Interior i), AffineManifold (Interior m), Object (Affine s) (Interior i), Object (Affine s) (Interior m), Traversable t) => (Interior i, Interior m) -> t (i, m) -> Maybe (Shade i -> Shade m) Source #