Copyright | (c) Justus Sagemüller 2015 |
---|---|
License | GPL v3 |
Maintainer | (@) sagemueller $ geo.uni-koeln.de |
Stability | experimental |
Portability | portable |
Safe Haskell | None |
Language | Haskell2010 |
Several commonly-used manifolds, represented in some simple way as Haskell
data types. All these are in the PseudoAffine
class.
- type Real0 = ℝ⁰
- type Real1 = ℝ
- type RealPlus = ℝay
- type Real2 = ℝ²
- type Real3 = ℝ³
- type Sphere0 = S⁰
- type Sphere1 = S¹
- type Sphere2 = S²
- type Projective1 = ℝP¹
- type Projective2 = ℝP²
- type Disk1 = D¹
- type Disk2 = D²
- type Cone = CD¹
- type OpenCone = Cℝay
- data ZeroDim s :: * -> * = Origin
- type ℝ = Double
- type ℝ⁰ = ZeroDim ℝ
- type ℝ¹ = V1 ℝ
- type ℝ² = V2 ℝ
- type ℝ³ = V3 ℝ
- type ℝ⁴ = V4 ℝ
- newtype Stiefel1 v = Stiefel1 {
- getStiefel1N :: DualVector v
- stiefel1Project :: LinearSpace v => DualVector v -> Stiefel1 v
- stiefel1Embed :: (HilbertSpace v, RealFloat (Scalar v)) => Stiefel1 v -> v
- class (PseudoAffine v, InnerSpace v, NaturallyEmbedded (UnitSphere v) (DualVector v)) => HasUnitSphere v where
- type UnitSphere v :: *
- stiefel :: UnitSphere v -> Stiefel1 v
- unstiefel :: Stiefel1 v -> UnitSphere v
- data S⁰ :: *
- newtype S¹ :: * = S¹ {}
- data S² = S² {}
- type ℝP¹ = S¹
- data ℝP² = ℝP² {}
- newtype D¹ :: * = D¹ {}
- data D² = D² {}
- type ℝay = Cℝay ℝ⁰
- data CD¹ x = CD¹ {}
- data Cℝay x = Cℝay {
- hParamCℝay :: !Double
- pParamCℝay :: !x
- data Line x = Line {
- lineHandle :: x
- lineDirection :: Stiefel1 (Needle' x)
- lineAsPlaneIntersection :: forall x. (WithField ℝ Manifold x, FiniteDimensional (Needle' x)) => Line x -> [Cutplane x]
- data Cutplane x = Cutplane {}
- fathomCutDistance :: forall x. (WithField ℝ PseudoAffine x, LinearSpace (Needle x)) => Cutplane x -> Metric' x -> x -> Maybe ℝ
- sideOfCut :: (WithField ℝ PseudoAffine x, LinearSpace (Needle x)) => Cutplane x -> x -> Maybe S⁰
- cutPosBetween :: WithField ℝ Manifold x => Cutplane x -> (x, x) -> Maybe D¹
- data LinearMap s v w :: * -> * -> * -> *
- type LocalLinear x y = LinearMap (Scalar (Needle x)) (Needle x) (Needle y)
- type StiefelScalar s = (RealFloat s, Unbox s)
Index / ASCII names
type Projective1 = ℝP¹ Source
type Projective2 = ℝP² Source
Linear manifolds
data ZeroDim s :: * -> *
Hyperspheres
General form: Stiefel manifolds
Stiefel1 | |
|
:: LinearSpace v | |
=> DualVector v | Must be nonzero. |
-> Stiefel1 v |
stiefel1Embed :: (HilbertSpace v, RealFloat (Scalar v)) => Stiefel1 v -> v Source
Specific examples
class (PseudoAffine v, InnerSpace v, NaturallyEmbedded (UnitSphere v) (DualVector v)) => HasUnitSphere v where Source
Nothing
type UnitSphere v :: * Source
stiefel :: UnitSphere v -> Stiefel1 v Source
unstiefel :: Stiefel1 v -> UnitSphere v Source
data S⁰ :: *
newtype S¹ :: *
The ordinary unit sphere.
Projective spaces
The two-dimensional real projective space, implemented as a unit disk with opposing points on the rim glued together.
Intervals/disks/cones
newtype D¹ :: *
Show D¹ | |
PseudoAffine D¹ | |
Semimanifold D¹ | |
IntervalLike D¹ Source | |
type Interior D¹ = ℝ | |
type Needle D¹ = ℝ |
The standard, closed unit disk. Homeomorphic to the cone over 'S¹', but not in the the obvious, “flat” way. (And not at all, despite the identical ADT definition, to the projective space 'ℝP²'!)
Better known as ℝ⁺ (which is not a legal Haskell name), the ray of positive numbers (including zero, i.e. closed on one end).
A (closed) cone over a space x
is the product of x
with the closed interval 'D¹'
of “heights”,
except on its “tip”: here, x
is smashed to a single point.
This construct becomes (homeomorphic-to-) an actual geometric cone (and to 'D²') in the
special case x = 'S¹'
.
An open cone is homeomorphic to a closed cone without the “lid”,
i.e. without the “last copy” of x
, at the far end of the height
interval. Since that means the height does not include its supremum, it is actually
more natural to express it as the entire real ray, hence the name.
Cℝay | |
|
Affine subspaces
Lines
Line | |
|
lineAsPlaneIntersection :: forall x. (WithField ℝ Manifold x, FiniteDimensional (Needle' x)) => Line x -> [Cutplane x] Source
Hyperplanes
Oriented hyperplanes, naïvely generalised to PseudoAffine
manifolds:
represents the set of all points Cutplane
p wq
such that
(q.-~.p) ^<.> w ≡ 0
.
In vector spaces this is indeed a hyperplane; for general manifolds it should behave locally as a plane, globally as an (n−1)-dimensional submanifold.
:: (WithField ℝ PseudoAffine x, LinearSpace (Needle x)) | |
=> Cutplane x | Hyperplane to measure the distance from. |
-> Metric' x | Metric to use for measuring that distance.
This can only be accurate if the metric
is valid both around the cut-plane's |
-> x | Point to measure the distance to. |
-> Maybe ℝ | A signed number, giving the distance from plane
to point with indication on which side the point lies.
|
sideOfCut :: (WithField ℝ PseudoAffine x, LinearSpace (Needle x)) => Cutplane x -> x -> Maybe S⁰ Source
Linear mappings
data LinearMap s v w :: * -> * -> * -> *
Num' s => EnhancedCat (->) (LinearMap s) | |
(Show (SubBasis (DualVector u)), Show (SubBasis v)) => Show (SubBasis (LinearMap s u v)) | |
Num' s => Morphism (LinearMap s) | |
Num' s => PreArrow (LinearMap s) | |
Category (LinearMap s) | |
Num' s => Cartesian (LinearMap s) | |
Num' s => EnhancedCat (LinearMap s) (LinearFunction s) | |
Num' s => EnhancedCat (LinearFunction s) (LinearMap s) | |
EnhancedCat (Affine s) (LinearMap s) | |
(Num' s, LinearSpace v, (~) * (Scalar v) s) => Monoidal (LinearMap s v) (LinearFunction s) (LinearFunction s) | |
(LinearSpace v, Num' s, (~) * (Scalar v) s) => Functor (LinearMap s v) (LinearFunction s) (LinearFunction s) | |
(LinearSpace v, (~) * (Scalar v) s) => Functor (LinearMap s v) (Coercion *) (Coercion *) | |
(LinearSpace v, TensorSpace w, (~) * (Scalar v) s, (~) * (Scalar w) s) => VectorSpace (LinearMap s v w) | |
(LinearSpace u, TensorSpace v, (~) * s (Scalar u), (~) * s (Scalar v)) => AffineSpace (LinearMap s u v) | |
(LinearSpace v, TensorSpace w, (~) * (Scalar v) s, (~) * (Scalar w) s) => AdditiveGroup (LinearMap s v w) | |
(LinearSpace u, SemiInner (DualVector u), SemiInner v, (~) * (Scalar u) s, (~) * (Scalar v) s) => SemiInner (LinearMap s u v) | |
(LSpace u, FiniteDimensional (DualVector u), FiniteDimensional v, (~) * (Scalar u) s, (~) * (Scalar v) s, (~) * (Scalar (DualVector v)) s, Fractional' (Scalar v)) => FiniteDimensional (LinearMap s u v) | |
(LinearSpace u, TensorSpace v, (~) * (Scalar u) s, (~) * (Scalar v) s) => TensorSpace (LinearMap s u v) | |
(LinearSpace u, LinearSpace v, (~) * (Scalar u) s, (~) * (Scalar v) s) => LinearSpace (LinearMap s u v) | |
(LinearSpace v, TensorSpace w, (~) * (Scalar v) s, (~) * (Scalar w) s) => PseudoAffine (LinearMap s v w) | |
(LinearSpace v, TensorSpace w, (~) * (Scalar v) s, (~) * (Scalar w) s) => Semimanifold (LinearMap s v w) | |
(LinearSpace v, (~) * (Scalar v) s, TensorSpace w, (~) * (Scalar w) s) => Atlas (LinearMap s v w) Source | |
(LinearSpace v, (~) * (Scalar v) ℝ, TensorSpace w, (~) * (Scalar w) ℝ) => Geodesic (LinearMap ℝ v w) 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 | |
type UnitObject (LinearMap s) = ZeroDim s | |
type Object (LinearMap s) v = (LinearSpace v, (~) * (Scalar v) s) | |
type PairObjects (LinearMap s) a b = () | |
type Diff (LinearMap s u v) = LinearMap s u v | |
type Scalar (LinearMap s v w) = s | |
data SubBasis (LinearMap s u v) = LinMapBasis !(SubBasis (DualVector u)) !(SubBasis v) | |
type DualVector (LinearMap s u v) = Tensor s u (DualVector v) | |
type Interior (LinearMap s v w) = LinearMap s v w | |
type Needle (LinearMap s v w) = LinearMap s v w | |
type ChartIndex (LinearMap s v w) = () Source | |
type TensorProduct (LinearMap s u v) w = TensorProduct (DualVector u) (Tensor s v w) |
Misc
type StiefelScalar s = (RealFloat s, Unbox s) Source