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 k = Origin
- type ℝ⁰ = ZeroDim ℝ
- type ℝ = Double
- type ℝ² = (ℝ, ℝ)
- type ℝ³ = (ℝ², ℝ)
- data Stiefel1 v
- stiefel1Project :: LinearManifold v => DualSpace v -> Stiefel1 v
- stiefel1Embed :: HilbertSpace v => Stiefel1 v -> v
- class (PseudoAffine v, InnerSpace v, NaturallyEmbedded (UnitSphere v) (DualSpace 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 :: WithField ℝ Manifold x => Line x -> [Cutplane x]
- data Cutplane x = Cutplane {}
- fathomCutDistance :: WithField ℝ Manifold x => Cutplane x -> HerMetric' (Needle x) -> x -> Option ℝ
- sideOfCut :: WithField ℝ Manifold x => Cutplane x -> x -> Option S⁰
- cutPosBetween :: WithField ℝ Manifold x => Cutplane x -> (x, x) -> Option D¹
- data Linear s a b
- type LocalLinear x y = Linear (Scalar (Needle x)) (Needle x) (Needle y)
- denseLinear :: forall v w s. (FiniteDimensional v, FiniteDimensional w, Scalar w ~ s) => (v -> w) -> Linear s v w
Index / ASCII names
type Projective1 = ℝP¹ Source
type Projective2 = ℝP² Source
Linear manifolds
A single point. Can be considered a zero-dimensional vector space, WRT any scalar.
Eq (ZeroDim k) Source | |
Show (ZeroDim k) Source | |
Monoid (ZeroDim k) Source | |
AffineSpace (ZeroDim k) Source | |
HasBasis (ZeroDim k) Source | |
VectorSpace (ZeroDim k) Source | |
AdditiveGroup (ZeroDim k) Source | |
SmoothScalar k => FiniteDimensional (ZeroDim k) Source | |
MetricScalar k => HasMetric' (ZeroDim k) Source | |
PseudoAffine (ZeroDim k) Source | |
Semimanifold (ZeroDim k) Source | |
IntervalLike (Cℝay ℝ⁰) Source | |
IntervalLike (CD¹ ℝ⁰) Source | |
Geodesic (Cℝay ℝ⁰) Source | |
Geodesic (CD¹ ℝ⁰) Source | |
Geodesic (ZeroDim ℝ) Source | |
type Diff (ZeroDim k) = ZeroDim k Source | |
type Basis (ZeroDim k) = Void Source | |
type Scalar (ZeroDim k) = k Source | |
type DualSpace (ZeroDim k) = ZeroDim k | |
type Needle (ZeroDim k) = ZeroDim k Source | |
type Interior (ZeroDim k) = ZeroDim k |
Hyperspheres
General form: Stiefel manifolds
The n-th Stiefel manifold is the space of all possible configurations of
n orthonormal vectors. In the case n = 1, simply the subspace of normalised
vectors, i.e. equivalent to the UnitSphere
. Even so, it strictly speaking
requires the containing space to be at least metric (if not Hilbert); we would
however like to be able to use this concept also in spaces with no inner product,
therefore we define this space not as normalised vectors, but rather as all
vectors modulo scaling by positive factors.
:: LinearManifold v | |
=> DualSpace v | Must be nonzero. |
-> Stiefel1 v |
stiefel1Embed :: HilbertSpace v => Stiefel1 v -> v Source
Specific examples
class (PseudoAffine v, InnerSpace v, NaturallyEmbedded (UnitSphere v) (DualSpace v)) => HasUnitSphere v where Source
Nothing
type UnitSphere v :: * Source
stiefel :: UnitSphere v -> Stiefel1 v Source
unstiefel :: Stiefel1 v -> UnitSphere v Source
The zero-dimensional sphere is actually just two points. Implementation might
therefore change to ℝ⁰
: the disjoint sum of two
single-point spaces.+
ℝ⁰
The unit circle.
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
The “one-dimensional disk” – really just the line segment between the two points -1 and 1 of 'S⁰', i.e. this is simply a closed interval.
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¹'
.
IntervalLike (CD¹ ℝ⁰) Source | |
IntervalLike (CD¹ S⁰) Source | |
(WithField ℝ HilbertSpace a, WithField ℝ HilbertSpace b, Geodesic (a, b)) => Geodesic (CD¹ (a, b)) Source | |
Geodesic (CD¹ ℝ) Source | |
Geodesic (CD¹ ℝ⁰) Source | |
Geodesic (CD¹ S²) Source | |
Geodesic (CD¹ S¹) Source | |
Geodesic (CD¹ S⁰) Source | |
type Needle (CD¹ m) Source | |
type Interior (CD¹ m) Source |
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 | |
|
IntervalLike (Cℝay ℝ⁰) Source | |
IntervalLike (Cℝay S⁰) Source | |
(WithField ℝ HilbertSpace a, WithField ℝ HilbertSpace b, Geodesic (a, b)) => Geodesic (Cℝay (a, b)) Source | |
Geodesic (Cℝay ℝ) Source | |
Geodesic (Cℝay ℝ⁰) Source | |
Geodesic (Cℝay S²) Source | |
Geodesic (Cℝay S¹) Source | |
Geodesic (Cℝay S⁰) Source | |
type Needle (Cℝay m) Source | |
type Interior (Cℝay m) Source |
Affine subspaces
Lines
Line | |
|
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 ℝ Manifold x | |
=> Cutplane x | Hyperplane to measure the distance from. |
-> HerMetric' (Needle 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. |
-> Option ℝ | A signed number, giving the distance from plane
to point with indication on which side the point lies.
|
Linear mappings
A linear mapping between finite-dimensional spaces, implemeted as a dense matrix.
Note that this is equivalent to the tensor product
. One
of the types should be deprecated in the future, or either implemented in
terms of the other.DualSpace
a ⊗ b
denseLinear :: forall v w s. (FiniteDimensional v, FiniteDimensional w, Scalar w ~ s) => (v -> w) -> Linear s v w Source