manifolds-0.6.0.0: Coordinate-free hypersurfaces
Copyright(c) Justus Sagemüller 2016
LicenseGPL v3
Maintainer(@) jsagemue $ uni-koeln.de
Stabilityexperimental
Portabilityportable
Safe HaskellNone
LanguageHaskell2010

Data.Manifold.Shade

Description

 
Synopsis

Shades

data Shade x where Source #

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.

Constructors

Shade 

Fields

Instances

Instances details
ImpliesMetric Shade Source # 
Instance details

Defined in Data.Manifold.Shade

Associated Types

type MetricRequirement Shade x Source #

IsShade Shade Source # 
Instance details

Defined in Data.Manifold.Shade

(Show x, Show (Metric' x), WithField PseudoAffine x) => Show (Shade x) Source # 
Instance details

Defined in Data.Manifold.Shade

Methods

showsPrec :: Int -> Shade x -> ShowS #

show :: Shade x -> String #

showList :: [Shade x] -> ShowS #

(PseudoAffine x, VectorSpace (Needle x)) => Semimanifold (Shade x) Source # 
Instance details

Defined in Data.Manifold.Shade

Associated Types

type Needle (Shade x) #

LtdErrorShow x => Show (Shade x) Source # 
Instance details

Defined in Data.Manifold.Shade

Methods

showsPrec :: Int -> Shade x -> ShowS #

show :: Shade x -> String #

showList :: [Shade x] -> ShowS #

(AffineSpace x, Manifold x, Diff x ~ Needle x, Atlas x, HasTrie (ChartIndex x), LinearSpace (Needle x), LinearSpace (Needle' x), Num' (Scalar (Needle x))) => SemimanifoldWithBoundary (Shade x) Source # 
Instance details

Defined in Data.Manifold.Shade

Associated Types

type Interior (Shade x) Source #

type Boundary (Shade x) Source #

type HalfNeedle (Shade x) Source #

(AffineSpace x, Manifold x, Diff x ~ Needle x, Atlas x, HasTrie (ChartIndex x), Geodesic x, LinearSpace (Needle x), LinearSpace (Needle' x), Scalar (Needle x) ~ ) => Geodesic (Shade x) Source # 
Instance details

Defined in Data.Manifold.Shade

Methods

geodesicBetween :: Shade x -> Shade x -> Maybe ( -> Shade x) Source #

middleBetween :: Shade x -> Shade x -> Maybe (Shade x) Source #

type MetricRequirement Shade x Source # 
Instance details

Defined in Data.Manifold.Shade

type Needle (Shade x) Source # 
Instance details

Defined in Data.Manifold.Shade

type Needle (Shade x)
type Interior (Shade x) Source # 
Instance details

Defined in Data.Manifold.Shade

type Interior (Shade x) = Shade' x
type Boundary (Shade x) Source # 
Instance details

Defined in Data.Manifold.Shade

type Boundary (Shade x) = x
type HalfNeedle (Shade x) Source # 
Instance details

Defined in Data.Manifold.Shade

type HalfNeedle (Shade x)

pattern (:±) :: () => (Semimanifold x, SimpleSpace (Needle x)) => x -> [Needle x] -> Shade x infixl 6 Source #

Span a Shade from a center point and multiple deviation-vectors.

data Shade' x Source #

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.

Constructors

Shade' 

Fields

Instances

Instances details
ImpliesMetric Shade' Source # 
Instance details

Defined in Data.Manifold.Shade

Associated Types

type MetricRequirement Shade' x Source #

IsShade Shade' Source # 
Instance details

Defined in Data.Manifold.Shade

LtdErrorShow x => Show (Shade' x) Source # 
Instance details

Defined in Data.Manifold.Shade

Methods

showsPrec :: Int -> Shade' x -> ShowS #

show :: Shade' x -> String #

showList :: [Shade' x] -> ShowS #

AffineManifold x => Semimanifold (Shade' x) Source # 
Instance details

Defined in Data.Manifold.Shade

Associated Types

type Needle (Shade' x) #

LtdErrorShow x => Show (Shade' x) Source # 
Instance details

Defined in Data.Manifold.Shade

Methods

showsPrec :: Int -> Shade' x -> ShowS #

show :: Shade' x -> String #

showList :: [Shade' x] -> ShowS #

(AffineSpace x, Manifold x, Diff x ~ Needle x, Atlas' x, LinearSpace (Needle x), LinearSpace (Needle' x)) => SemimanifoldWithBoundary (Shade' x) Source # 
Instance details

Defined in Data.Manifold.Shade

Associated Types

type Interior (Shade' x) Source #

type Boundary (Shade' x) Source #

type HalfNeedle (Shade' x) Source #

(WithField AffineManifold x, Geodesic x, SimpleSpace (Needle x)) => Geodesic (Shade' x) Source # 
Instance details

Defined in Data.Manifold.Shade

type MetricRequirement Shade' x Source # 
Instance details

Defined in Data.Manifold.Shade

type Needle (Shade' x) Source # 
Instance details

Defined in Data.Manifold.Shade

type Needle (Shade' x)
type Interior (Shade' x) Source # 
Instance details

Defined in Data.Manifold.Shade

type Interior (Shade' x) = Shade x
type Boundary (Shade' x) Source # 
Instance details

Defined in Data.Manifold.Shade

type Boundary (Shade' x) = x
type HalfNeedle (Shade' x) Source # 
Instance details

Defined in Data.Manifold.Shade

(|±|) :: 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 Source #

Instances

Instances details
IsShade Shade' Source # 
Instance details

Defined in Data.Manifold.Shade

IsShade Shade Source # 
Instance details

Defined in Data.Manifold.Shade

Lenses

shadeCtr :: IsShade shade => Lens' (shade x) x Source #

Access the center of a Shade or a Shade'.

Construction

pointsShades :: (WithField PseudoAffine x, SimpleSpace (Needle x)) => [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.

pointsCovers :: forall x. (WithField PseudoAffine x, SimpleSpace (Needle x)) => [x] -> [Shade x] Source #

Like pointsShades, but ensure that all points are actually in the shade, i.e. if [Shade x₀ ex] is the result then metric (recipMetric ex) (p-x₀) ≤ 1 for all p in the list.

coverAllAround :: forall x s. (Fractional' s, WithField s PseudoAffine x, SimpleSpace (Needle x)) => 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.

class Refinable m => LtdErrorShow m Source #

Minimal complete definition

showsPrecShade'_errorLtdC

Instances

Instances details
LtdErrorShow Source # 
Instance details

Defined in Data.Manifold.Shade

LtdErrorShow ℝ⁰ Source # 
Instance details

Defined in Data.Manifold.Shade

LtdErrorShow ℝ⁴ Source # 
Instance details

Defined in Data.Manifold.Shade

LtdErrorShow ℝ³ Source # 
Instance details

Defined in Data.Manifold.Shade

LtdErrorShow ℝ² Source # 
Instance details

Defined in Data.Manifold.Shade

(LtdErrorShow x, LtdErrorShow y, Scalar (DualVector (Needle' x)) ~ Scalar (DualVector (Needle' y))) => LtdErrorShow (x, y) Source # 
Instance details

Defined in Data.Manifold.Shade

Methods

ltdErrorShowWitness :: LtdErrorShowWitness (x, y)

showsPrecShade'_errorLtdC :: Int -> Shade' (x, y) -> ShowS

prettyShowsPrecShade :: Int -> Shade (x, y) -> ShowS

prettyShowsPrecShade' :: Int -> Shade' (x, y) -> ShowS Source #

(HilbertSpace v, SemiInner v, FiniteDimensional v, LtdErrorShow v, Scalar v ~ ) => LtdErrorShow (LinearMap v (, )) Source # 
Instance details

Defined in Data.Manifold.Shade

(HilbertSpace v, SemiInner v, FiniteDimensional v, LtdErrorShow v, Scalar v ~ ) => LtdErrorShow (LinearMap v ) Source # 
Instance details

Defined in Data.Manifold.Shade

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) x, Object (Affine s) y, SemiInner (Needle x), SimpleSpace (Needle y)) => Embedding (Affine s) x y -> shade x -> shade y Source #

Include a shade in a higher-dimensional space. Notice that this behaves fundamentally different for Shade and Shade'. For Shade, it gives a “flat image” of the region, whereas for Shade' it gives an “extrusion pillar” pointing in the projection's orthogonal complement.

projectShade :: (IsShade shade, Semimanifold x, Semimanifold y, Object (Affine s) x, Object (Affine s) y, SimpleSpace (Needle x), SemiInner (Needle y)) => Embedding (Affine s) x y -> shade y -> shade x Source #

Squash a shade down into a lower dimensional space.

class (WithField PseudoAffine y, SimpleSpace (Needle y)) => Refinable y Source #

Class of manifolds which can use Shade' as a basic set type. This is easily possible for vector spaces with the default implementations.

Instances

Instances details
Refinable Source # 
Instance details

Defined in Data.Manifold.Shade

Refinable ℝ⁰ Source # 
Instance details

Defined in Data.Manifold.Shade

Refinable ℝ⁴ Source # 
Instance details

Defined in Data.Manifold.Shade

Refinable ℝ³ Source # 
Instance details

Defined in Data.Manifold.Shade

Refinable ℝ² Source # 
Instance details

Defined in Data.Manifold.Shade

Refinable ℝ¹ Source # 
Instance details

Defined in Data.Manifold.Shade

(Refinable a, Refinable b, Scalar (DualVector (DualVector (Needle b))) ~ Scalar (DualVector (DualVector (Needle a)))) => Refinable (a, b) Source # 
Instance details

Defined in Data.Manifold.Shade

Methods

debugView :: Maybe (DebugView (a, b))

subShade' :: Shade' (a, b) -> Shade' (a, b) -> Bool Source #

refineShade' :: Shade' (a, b) -> Shade' (a, b) -> Maybe (Shade' (a, b)) Source #

convolveMetric :: Functor p => p (a, b) -> Metric (a, b) -> Metric (a, b) -> Metric (a, b) Source #

convolveShade' :: Shade' (a, b) -> Shade' (Needle (a, b)) -> Shade' (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 # 
Instance details

Defined in Data.Manifold.Shade

subShade' :: Refinable y => Shade' y -> Shade' y -> Bool Source #

a subShade` b ≡ True means a is fully contained in b, i.e. from minusLogOcclusion' a p < 1 follows also minusLogOcclusion' 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 #

linearProjectShade :: forall x y s. (Num' s, LinearSpace x, SimpleSpace y, Scalar x ~ s, Scalar y ~ s) => (x +> y) -> Shade x -> Shade y Source #

shadesMerge Source #

Arguments

:: forall x. (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]

mn 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).

Example: https://nbviewer.jupyter.org/github/leftaroundabout/manifolds/blob/master/test/ShadeCombinations.ipynb#shadeConvolutions

data WithAny x 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.

Constructors

WithAny 

Fields

Instances

Instances details
AdditiveGroup x => Monad (WithAny x) Source # 
Instance details

Defined in Data.Manifold.Shade

Methods

(>>=) :: WithAny x a -> (a -> WithAny x b) -> WithAny x b #

(>>) :: WithAny x a -> WithAny x b -> WithAny x b #

return :: a -> WithAny x a #

Functor (WithAny x) Source # 
Instance details

Defined in Data.Manifold.Shade

Methods

fmap :: (a -> b) -> WithAny x a -> WithAny x b #

(<$) :: a -> WithAny x b -> WithAny x a #

AdditiveGroup x => Applicative (WithAny x) Source # 
Instance details

Defined in Data.Manifold.Shade

Methods

pure :: a -> WithAny x a #

(<*>) :: WithAny x (a -> b) -> WithAny x a -> WithAny x b #

liftA2 :: (a -> b -> c) -> WithAny x a -> WithAny x b -> WithAny x c #

(*>) :: WithAny x a -> WithAny x b -> WithAny x b #

(<*) :: WithAny x a -> WithAny x b -> WithAny x a #

(Show y, Show x) => Show (WithAny x y) Source # 
Instance details

Defined in Data.Manifold.Shade

Methods

showsPrec :: Int -> WithAny x y -> ShowS #

show :: WithAny x y -> String #

showList :: [WithAny x y] -> ShowS #

Generic (WithAny x y) Source # 
Instance details

Defined in Data.Manifold.Shade

Associated Types

type Rep (WithAny x y) :: Type -> Type #

Methods

from :: WithAny x y -> Rep (WithAny x y) x0 #

to :: Rep (WithAny x y) x0 -> WithAny x y #

(NFData x, NFData y) => NFData (WithAny x y) Source # 
Instance details

Defined in Data.Manifold.Shade

Methods

rnf :: WithAny x y -> () #

(AdditiveGroup x, Monoid y) => AdditiveGroup (WithAny x y) Source # 
Instance details

Defined in Data.Manifold.Shade

Methods

zeroV :: WithAny x y #

(^+^) :: WithAny x y -> WithAny x y -> WithAny x y #

negateV :: WithAny x y -> WithAny x y #

(^-^) :: WithAny x y -> WithAny x y -> WithAny x y #

(VectorSpace x, Monoid y) => VectorSpace (WithAny x y) Source # 
Instance details

Defined in Data.Manifold.Shade

Associated Types

type Scalar (WithAny x y) #

Methods

(*^) :: Scalar (WithAny x y) -> WithAny x y -> WithAny x y #

AffineSpace x => AffineSpace (WithAny x y) Source # 
Instance details

Defined in Data.Manifold.Shade

Associated Types

type Diff (WithAny x y) #

Methods

(.-.) :: WithAny x y -> WithAny x y -> Diff (WithAny x y) #

(.+^) :: WithAny x y -> Diff (WithAny x y) -> WithAny x y #

PseudoAffine x => PseudoAffine (WithAny x y) Source # 
Instance details

Defined in Data.Manifold.Shade

Semimanifold x => Semimanifold (WithAny x y) Source # 
Instance details

Defined in Data.Manifold.Shade

Associated Types

type Needle (WithAny x y) #

type Rep (WithAny x y) Source # 
Instance details

Defined in Data.Manifold.Shade

type Rep (WithAny x y) = D1 ('MetaData "WithAny" "Data.Manifold.Shade" "manifolds-0.6.0.0-2hpTy2WDbWFIao1Zhdbsgu" 'False) (C1 ('MetaCons "WithAny" 'PrefixI 'True) (S1 ('MetaSel ('Just "_untopological") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 y) :*: S1 ('MetaSel ('Just "_topological") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 x)))
type Scalar (WithAny x y) Source # 
Instance details

Defined in Data.Manifold.Shade

type Scalar (WithAny x y) = Scalar x
type Diff (WithAny x y) Source # 
Instance details

Defined in Data.Manifold.Shade

type Diff (WithAny x y) = Diff x
type Needle (WithAny x y) Source # 
Instance details

Defined in Data.Manifold.Shade

type Needle (WithAny x y) = Needle x

Misc