Copyright | (c) Justus Sagemüller 2015 |
---|---|
License | GPL v3 |
Maintainer | (@) jsag $ hvl.no |
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.
Synopsis
- type Real0 = ℝ⁰
- type Real1 = ℝ
- type RealPlus = ℝay
- type Real2 = ℝ²
- type Real3 = ℝ³
- type Sphere0 = S⁰
- type Sphere1 = S¹
- type Sphere2 = S²
- type Projective0 = ℝP⁰
- type Projective1 = ℝP¹
- type Projective2 = ℝP²
- type Disk1 = D¹
- type Disk2 = D²
- type Cone = CD¹
- type OpenCone = Cℝay
- data FibreBundle b f = FibreBundle {
- baseSpace :: !b
- fibreSpace :: !f
- type TangentBundle m = FibreBundle m (Needle m)
- 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¹Polar {}
- pattern S¹ :: Double -> S¹
- data S² = S²Polar {}
- pattern S² :: Double -> Double -> S²
- data ℝP⁰ = ℝPZero
- newtype ℝP¹ = HemisphereℝP¹Polar {}
- pattern ℝP¹ :: Double -> ℝP¹
- data ℝP² = HemisphereℝP²Polar {}
- pattern ℝP² :: Double -> Double -> ℝP²
- newtype D¹ = D¹ {}
- data D² = D²Polar {}
- pattern D² :: Double -> Double -> 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 {}
- normalPlane :: x -> Needle' x -> Cutplane x
- 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 Projective0 = ℝP⁰ Source #
type Projective1 = ℝP¹ Source #
type Projective2 = ℝP² Source #
data FibreBundle b f #
A fibre bundle combines points in the base space b
with points in the fibre
f
. The type FibreBundle b f
is thus isomorphic to the tuple space (b,f)
, but
it can have a different topology, the prime example being TangentBundle
, where
nearby points may have differently-oriented tangent spaces.
FibreBundle | |
|
Instances
type TangentBundle m = FibreBundle m (Needle m) #
Points on a manifold, combined with vectors in the respective tangent space.
Linear manifolds
Instances
Hyperspheres
General form: Stiefel manifolds
Instances
:: 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 #
Instances
HasUnitSphere ℝ Source # | |
Defined in Data.Manifold.Cone type UnitSphere ℝ :: Type Source # | |
HasUnitSphere ℝ³ Source # | |
Defined in Data.Manifold.Cone type UnitSphere ℝ³ :: Type Source # | |
HasUnitSphere ℝ² Source # | |
Defined in Data.Manifold.Cone type UnitSphere ℝ² :: Type Source # |
The zero-dimensional sphere is actually just two points. Implementation might
therefore change to ℝ⁰
: the disjoint sum of two
single-point spaces.+
ℝ⁰
Instances
Eq S⁰ | |
Show S⁰ | |
Generic S⁰ | |
Function S⁰ Source # | |
Arbitrary S⁰ Source # | |
CoArbitrary S⁰ Source # | |
Defined in Data.Manifold.Types.Primitive coarbitrary :: S⁰ -> Gen b -> Gen b # | |
Binary S⁰ Source # | |
Semimanifold S⁰ | |
Defined in Math.Manifold.Core.PseudoAffine | |
PseudoAffine S⁰ | |
Show S⁰ Source # | |
Atlas S⁰ Source # | |
Defined in Data.Manifold.Atlas type ChartIndex S⁰ :: Type Source # chartReferencePoint :: ChartIndex S⁰ -> S⁰ Source # interiorChartReferencePoint :: Functor p => p S⁰ -> ChartIndex S⁰ -> Interior S⁰ Source # lookupAtlas :: S⁰ -> ChartIndex S⁰ Source # | |
Geodesic S⁰ Source # | |
Defined in Data.Manifold.Riemannian geodesicBetween :: S⁰ -> S⁰ -> Maybe (D¹ -> S⁰) Source # | |
NaturallyEmbedded S⁰ ℝ Source # | |
type Rep S⁰ | |
Defined in Math.Manifold.Core.Types.Internal | |
type Interior S⁰ | |
Defined in Math.Manifold.Core.PseudoAffine | |
type Needle S⁰ | |
Defined in Math.Manifold.Core.PseudoAffine | |
type ChartIndex S⁰ Source # | |
Defined in Data.Manifold.Atlas |
The unit circle.
Instances
The ordinary unit sphere.
Instances
Projective spaces
Instances
Eq ℝP⁰ | |
Show ℝP⁰ | |
Generic ℝP⁰ | |
Arbitrary ℝP⁰ Source # | |
Binary ℝP⁰ Source # | |
Semimanifold ℝP⁰ | |
Defined in Math.Manifold.Core.PseudoAffine | |
PseudoAffine ℝP⁰ | |
Connected ℝP⁰ Source # | |
type Rep ℝP⁰ | |
type Interior ℝP⁰ | |
Defined in Math.Manifold.Core.PseudoAffine | |
type Needle ℝP⁰ | |
Defined in Math.Manifold.Core.PseudoAffine |
Instances
Show ℝP¹ | |
Generic ℝP¹ | |
Arbitrary ℝP¹ Source # | |
Binary ℝP¹ Source # | |
Semimanifold ℝP¹ | |
Defined in Math.Manifold.Core.PseudoAffine | |
PseudoAffine ℝP¹ | |
Connected ℝP¹ Source # | |
type Rep ℝP¹ | |
Defined in Math.Manifold.Core.Types.Internal | |
type Interior ℝP¹ | |
Defined in Math.Manifold.Core.PseudoAffine | |
type Needle ℝP¹ | |
Defined in Math.Manifold.Core.PseudoAffine |
The two-dimensional real projective space, implemented as a disk with
opposing points on the rim glued together. Image this disk as the northern hemisphere
of a unit sphere; ℝP²
is the space of all straight lines passing through
the origin of ℝ³
, and each of these lines is represented by the point at which it
passes through the hemisphere.
Instances
Show ℝP² | |
Generic ℝP² | |
Arbitrary ℝP² Source # | |
Binary ℝP² Source # | |
Semimanifold ℝP² Source # | |
Defined in Data.Manifold.PseudoAffine | |
PseudoAffine ℝP² Source # | |
Connected ℝP² Source # | |
NaturallyEmbedded ℝP² ℝ³ Source # | |
type Rep ℝP² | |
Defined in Math.Manifold.Core.Types.Internal type Rep ℝP² = D1 (MetaData "\8477P\178" "Math.Manifold.Core.Types.Internal" "manifolds-core-0.5.0.4-B8Kp6L8TW711kRSgoVKNgU" False) (C1 (MetaCons "Hemisphere\8477P\178Polar" PrefixI True) (S1 (MetaSel (Just "\977Param\8477P\178") NoSourceUnpackedness SourceStrict DecidedStrict) (Rec0 Double) :*: S1 (MetaSel (Just "\966Param\8477P\178") NoSourceUnpackedness SourceStrict DecidedStrict) (Rec0 Double))) | |
type Interior ℝP² Source # | |
Defined in Data.Manifold.PseudoAffine | |
type Needle ℝP² Source # | |
Defined in Data.Manifold.PseudoAffine |
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.
Instances
Show D¹ | |
Generic D¹ | |
Arbitrary D¹ Source # | |
Binary D¹ Source # | |
Semimanifold D¹ | |
Defined in Math.Manifold.Core.PseudoAffine | |
PseudoAffine D¹ | |
IntervalLike D¹ Source # | |
Defined in Data.Manifold.Riemannian toClosedInterval :: D¹ -> D¹ Source # | |
NaturallyEmbedded D¹ ℝ Source # | |
type Rep D¹ | |
Defined in Math.Manifold.Core.Types.Internal | |
type Interior D¹ | |
Defined in Math.Manifold.Core.PseudoAffine | |
type Needle D¹ | |
Defined in Math.Manifold.Core.PseudoAffine |
The standard, closed unit disk. Homeomorphic to the cone over S¹
, but not in the
the obvious, “flat” way. (In is not homeomorphic, despite
the almost identical ADT definition, to the projective space ℝP²
!)
Instances
Show D² | |
Generic D² | |
Arbitrary D² Source # | |
Binary D² Source # | |
type Rep D² | |
Defined in Math.Manifold.Core.Types.Internal type Rep D² = D1 (MetaData "D\178" "Math.Manifold.Core.Types.Internal" "manifolds-core-0.5.0.4-B8Kp6L8TW711kRSgoVKNgU" False) (C1 (MetaCons "D\178Polar" PrefixI True) (S1 (MetaSel (Just "rParamD\178") NoSourceUnpackedness SourceStrict DecidedStrict) (Rec0 Double) :*: S1 (MetaSel (Just "\966ParamD\178") NoSourceUnpackedness SourceStrict DecidedStrict) (Rec0 Double))) |
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¹
Instances
Show x => Show (CD¹ x) | |
Generic (CD¹ x) | |
Binary y => Binary (CD¹ y) Source # | |
ConeSemimfd m => Semimanifold (CD¹ m) Source # | |
Defined in Data.Manifold.Cone | |
type Rep (CD¹ x) | |
Defined in Math.Manifold.Core.Types.Internal type Rep (CD¹ x) = D1 (MetaData "CD\185" "Math.Manifold.Core.Types.Internal" "manifolds-core-0.5.0.4-B8Kp6L8TW711kRSgoVKNgU" False) (C1 (MetaCons "CD\185" PrefixI True) (S1 (MetaSel (Just "hParamCD\185") NoSourceUnpackedness SourceStrict DecidedStrict) (Rec0 Double) :*: S1 (MetaSel (Just "pParamCD\185") NoSourceUnpackedness SourceStrict DecidedStrict) (Rec0 x))) | |
type Interior (CD¹ m) Source # | |
Defined in Data.Manifold.Cone | |
type Needle (CD¹ m) Source # | |
Defined in Data.Manifold.Cone |
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 | |
|
Instances
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
The tensor product between one space's dual space and another space is the space spanned by vector–dual-vector pairs, in bra-ket notation written as
m = ∑ |w⟩⟨v|
Any linear mapping can be written as such a (possibly infinite) sum. The
TensorProduct
data structure only stores the linear independent parts
though; for simple finite-dimensional spaces this means e.g.
effectively boils down to an ordinary matrix type, namely an array of
column-vectors LinearMap
ℝ ℝ³ ℝ³|w⟩
.
(The ⟨v|
dual-vectors are then simply assumed to come from the canonical basis.)
For bigger spaces, the tensor product may be implemented in a more efficient
sparse structure; this can be defined in the TensorSpace
instance.
Instances
Misc
type StiefelScalar s = (RealFloat s, Unbox s) Source #
Orphan instances
(LinearSpace v, FiniteFreeSpace v, FiniteFreeSpace (DualVector v), StiefelScalar (Scalar v)) => Semimanifold (Stiefel1 v) Source # | |
(.+~^) :: Interior (Stiefel1 v) -> Needle (Stiefel1 v) -> Stiefel1 v # fromInterior :: Interior (Stiefel1 v) -> Stiefel1 v # toInterior :: Stiefel1 v -> Maybe (Interior (Stiefel1 v)) # translateP :: Tagged (Stiefel1 v) (Interior (Stiefel1 v) -> Needle (Stiefel1 v) -> Interior (Stiefel1 v)) # (.-~^) :: Interior (Stiefel1 v) -> Needle (Stiefel1 v) -> Stiefel1 v # | |
(LinearSpace v, FiniteFreeSpace v, FiniteFreeSpace (DualVector v), StiefelScalar (Scalar v)) => PseudoAffine (Stiefel1 v) Source # | |