{-# LANGUAGE FlexibleInstances #-}
{-# LANGUAGE UndecidableInstances #-}
{-# LANGUAGE TypeFamilies #-}
{-# LANGUAGE FlexibleContexts #-}
{-# LANGUAGE GADTs #-}
{-# LANGUAGE DefaultSignatures #-}
{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE StandaloneDeriving #-}
{-# LANGUAGE UnicodeSyntax #-}
{-# LANGUAGE EmptyCase #-}
{-# LANGUAGE ConstraintKinds #-}
{-# LANGUAGE ScopedTypeVariables #-}
{-# LANGUAGE TypeOperators #-}
{-# LANGUAGE CPP #-}
module Math.Manifold.Core.PseudoAffine where
import Data.VectorSpace
import Data.AffineSpace
import Data.Basis
import Data.Fixed (mod')
import Data.Void
import Math.Manifold.Core.Types.Internal
import Math.Manifold.VectorSpace.ZeroDimensional
import Control.Applicative
import Control.Arrow
import qualified GHC.Generics as Gnrx
import GHC.Generics (Generic, (:*:)(..))
import Data.CallStack (HasCallStack)
type ℝeal r = (RealFloat r, PseudoAffine r, Semimanifold r, Needle r ~ r)
data SemimanifoldWitness x where
SemimanifoldWitness ::
( Semimanifold (Needle x)
, Needle (Needle x) ~ Needle x )
=> SemimanifoldWitness x
data PseudoAffineWitness x where
PseudoAffineWitness :: PseudoAffine (Needle x)
=> SemimanifoldWitness x -> PseudoAffineWitness x
infix 6 .-~., .-~!
infixl 6 .+~^, .-~^
class AdditiveGroup (Needle x) => Semimanifold x where
type Needle x :: *
type Needle x = GenericNeedle x
(.+~^) :: x -> Needle x -> x
default (.+~^) :: ( Generic x, Semimanifold (VRep x)
, Needle x ~ GenericNeedle x )
=> x -> Needle x -> x
x
p.+~^GenericNeedle v = Rep x Void -> x
forall a x. Generic a => Rep a x -> a
Gnrx.to (x -> Rep x Void
forall a x. Generic a => a -> Rep a x
Gnrx.from x
pRep x Void -> Needle (Rep x Void) -> Rep x Void
forall x. Semimanifold x => x -> Needle x -> x
.+~^Needle (Rep x Void)
v :: Gnrx.Rep x Void)
(.-~^) :: x -> Needle x -> x
x
p .-~^ Needle x
v = x
p x -> Needle x -> x
forall x. Semimanifold x => x -> Needle x -> x
.+~^ Needle x -> Needle x
forall v. AdditiveGroup v => v -> v
negateV Needle x
v
semimanifoldWitness :: SemimanifoldWitness x
default semimanifoldWitness ::
( Semimanifold (Needle x), Needle (Needle x) ~ Needle x )
=> SemimanifoldWitness x
semimanifoldWitness = SemimanifoldWitness x
forall x.
(Semimanifold (Needle x), Needle (Needle x) ~ Needle x) =>
SemimanifoldWitness x
SemimanifoldWitness
class Semimanifold x => PseudoAffine x where
(.-~.) :: x -> x -> Maybe (Needle x)
default (.-~.) :: ( Generic x, PseudoAffine (VRep x)
, Needle x ~ GenericNeedle x )
=> x -> x -> Maybe (Needle x)
x
p.-~.x
q = Needle (Rep x Void) -> GenericNeedle x
forall x. Needle (VRep x) -> GenericNeedle x
GenericNeedle (Needle (Rep x Void) -> GenericNeedle x)
-> Maybe (Needle (Rep x Void)) -> Maybe (GenericNeedle x)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> x -> Rep x Void
forall a x. Generic a => a -> Rep a x
Gnrx.from x
p Rep x Void -> Rep x Void -> Maybe (Needle (Rep x Void))
forall x. PseudoAffine x => x -> x -> Maybe (Needle x)
.-~. (x -> Rep x Void
forall a x. Generic a => a -> Rep a x
Gnrx.from x
q :: Gnrx.Rep x Void)
(.-~!) :: HasCallStack => x -> x -> Needle x
default (.-~!) :: ( Generic x, PseudoAffine (VRep x)
, Needle x ~ GenericNeedle x )
=> x -> x -> Needle x
x
p.-~!x
q = Needle (Rep x Void) -> GenericNeedle x
forall x. Needle (VRep x) -> GenericNeedle x
GenericNeedle (Needle (Rep x Void) -> GenericNeedle x)
-> Needle (Rep x Void) -> GenericNeedle x
forall a b. (a -> b) -> a -> b
$ x -> Rep x Void
forall a x. Generic a => a -> Rep a x
Gnrx.from x
p Rep x Void -> Rep x Void -> Needle (Rep x Void)
forall x. (PseudoAffine x, HasCallStack) => x -> x -> Needle x
.-~! (x -> Rep x Void
forall a x. Generic a => a -> Rep a x
Gnrx.from x
q :: Gnrx.Rep x Void)
{-# INLINE (.-~!) #-}
pseudoAffineWitness :: PseudoAffineWitness x
default pseudoAffineWitness ::
PseudoAffine (Needle x)
=> PseudoAffineWitness x
pseudoAffineWitness = SemimanifoldWitness x -> PseudoAffineWitness x
forall x.
PseudoAffine (Needle x) =>
SemimanifoldWitness x -> PseudoAffineWitness x
PseudoAffineWitness SemimanifoldWitness x
forall x. Semimanifold x => SemimanifoldWitness x
semimanifoldWitness
data FibreBundle b f = FibreBundle
{ FibreBundle b f -> b
baseSpace :: !b
, FibreBundle b f -> f
fibreSpace :: !f
} deriving ((forall x. FibreBundle b f -> Rep (FibreBundle b f) x)
-> (forall x. Rep (FibreBundle b f) x -> FibreBundle b f)
-> Generic (FibreBundle b f)
forall x. Rep (FibreBundle b f) x -> FibreBundle b f
forall x. FibreBundle b f -> Rep (FibreBundle b f) x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
forall b f x. Rep (FibreBundle b f) x -> FibreBundle b f
forall b f x. FibreBundle b f -> Rep (FibreBundle b f) x
$cto :: forall b f x. Rep (FibreBundle b f) x -> FibreBundle b f
$cfrom :: forall b f x. FibreBundle b f -> Rep (FibreBundle b f) x
Generic, Int -> FibreBundle b f -> ShowS
[FibreBundle b f] -> ShowS
FibreBundle b f -> String
(Int -> FibreBundle b f -> ShowS)
-> (FibreBundle b f -> String)
-> ([FibreBundle b f] -> ShowS)
-> Show (FibreBundle b f)
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
forall b f. (Show b, Show f) => Int -> FibreBundle b f -> ShowS
forall b f. (Show b, Show f) => [FibreBundle b f] -> ShowS
forall b f. (Show b, Show f) => FibreBundle b f -> String
showList :: [FibreBundle b f] -> ShowS
$cshowList :: forall b f. (Show b, Show f) => [FibreBundle b f] -> ShowS
show :: FibreBundle b f -> String
$cshow :: forall b f. (Show b, Show f) => FibreBundle b f -> String
showsPrec :: Int -> FibreBundle b f -> ShowS
$cshowsPrec :: forall b f. (Show b, Show f) => Int -> FibreBundle b f -> ShowS
Show)
type TangentBundle m = FibreBundle m (Needle m)
palerp :: ∀ x. (PseudoAffine x, VectorSpace (Needle x))
=> x -> x -> Maybe (Scalar (Needle x) -> x)
palerp :: x -> x -> Maybe (Scalar (Needle x) -> x)
palerp x
p₀ x
p₁ = case x
p₁x -> x -> Maybe (Needle x)
forall x. PseudoAffine x => x -> x -> Maybe (Needle x)
.-~.x
p₀ of
Just Needle x
v -> (Scalar (Needle x) -> x) -> Maybe (Scalar (Needle x) -> x)
forall (m :: * -> *) a. Monad m => a -> m a
return ((Scalar (Needle x) -> x) -> Maybe (Scalar (Needle x) -> x))
-> (Scalar (Needle x) -> x) -> Maybe (Scalar (Needle x) -> x)
forall a b. (a -> b) -> a -> b
$ \Scalar (Needle x)
t -> x
p₀ x -> Needle x -> x
forall x. Semimanifold x => x -> Needle x -> x
.+~^ Scalar (Needle x)
t Scalar (Needle x) -> Needle x -> Needle x
forall v. VectorSpace v => Scalar v -> v -> v
*^ Needle x
v
Maybe (Needle x)
_ -> Maybe (Scalar (Needle x) -> x)
forall a. Maybe a
Nothing
palerpB :: ∀ x. (PseudoAffine x, VectorSpace (Needle x), Scalar (Needle x) ~ ℝ)
=> x -> x -> Maybe (D¹ -> x)
palerpB :: x -> x -> Maybe (D¹ -> x)
palerpB x
p₀ x
p₁ = case x
p₁x -> x -> Maybe (Needle x)
forall x. PseudoAffine x => x -> x -> Maybe (Needle x)
.-~.x
p₀ of
Just Needle x
v -> (D¹ -> x) -> Maybe (D¹ -> x)
forall (m :: * -> *) a. Monad m => a -> m a
return ((D¹ -> x) -> Maybe (D¹ -> x)) -> (D¹ -> x) -> Maybe (D¹ -> x)
forall a b. (a -> b) -> a -> b
$ \(D¹ Double
t) -> x
p₀ x -> Needle x -> x
forall x. Semimanifold x => x -> Needle x -> x
.+~^ ((Double
tDouble -> Double -> Double
forall a. Num a => a -> a -> a
+Double
1)Double -> Double -> Double
forall a. Fractional a => a -> a -> a
/Double
2) Scalar (Needle x) -> Needle x -> Needle x
forall v. VectorSpace v => Scalar v -> v -> v
*^ Needle x
v
Maybe (Needle x)
_ -> Maybe (D¹ -> x)
forall a. Maybe a
Nothing
alerpB :: ∀ x. (AffineSpace x, VectorSpace (Diff x), Scalar (Diff x) ~ ℝ)
=> x -> x -> D¹ -> x
alerpB :: x -> x -> D¹ -> x
alerpB x
p1 x
p2 = case x
p2 x -> x -> Diff x
forall p. AffineSpace p => p -> p -> Diff p
.-. x
p1 of
Diff x
v -> \(D¹ Double
t) -> x
p1 x -> Diff x -> x
forall p. AffineSpace p => p -> Diff p -> p
.+^ ((Double
tDouble -> Double -> Double
forall a. Num a => a -> a -> a
+Double
1)Double -> Double -> Double
forall a. Fractional a => a -> a -> a
/Double
2) Scalar (Diff x) -> Diff x -> Diff x
forall v. VectorSpace v => Scalar v -> v -> v
*^ Diff x
v
#define deriveAffine(c,t) \
instance (c) => Semimanifold (t) where { \
type Needle (t) = Diff (t); \
(.+~^) = (.+^) }; \
instance (c) => PseudoAffine (t) where { \
a.-~.b = pure (a.-.b); \
(.-~!) = (.-.) }
deriveAffine((),Double)
deriveAffine((),Float)
deriveAffine((),Rational)
instance Semimanifold (ZeroDim k) where
type Needle (ZeroDim k) = ZeroDim k
ZeroDim k
Origin .+~^ :: ZeroDim k -> Needle (ZeroDim k) -> ZeroDim k
.+~^ Needle (ZeroDim k)
Origin = ZeroDim k
forall s. ZeroDim s
Origin
ZeroDim k
Origin .-~^ :: ZeroDim k -> Needle (ZeroDim k) -> ZeroDim k
.-~^ Needle (ZeroDim k)
Origin = ZeroDim k
forall s. ZeroDim s
Origin
instance PseudoAffine (ZeroDim k) where
ZeroDim k
Origin .-~! :: ZeroDim k -> ZeroDim k -> Needle (ZeroDim k)
.-~! ZeroDim k
Origin = Needle (ZeroDim k)
forall s. ZeroDim s
Origin
ZeroDim k
Origin .-~. :: ZeroDim k -> ZeroDim k -> Maybe (Needle (ZeroDim k))
.-~. ZeroDim k
Origin = ZeroDim k -> Maybe (ZeroDim k)
forall (f :: * -> *) a. Applicative f => a -> f a
pure ZeroDim k
forall s. ZeroDim s
Origin
instance ∀ a b . (Semimanifold a, Semimanifold b) => Semimanifold (a,b) where
type Needle (a,b) = (Needle a, Needle b)
(a
a,b
b).+~^ :: (a, b) -> Needle (a, b) -> (a, b)
.+~^(v,w) = (a
aa -> Needle a -> a
forall x. Semimanifold x => x -> Needle x -> x
.+~^Needle a
v, b
bb -> Needle b -> b
forall x. Semimanifold x => x -> Needle x -> x
.+~^Needle b
w)
(a
a,b
b).-~^ :: (a, b) -> Needle (a, b) -> (a, b)
.-~^(v,w) = (a
aa -> Needle a -> a
forall x. Semimanifold x => x -> Needle x -> x
.-~^Needle a
v, b
bb -> Needle b -> b
forall x. Semimanifold x => x -> Needle x -> x
.-~^Needle b
w)
semimanifoldWitness :: SemimanifoldWitness (a, b)
semimanifoldWitness = case ( SemimanifoldWitness a
forall x. Semimanifold x => SemimanifoldWitness x
semimanifoldWitness :: SemimanifoldWitness a
, SemimanifoldWitness b
forall x. Semimanifold x => SemimanifoldWitness x
semimanifoldWitness :: SemimanifoldWitness b ) of
(SemimanifoldWitness a
SemimanifoldWitness, SemimanifoldWitness b
SemimanifoldWitness) -> SemimanifoldWitness (a, b)
forall x.
(Semimanifold (Needle x), Needle (Needle x) ~ Needle x) =>
SemimanifoldWitness x
SemimanifoldWitness
instance (PseudoAffine a, PseudoAffine b) => PseudoAffine (a,b) where
(a
a,b
b).-~. :: (a, b) -> (a, b) -> Maybe (Needle (a, b))
.-~.(a
c,b
d) = (Needle a -> Needle b -> (Needle a, Needle b))
-> Maybe (Needle a)
-> Maybe (Needle b)
-> Maybe (Needle a, Needle b)
forall (f :: * -> *) a b c.
Applicative f =>
(a -> b -> c) -> f a -> f b -> f c
liftA2 (,) (a
aa -> a -> Maybe (Needle a)
forall x. PseudoAffine x => x -> x -> Maybe (Needle x)
.-~.a
c) (b
bb -> b -> Maybe (Needle b)
forall x. PseudoAffine x => x -> x -> Maybe (Needle x)
.-~.b
d)
(a
a,b
b).-~! :: (a, b) -> (a, b) -> Needle (a, b)
.-~!(a
c,b
d) = (a
aa -> a -> Needle a
forall x. (PseudoAffine x, HasCallStack) => x -> x -> Needle x
.-~!a
c, b
bb -> b -> Needle b
forall x. (PseudoAffine x, HasCallStack) => x -> x -> Needle x
.-~!b
d)
pseudoAffineWitness :: PseudoAffineWitness (a, b)
pseudoAffineWitness = case ( PseudoAffineWitness a
forall x. PseudoAffine x => PseudoAffineWitness x
pseudoAffineWitness :: PseudoAffineWitness a
, PseudoAffineWitness b
forall x. PseudoAffine x => PseudoAffineWitness x
pseudoAffineWitness :: PseudoAffineWitness b ) of
( PseudoAffineWitness (SemimanifoldWitness a
SemimanifoldWitness)
, PseudoAffineWitness (SemimanifoldWitness b
SemimanifoldWitness) )
->SemimanifoldWitness (a, b) -> PseudoAffineWitness (a, b)
forall x.
PseudoAffine (Needle x) =>
SemimanifoldWitness x -> PseudoAffineWitness x
PseudoAffineWitness (SemimanifoldWitness (a, b)
forall x.
(Semimanifold (Needle x), Needle (Needle x) ~ Needle x) =>
SemimanifoldWitness x
SemimanifoldWitness)
instance ∀ a b c . (Semimanifold a, Semimanifold b, Semimanifold c)
=> Semimanifold (a,b,c) where
type Needle (a,b,c) = (Needle a, Needle b, Needle c)
(a
a,b
b,c
c).+~^ :: (a, b, c) -> Needle (a, b, c) -> (a, b, c)
.+~^(v,w,x) = (a
aa -> Needle a -> a
forall x. Semimanifold x => x -> Needle x -> x
.+~^Needle a
v, b
bb -> Needle b -> b
forall x. Semimanifold x => x -> Needle x -> x
.+~^Needle b
w, c
cc -> Needle c -> c
forall x. Semimanifold x => x -> Needle x -> x
.+~^Needle c
x)
(a
a,b
b,c
c).-~^ :: (a, b, c) -> Needle (a, b, c) -> (a, b, c)
.-~^(v,w,x) = (a
aa -> Needle a -> a
forall x. Semimanifold x => x -> Needle x -> x
.-~^Needle a
v, b
bb -> Needle b -> b
forall x. Semimanifold x => x -> Needle x -> x
.-~^Needle b
w, c
cc -> Needle c -> c
forall x. Semimanifold x => x -> Needle x -> x
.-~^Needle c
x)
semimanifoldWitness :: SemimanifoldWitness (a, b, c)
semimanifoldWitness = case ( SemimanifoldWitness a
forall x. Semimanifold x => SemimanifoldWitness x
semimanifoldWitness :: SemimanifoldWitness a
, SemimanifoldWitness b
forall x. Semimanifold x => SemimanifoldWitness x
semimanifoldWitness :: SemimanifoldWitness b
, SemimanifoldWitness c
forall x. Semimanifold x => SemimanifoldWitness x
semimanifoldWitness :: SemimanifoldWitness c ) of
( SemimanifoldWitness a
SemimanifoldWitness, SemimanifoldWitness b
SemimanifoldWitness, SemimanifoldWitness c
SemimanifoldWitness )
-> SemimanifoldWitness (a, b, c)
forall x.
(Semimanifold (Needle x), Needle (Needle x) ~ Needle x) =>
SemimanifoldWitness x
SemimanifoldWitness
instance (PseudoAffine a, PseudoAffine b, PseudoAffine c) => PseudoAffine (a,b,c) where
(a
a,b
b,c
c).-~! :: (a, b, c) -> (a, b, c) -> Needle (a, b, c)
.-~!(a
d,b
e,c
f) = (a
aa -> a -> Needle a
forall x. (PseudoAffine x, HasCallStack) => x -> x -> Needle x
.-~!a
d, b
bb -> b -> Needle b
forall x. (PseudoAffine x, HasCallStack) => x -> x -> Needle x
.-~!b
e, c
cc -> c -> Needle c
forall x. (PseudoAffine x, HasCallStack) => x -> x -> Needle x
.-~!c
f)
(a
a,b
b,c
c).-~. :: (a, b, c) -> (a, b, c) -> Maybe (Needle (a, b, c))
.-~.(a
d,b
e,c
f) = (Needle a
-> Needle b -> Needle c -> (Needle a, Needle b, Needle c))
-> Maybe (Needle a)
-> Maybe (Needle b)
-> Maybe (Needle c)
-> Maybe (Needle a, Needle b, Needle c)
forall (f :: * -> *) a b c d.
Applicative f =>
(a -> b -> c -> d) -> f a -> f b -> f c -> f d
liftA3 (,,) (a
aa -> a -> Maybe (Needle a)
forall x. PseudoAffine x => x -> x -> Maybe (Needle x)
.-~.a
d) (b
bb -> b -> Maybe (Needle b)
forall x. PseudoAffine x => x -> x -> Maybe (Needle x)
.-~.b
e) (c
cc -> c -> Maybe (Needle c)
forall x. PseudoAffine x => x -> x -> Maybe (Needle x)
.-~.c
f)
pseudoAffineWitness :: PseudoAffineWitness (a, b, c)
pseudoAffineWitness = case ( PseudoAffineWitness a
forall x. PseudoAffine x => PseudoAffineWitness x
pseudoAffineWitness :: PseudoAffineWitness a
, PseudoAffineWitness b
forall x. PseudoAffine x => PseudoAffineWitness x
pseudoAffineWitness :: PseudoAffineWitness b
, PseudoAffineWitness c
forall x. PseudoAffine x => PseudoAffineWitness x
pseudoAffineWitness :: PseudoAffineWitness c ) of
( PseudoAffineWitness SemimanifoldWitness a
SemimanifoldWitness
, PseudoAffineWitness SemimanifoldWitness b
SemimanifoldWitness
, PseudoAffineWitness SemimanifoldWitness c
SemimanifoldWitness )
->SemimanifoldWitness (a, b, c) -> PseudoAffineWitness (a, b, c)
forall x.
PseudoAffine (Needle x) =>
SemimanifoldWitness x -> PseudoAffineWitness x
PseudoAffineWitness SemimanifoldWitness (a, b, c)
forall x.
(Semimanifold (Needle x), Needle (Needle x) ~ Needle x) =>
SemimanifoldWitness x
SemimanifoldWitness
instance Semimanifold (ℝP⁰_ r) where
type Needle (ℝP⁰_ r) = ZeroDim r
ℝP⁰_ r
p .+~^ :: ℝP⁰_ r -> Needle (ℝP⁰_ r) -> ℝP⁰_ r
.+~^ Needle (ℝP⁰_ r)
Origin = ℝP⁰_ r
p
ℝP⁰_ r
p .-~^ :: ℝP⁰_ r -> Needle (ℝP⁰_ r) -> ℝP⁰_ r
.-~^ Needle (ℝP⁰_ r)
Origin = ℝP⁰_ r
p
instance PseudoAffine (ℝP⁰_ r) where
ℝP⁰_ r
ℝPZero .-~! :: ℝP⁰_ r -> ℝP⁰_ r -> Needle (ℝP⁰_ r)
.-~! ℝP⁰_ r
ℝPZero = Needle (ℝP⁰_ r)
forall s. ZeroDim s
Origin
ℝP⁰_ r
ℝPZero .-~. :: ℝP⁰_ r -> ℝP⁰_ r -> Maybe (Needle (ℝP⁰_ r))
.-~. ℝP⁰_ r
ℝPZero = ZeroDim r -> Maybe (ZeroDim r)
forall (f :: * -> *) a. Applicative f => a -> f a
pure ZeroDim r
forall s. ZeroDim s
Origin
instance ℝeal r => Semimanifold (ℝP¹_ r) where
type Needle (ℝP¹_ r) = r
HemisphereℝP¹Polar r
r₀ .+~^ :: ℝP¹_ r -> Needle (ℝP¹_ r) -> ℝP¹_ r
.+~^ Needle (ℝP¹_ r)
δr = r -> ℝP¹_ r
forall r. r -> ℝP¹_ r
HemisphereℝP¹Polar (r -> ℝP¹_ r) -> (r -> r) -> r -> ℝP¹_ r
forall b c a. (b -> c) -> (a -> b) -> a -> c
. r -> r
forall r. RealFloat r => r -> r
toℝP¹range (r -> ℝP¹_ r) -> r -> ℝP¹_ r
forall a b. (a -> b) -> a -> b
$ r
r₀ r -> r -> r
forall a. Num a => a -> a -> a
+ r
Needle (ℝP¹_ r)
δr
instance ℝeal r => PseudoAffine (ℝP¹_ r) where
ℝP¹_ r
p.-~. :: ℝP¹_ r -> ℝP¹_ r -> Maybe (Needle (ℝP¹_ r))
.-~.ℝP¹_ r
q = r -> Maybe r
forall (f :: * -> *) a. Applicative f => a -> f a
pure (ℝP¹_ r
pℝP¹_ r -> ℝP¹_ r -> Needle (ℝP¹_ r)
forall x. (PseudoAffine x, HasCallStack) => x -> x -> Needle x
.-~!ℝP¹_ r
q)
HemisphereℝP¹Polar r
φ₁ .-~! :: ℝP¹_ r -> ℝP¹_ r -> Needle (ℝP¹_ r)
.-~! HemisphereℝP¹Polar r
φ₀
| r
δφ r -> r -> Bool
forall a. Ord a => a -> a -> Bool
> r
forall a. Floating a => a
pir -> r -> r
forall a. Fractional a => a -> a -> a
/r
2 = r
δφ r -> r -> r
forall a. Num a => a -> a -> a
- r
forall a. Floating a => a
pi
| r
δφ r -> r -> Bool
forall a. Ord a => a -> a -> Bool
< (-r
forall a. Floating a => a
pir -> r -> r
forall a. Fractional a => a -> a -> a
/r
2) = r
δφ r -> r -> r
forall a. Num a => a -> a -> a
+ r
forall a. Floating a => a
pi
| Bool
otherwise = r
Needle (ℝP¹_ r)
δφ
where δφ :: r
δφ = r
φ₁ r -> r -> r
forall a. Num a => a -> a -> a
- r
φ₀
tau :: RealFloat r => r
tau :: r
tau = r
2 r -> r -> r
forall a. Num a => a -> a -> a
* r
forall a. Floating a => a
pi
toS¹range :: RealFloat r => r -> r
toS¹range :: r -> r
toS¹range r
φ = (r
φr -> r -> r
forall a. Num a => a -> a -> a
+r
forall a. Floating a => a
pi)r -> r -> r
forall a. Real a => a -> a -> a
`mod'`r
forall r. RealFloat r => r
tau r -> r -> r
forall a. Num a => a -> a -> a
- r
forall a. Floating a => a
pi
toℝP¹range :: RealFloat r => r -> r
toℝP¹range :: r -> r
toℝP¹range r
φ = (r
φr -> r -> r
forall a. Num a => a -> a -> a
+r
forall a. Floating a => a
pir -> r -> r
forall a. Fractional a => a -> a -> a
/r
2)r -> r -> r
forall a. Real a => a -> a -> a
`mod'`r
forall a. Floating a => a
pi r -> r -> r
forall a. Num a => a -> a -> a
- r
forall a. Floating a => a
pir -> r -> r
forall a. Fractional a => a -> a -> a
/r
2
toUnitrange :: RealFloat r => r -> r
toUnitrange :: r -> r
toUnitrange r
φ = (r
φr -> r -> r
forall a. Num a => a -> a -> a
+r
1)r -> r -> r
forall a. Real a => a -> a -> a
`mod'`r
2 r -> r -> r
forall a. Num a => a -> a -> a
- r
1
data NeedleProductSpace f g p = NeedleProductSpace
!(Needle (f p)) !(Needle (g p)) deriving ((forall x.
NeedleProductSpace f g p -> Rep (NeedleProductSpace f g p) x)
-> (forall x.
Rep (NeedleProductSpace f g p) x -> NeedleProductSpace f g p)
-> Generic (NeedleProductSpace f g p)
forall x.
Rep (NeedleProductSpace f g p) x -> NeedleProductSpace f g p
forall x.
NeedleProductSpace f g p -> Rep (NeedleProductSpace f g p) x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
forall (f :: * -> *) (g :: * -> *) p x.
Rep (NeedleProductSpace f g p) x -> NeedleProductSpace f g p
forall (f :: * -> *) (g :: * -> *) p x.
NeedleProductSpace f g p -> Rep (NeedleProductSpace f g p) x
$cto :: forall (f :: * -> *) (g :: * -> *) p x.
Rep (NeedleProductSpace f g p) x -> NeedleProductSpace f g p
$cfrom :: forall (f :: * -> *) (g :: * -> *) p x.
NeedleProductSpace f g p -> Rep (NeedleProductSpace f g p) x
Generic)
instance (Semimanifold (f p), Semimanifold (g p))
=> AdditiveGroup (NeedleProductSpace f g p)
instance ( Semimanifold (f p), Semimanifold (g p)
, VectorSpace (Needle (f p)), VectorSpace (Needle (g p))
, Scalar (Needle (f p)) ~ Scalar (Needle (g p)) )
=> VectorSpace (NeedleProductSpace f g p)
instance ( Semimanifold (f p), Semimanifold (g p)
, InnerSpace (Needle (f p)), InnerSpace (Needle (g p))
, Scalar (Needle (f p)) ~ Scalar (Needle (g p))
, Num (Scalar (Needle (f p))) )
=> InnerSpace (NeedleProductSpace f g p)
instance (Semimanifold (f p), Semimanifold (g p))
=> AffineSpace (NeedleProductSpace f g p) where
type Diff (NeedleProductSpace f g p) = NeedleProductSpace f g p
.+^ :: NeedleProductSpace f g p
-> Diff (NeedleProductSpace f g p) -> NeedleProductSpace f g p
(.+^) = NeedleProductSpace f g p
-> Diff (NeedleProductSpace f g p) -> NeedleProductSpace f g p
forall v. AdditiveGroup v => v -> v -> v
(^+^)
.-. :: NeedleProductSpace f g p
-> NeedleProductSpace f g p -> Diff (NeedleProductSpace f g p)
(.-.) = NeedleProductSpace f g p
-> NeedleProductSpace f g p -> Diff (NeedleProductSpace f g p)
forall v. AdditiveGroup v => v -> v -> v
(^-^)
instance (Semimanifold (f p), Semimanifold (g p))
=> Semimanifold (NeedleProductSpace f g p) where
type Needle (NeedleProductSpace f g p) = NeedleProductSpace f g p
.+~^ :: NeedleProductSpace f g p
-> Needle (NeedleProductSpace f g p) -> NeedleProductSpace f g p
(.+~^) = NeedleProductSpace f g p
-> Needle (NeedleProductSpace f g p) -> NeedleProductSpace f g p
forall v. AdditiveGroup v => v -> v -> v
(^+^)
instance (PseudoAffine (f p), PseudoAffine (g p))
=> PseudoAffine (NeedleProductSpace f g p) where
NeedleProductSpace f g p
p.-~. :: NeedleProductSpace f g p
-> NeedleProductSpace f g p
-> Maybe (Needle (NeedleProductSpace f g p))
.-~.NeedleProductSpace f g p
q = NeedleProductSpace f g p -> Maybe (NeedleProductSpace f g p)
forall a. a -> Maybe a
Just (NeedleProductSpace f g p -> Maybe (NeedleProductSpace f g p))
-> NeedleProductSpace f g p -> Maybe (NeedleProductSpace f g p)
forall a b. (a -> b) -> a -> b
$ NeedleProductSpace f g p
pNeedleProductSpace f g p
-> NeedleProductSpace f g p -> Diff (NeedleProductSpace f g p)
forall p. AffineSpace p => p -> p -> Diff p
.-.NeedleProductSpace f g p
q
.-~! :: NeedleProductSpace f g p
-> NeedleProductSpace f g p -> Needle (NeedleProductSpace f g p)
(.-~!) = NeedleProductSpace f g p
-> NeedleProductSpace f g p -> Needle (NeedleProductSpace f g p)
forall p. AffineSpace p => p -> p -> Diff p
(.-.)
instance ( Semimanifold (f p), Semimanifold (g p)
, HasBasis (Needle (f p)), HasBasis (Needle (g p))
, Scalar (Needle (f p)) ~ Scalar (Needle (g p)) )
=> HasBasis (NeedleProductSpace f g p) where
type Basis (NeedleProductSpace f g p) = Either (Basis (Needle (f p)))
(Basis (Needle (g p)))
basisValue :: Basis (NeedleProductSpace f g p) -> NeedleProductSpace f g p
basisValue (Left bf) = Needle (f p) -> Needle (g p) -> NeedleProductSpace f g p
forall (f :: * -> *) (g :: * -> *) p.
Needle (f p) -> Needle (g p) -> NeedleProductSpace f g p
NeedleProductSpace (Basis (Needle (f p)) -> Needle (f p)
forall v. HasBasis v => Basis v -> v
basisValue Basis (Needle (f p))
bf) Needle (g p)
forall v. AdditiveGroup v => v
zeroV
basisValue (Right bg) = Needle (f p) -> Needle (g p) -> NeedleProductSpace f g p
forall (f :: * -> *) (g :: * -> *) p.
Needle (f p) -> Needle (g p) -> NeedleProductSpace f g p
NeedleProductSpace Needle (f p)
forall v. AdditiveGroup v => v
zeroV (Basis (Needle (g p)) -> Needle (g p)
forall v. HasBasis v => Basis v -> v
basisValue Basis (Needle (g p))
bg)
decompose :: NeedleProductSpace f g p
-> [(Basis (NeedleProductSpace f g p),
Scalar (NeedleProductSpace f g p))]
decompose (NeedleProductSpace Needle (f p)
vf Needle (g p)
vg)
= ((Basis (Needle (f p)), Scalar (Needle (g p)))
-> (Either (Basis (Needle (f p))) (Basis (Needle (g p))),
Scalar (Needle (g p))))
-> [(Basis (Needle (f p)), Scalar (Needle (g p)))]
-> [(Either (Basis (Needle (f p))) (Basis (Needle (g p))),
Scalar (Needle (g p)))]
forall a b. (a -> b) -> [a] -> [b]
map ((Basis (Needle (f p))
-> Either (Basis (Needle (f p))) (Basis (Needle (g p))))
-> (Basis (Needle (f p)), Scalar (Needle (g p)))
-> (Either (Basis (Needle (f p))) (Basis (Needle (g p))),
Scalar (Needle (g p)))
forall (a :: * -> * -> *) b c d.
Arrow a =>
a b c -> a (b, d) (c, d)
first Basis (Needle (f p))
-> Either (Basis (Needle (f p))) (Basis (Needle (g p)))
forall a b. a -> Either a b
Left) (Needle (f p) -> [(Basis (Needle (f p)), Scalar (Needle (f p)))]
forall v. HasBasis v => v -> [(Basis v, Scalar v)]
decompose Needle (f p)
vf) [(Either (Basis (Needle (f p))) (Basis (Needle (g p))),
Scalar (Needle (g p)))]
-> [(Either (Basis (Needle (f p))) (Basis (Needle (g p))),
Scalar (Needle (g p)))]
-> [(Either (Basis (Needle (f p))) (Basis (Needle (g p))),
Scalar (Needle (g p)))]
forall a. [a] -> [a] -> [a]
++ ((Basis (Needle (g p)), Scalar (Needle (g p)))
-> (Either (Basis (Needle (f p))) (Basis (Needle (g p))),
Scalar (Needle (g p))))
-> [(Basis (Needle (g p)), Scalar (Needle (g p)))]
-> [(Either (Basis (Needle (f p))) (Basis (Needle (g p))),
Scalar (Needle (g p)))]
forall a b. (a -> b) -> [a] -> [b]
map ((Basis (Needle (g p))
-> Either (Basis (Needle (f p))) (Basis (Needle (g p))))
-> (Basis (Needle (g p)), Scalar (Needle (g p)))
-> (Either (Basis (Needle (f p))) (Basis (Needle (g p))),
Scalar (Needle (g p)))
forall (a :: * -> * -> *) b c d.
Arrow a =>
a b c -> a (b, d) (c, d)
first Basis (Needle (g p))
-> Either (Basis (Needle (f p))) (Basis (Needle (g p)))
forall a b. b -> Either a b
Right) (Needle (g p) -> [(Basis (Needle (g p)), Scalar (Needle (g p)))]
forall v. HasBasis v => v -> [(Basis v, Scalar v)]
decompose Needle (g p)
vg)
decompose' :: NeedleProductSpace f g p
-> Basis (NeedleProductSpace f g p)
-> Scalar (NeedleProductSpace f g p)
decompose' (NeedleProductSpace Needle (f p)
vf Needle (g p)
_) (Left bf) = Needle (f p) -> Basis (Needle (f p)) -> Scalar (Needle (f p))
forall v. HasBasis v => v -> Basis v -> Scalar v
decompose' Needle (f p)
vf Basis (Needle (f p))
bf
decompose' (NeedleProductSpace Needle (f p)
_ Needle (g p)
vg) (Right bg) = Needle (g p) -> Basis (Needle (g p)) -> Scalar (Needle (g p))
forall v. HasBasis v => v -> Basis v -> Scalar v
decompose' Needle (g p)
vg Basis (Needle (g p))
bg
newtype GenericNeedle x = GenericNeedle {GenericNeedle x -> Needle (VRep x)
getGenericNeedle :: Needle (VRep x)}
deriving ((forall x. GenericNeedle x -> Rep (GenericNeedle x) x)
-> (forall x. Rep (GenericNeedle x) x -> GenericNeedle x)
-> Generic (GenericNeedle x)
forall x. Rep (GenericNeedle x) x -> GenericNeedle x
forall x. GenericNeedle x -> Rep (GenericNeedle x) x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
forall x x. Rep (GenericNeedle x) x -> GenericNeedle x
forall x x. GenericNeedle x -> Rep (GenericNeedle x) x
$cto :: forall x x. Rep (GenericNeedle x) x -> GenericNeedle x
$cfrom :: forall x x. GenericNeedle x -> Rep (GenericNeedle x) x
Generic)
instance AdditiveGroup (Needle (VRep x)) => AdditiveGroup (GenericNeedle x) where
GenericNeedle Needle (VRep x)
v ^+^ :: GenericNeedle x -> GenericNeedle x -> GenericNeedle x
^+^ GenericNeedle Needle (VRep x)
w = Needle (VRep x) -> GenericNeedle x
forall x. Needle (VRep x) -> GenericNeedle x
GenericNeedle (Needle (VRep x) -> GenericNeedle x)
-> Needle (VRep x) -> GenericNeedle x
forall a b. (a -> b) -> a -> b
$ Needle (VRep x)
v Needle (VRep x) -> Needle (VRep x) -> Needle (VRep x)
forall v. AdditiveGroup v => v -> v -> v
^+^ Needle (VRep x)
w
negateV :: GenericNeedle x -> GenericNeedle x
negateV = Needle (VRep x) -> GenericNeedle x
forall x. Needle (VRep x) -> GenericNeedle x
GenericNeedle (Needle (VRep x) -> GenericNeedle x)
-> (GenericNeedle x -> Needle (VRep x))
-> GenericNeedle x
-> GenericNeedle x
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Needle (VRep x) -> Needle (VRep x)
forall v. AdditiveGroup v => v -> v
negateV (Needle (VRep x) -> Needle (VRep x))
-> (GenericNeedle x -> Needle (VRep x))
-> GenericNeedle x
-> Needle (VRep x)
forall b c a. (b -> c) -> (a -> b) -> a -> c
. GenericNeedle x -> Needle (VRep x)
forall x. GenericNeedle x -> Needle (VRep x)
getGenericNeedle
zeroV :: GenericNeedle x
zeroV = Needle (VRep x) -> GenericNeedle x
forall x. Needle (VRep x) -> GenericNeedle x
GenericNeedle Needle (VRep x)
forall v. AdditiveGroup v => v
zeroV
instance VectorSpace (Needle (VRep x)) => VectorSpace (GenericNeedle x) where
type Scalar (GenericNeedle x) = Scalar (Needle (VRep x))
*^ :: Scalar (GenericNeedle x) -> GenericNeedle x -> GenericNeedle x
(*^) Scalar (GenericNeedle x)
μ = Needle (VRep x) -> GenericNeedle x
forall x. Needle (VRep x) -> GenericNeedle x
GenericNeedle (Needle (VRep x) -> GenericNeedle x)
-> (GenericNeedle x -> Needle (VRep x))
-> GenericNeedle x
-> GenericNeedle x
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Scalar (Needle (VRep x)) -> Needle (VRep x) -> Needle (VRep x)
forall v. VectorSpace v => Scalar v -> v -> v
(*^) Scalar (GenericNeedle x)
Scalar (Needle (VRep x))
μ (Needle (VRep x) -> Needle (VRep x))
-> (GenericNeedle x -> Needle (VRep x))
-> GenericNeedle x
-> Needle (VRep x)
forall b c a. (b -> c) -> (a -> b) -> a -> c
. GenericNeedle x -> Needle (VRep x)
forall x. GenericNeedle x -> Needle (VRep x)
getGenericNeedle
instance InnerSpace (Needle (VRep x)) => InnerSpace (GenericNeedle x) where
GenericNeedle Needle (VRep x)
v <.> :: GenericNeedle x -> GenericNeedle x -> Scalar (GenericNeedle x)
<.> GenericNeedle Needle (VRep x)
w = Needle (VRep x)
v Needle (VRep x) -> Needle (VRep x) -> Scalar (Needle (VRep x))
forall v. InnerSpace v => v -> v -> Scalar v
<.> Needle (VRep x)
w
instance AdditiveGroup (Needle (VRep x)) => AffineSpace (GenericNeedle x) where
type Diff (GenericNeedle x) = GenericNeedle x
.-. :: GenericNeedle x -> GenericNeedle x -> Diff (GenericNeedle x)
(.-.) = GenericNeedle x -> GenericNeedle x -> Diff (GenericNeedle x)
forall v. AdditiveGroup v => v -> v -> v
(^-^)
.+^ :: GenericNeedle x -> Diff (GenericNeedle x) -> GenericNeedle x
(.+^) = GenericNeedle x -> Diff (GenericNeedle x) -> GenericNeedle x
forall v. AdditiveGroup v => v -> v -> v
(^+^)
instance AdditiveGroup (Needle (VRep x)) => Semimanifold (GenericNeedle x) where
type Needle (GenericNeedle x) = GenericNeedle x
.+~^ :: GenericNeedle x -> Needle (GenericNeedle x) -> GenericNeedle x
(.+~^) = GenericNeedle x -> Needle (GenericNeedle x) -> GenericNeedle x
forall p. AffineSpace p => p -> Diff p -> p
(.+^)
instance AdditiveGroup (Needle (VRep x)) => PseudoAffine (GenericNeedle x) where
GenericNeedle Needle (VRep x)
v .-~. :: GenericNeedle x
-> GenericNeedle x -> Maybe (Needle (GenericNeedle x))
.-~. GenericNeedle Needle (VRep x)
w = GenericNeedle x -> Maybe (GenericNeedle x)
forall a. a -> Maybe a
Just (GenericNeedle x -> Maybe (GenericNeedle x))
-> GenericNeedle x -> Maybe (GenericNeedle x)
forall a b. (a -> b) -> a -> b
$ Needle (VRep x) -> GenericNeedle x
forall x. Needle (VRep x) -> GenericNeedle x
GenericNeedle (Needle (VRep x)
v Needle (VRep x) -> Needle (VRep x) -> Needle (VRep x)
forall v. AdditiveGroup v => v -> v -> v
^-^ Needle (VRep x)
w)
GenericNeedle Needle (VRep x)
v .-~! :: GenericNeedle x -> GenericNeedle x -> Needle (GenericNeedle x)
.-~! GenericNeedle Needle (VRep x)
w = Needle (VRep x) -> GenericNeedle x
forall x. Needle (VRep x) -> GenericNeedle x
GenericNeedle (Needle (VRep x)
v Needle (VRep x) -> Needle (VRep x) -> Needle (VRep x)
forall v. AdditiveGroup v => v -> v -> v
^-^ Needle (VRep x)
w)
instance ∀ a s . Semimanifold a => Semimanifold (Gnrx.Rec0 a s) where
type Needle (Gnrx.Rec0 a s) = Needle a
semimanifoldWitness :: SemimanifoldWitness (Rec0 a s)
semimanifoldWitness = case SemimanifoldWitness a
forall x. Semimanifold x => SemimanifoldWitness x
semimanifoldWitness :: SemimanifoldWitness a of
SemimanifoldWitness a
SemimanifoldWitness
-> SemimanifoldWitness (Rec0 a s)
forall x.
(Semimanifold (Needle x), Needle (Needle x) ~ Needle x) =>
SemimanifoldWitness x
SemimanifoldWitness
Gnrx.K1 a
p .+~^ :: Rec0 a s -> Needle (Rec0 a s) -> Rec0 a s
.+~^ Needle (Rec0 a s)
v = a -> Rec0 a s
forall k i c (p :: k). c -> K1 i c p
Gnrx.K1 (a -> Rec0 a s) -> a -> Rec0 a s
forall a b. (a -> b) -> a -> b
$ a
p a -> Needle a -> a
forall x. Semimanifold x => x -> Needle x -> x
.+~^ Needle a
Needle (Rec0 a s)
v
instance ∀ f p i c . Semimanifold (f p) => Semimanifold (Gnrx.M1 i c f p) where
type Needle (Gnrx.M1 i c f p) = Needle (f p)
semimanifoldWitness :: SemimanifoldWitness (M1 i c f p)
semimanifoldWitness = case SemimanifoldWitness (f p)
forall x. Semimanifold x => SemimanifoldWitness x
semimanifoldWitness :: SemimanifoldWitness (f p) of
SemimanifoldWitness (f p)
SemimanifoldWitness -> SemimanifoldWitness (M1 i c f p)
forall x.
(Semimanifold (Needle x), Needle (Needle x) ~ Needle x) =>
SemimanifoldWitness x
SemimanifoldWitness
Gnrx.M1 f p
p.+~^ :: M1 i c f p -> Needle (M1 i c f p) -> M1 i c f p
.+~^Needle (M1 i c f p)
v = f p -> M1 i c f p
forall k i (c :: Meta) (f :: k -> *) (p :: k). f p -> M1 i c f p
Gnrx.M1 (f p -> M1 i c f p) -> f p -> M1 i c f p
forall a b. (a -> b) -> a -> b
$ f p
pf p -> Needle (f p) -> f p
forall x. Semimanifold x => x -> Needle x -> x
.+~^Needle (f p)
Needle (M1 i c f p)
v
instance ∀ f g p . (Semimanifold (f p), Semimanifold (g p))
=> Semimanifold ((f :*: g) p) where
type Needle ((f:*:g) p) = NeedleProductSpace f g p
semimanifoldWitness :: SemimanifoldWitness ((:*:) f g p)
semimanifoldWitness = case ( SemimanifoldWitness (f p)
forall x. Semimanifold x => SemimanifoldWitness x
semimanifoldWitness :: SemimanifoldWitness (f p)
, SemimanifoldWitness (g p)
forall x. Semimanifold x => SemimanifoldWitness x
semimanifoldWitness :: SemimanifoldWitness (g p) ) of
( SemimanifoldWitness (f p)
SemimanifoldWitness, SemimanifoldWitness (g p)
SemimanifoldWitness )
-> SemimanifoldWitness ((:*:) f g p)
forall x.
(Semimanifold (Needle x), Needle (Needle x) ~ Needle x) =>
SemimanifoldWitness x
SemimanifoldWitness
(f p
p:*:g p
q).+~^ :: (:*:) f g p -> Needle ((:*:) f g p) -> (:*:) f g p
.+~^(NeedleProductSpace v w) = (f p
pf p -> Needle (f p) -> f p
forall x. Semimanifold x => x -> Needle x -> x
.+~^Needle (f p)
v) f p -> g p -> (:*:) f g p
forall k (f :: k -> *) (g :: k -> *) (p :: k).
f p -> g p -> (:*:) f g p
:*: (g p
qg p -> Needle (g p) -> g p
forall x. Semimanifold x => x -> Needle x -> x
.+~^Needle (g p)
w)
instance ∀ a s . PseudoAffine a => PseudoAffine (Gnrx.Rec0 a s) where
pseudoAffineWitness :: PseudoAffineWitness (Rec0 a s)
pseudoAffineWitness = case PseudoAffineWitness a
forall x. PseudoAffine x => PseudoAffineWitness x
pseudoAffineWitness :: PseudoAffineWitness a of
PseudoAffineWitness SemimanifoldWitness a
SemimanifoldWitness
-> SemimanifoldWitness (Rec0 a s) -> PseudoAffineWitness (Rec0 a s)
forall x.
PseudoAffine (Needle x) =>
SemimanifoldWitness x -> PseudoAffineWitness x
PseudoAffineWitness SemimanifoldWitness (Rec0 a s)
forall x.
(Semimanifold (Needle x), Needle (Needle x) ~ Needle x) =>
SemimanifoldWitness x
SemimanifoldWitness
Gnrx.K1 a
p .-~. :: Rec0 a s -> Rec0 a s -> Maybe (Needle (Rec0 a s))
.-~. Gnrx.K1 a
q = a
p a -> a -> Maybe (Needle a)
forall x. PseudoAffine x => x -> x -> Maybe (Needle x)
.-~. a
q
Gnrx.K1 a
p .-~! :: Rec0 a s -> Rec0 a s -> Needle (Rec0 a s)
.-~! Gnrx.K1 a
q = a
p a -> a -> Needle a
forall x. (PseudoAffine x, HasCallStack) => x -> x -> Needle x
.-~! a
q
instance ∀ f p i c . PseudoAffine (f p) => PseudoAffine (Gnrx.M1 i c f p) where
pseudoAffineWitness :: PseudoAffineWitness (M1 i c f p)
pseudoAffineWitness = case PseudoAffineWitness (f p)
forall x. PseudoAffine x => PseudoAffineWitness x
pseudoAffineWitness :: PseudoAffineWitness (f p) of
PseudoAffineWitness SemimanifoldWitness (f p)
SemimanifoldWitness
-> SemimanifoldWitness (M1 i c f p)
-> PseudoAffineWitness (M1 i c f p)
forall x.
PseudoAffine (Needle x) =>
SemimanifoldWitness x -> PseudoAffineWitness x
PseudoAffineWitness SemimanifoldWitness (M1 i c f p)
forall x.
(Semimanifold (Needle x), Needle (Needle x) ~ Needle x) =>
SemimanifoldWitness x
SemimanifoldWitness
Gnrx.M1 f p
p .-~. :: M1 i c f p -> M1 i c f p -> Maybe (Needle (M1 i c f p))
.-~. Gnrx.M1 f p
q = f p
p f p -> f p -> Maybe (Needle (f p))
forall x. PseudoAffine x => x -> x -> Maybe (Needle x)
.-~. f p
q
Gnrx.M1 f p
p .-~! :: M1 i c f p -> M1 i c f p -> Needle (M1 i c f p)
.-~! Gnrx.M1 f p
q = f p
p f p -> f p -> Needle (f p)
forall x. (PseudoAffine x, HasCallStack) => x -> x -> Needle x
.-~! f p
q
instance ∀ f g p . (PseudoAffine (f p), PseudoAffine (g p))
=> PseudoAffine ((f :*: g) p) where
pseudoAffineWitness :: PseudoAffineWitness ((:*:) f g p)
pseudoAffineWitness = case ( PseudoAffineWitness (f p)
forall x. PseudoAffine x => PseudoAffineWitness x
pseudoAffineWitness :: PseudoAffineWitness (f p)
, PseudoAffineWitness (g p)
forall x. PseudoAffine x => PseudoAffineWitness x
pseudoAffineWitness :: PseudoAffineWitness (g p) ) of
( PseudoAffineWitness SemimanifoldWitness (f p)
SemimanifoldWitness
,PseudoAffineWitness SemimanifoldWitness (g p)
SemimanifoldWitness )
-> SemimanifoldWitness ((:*:) f g p)
-> PseudoAffineWitness ((:*:) f g p)
forall x.
PseudoAffine (Needle x) =>
SemimanifoldWitness x -> PseudoAffineWitness x
PseudoAffineWitness SemimanifoldWitness ((:*:) f g p)
forall x.
(Semimanifold (Needle x), Needle (Needle x) ~ Needle x) =>
SemimanifoldWitness x
SemimanifoldWitness
(f p
pf:*:g p
pg) .-~. :: (:*:) f g p -> (:*:) f g p -> Maybe (Needle ((:*:) f g p))
.-~. (f p
qf:*:g p
qg) = Needle (f p) -> Needle (g p) -> NeedleProductSpace f g p
forall (f :: * -> *) (g :: * -> *) p.
Needle (f p) -> Needle (g p) -> NeedleProductSpace f g p
NeedleProductSpace (Needle (f p) -> Needle (g p) -> NeedleProductSpace f g p)
-> Maybe (Needle (f p))
-> Maybe (Needle (g p) -> NeedleProductSpace f g p)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> (f p
pff p -> f p -> Maybe (Needle (f p))
forall x. PseudoAffine x => x -> x -> Maybe (Needle x)
.-~.f p
qf) Maybe (Needle (g p) -> NeedleProductSpace f g p)
-> Maybe (Needle (g p)) -> Maybe (NeedleProductSpace f g p)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> (g p
pgg p -> g p -> Maybe (Needle (g p))
forall x. PseudoAffine x => x -> x -> Maybe (Needle x)
.-~.g p
qg)
(f p
pf:*:g p
pg) .-~! :: (:*:) f g p -> (:*:) f g p -> Needle ((:*:) f g p)
.-~! (f p
qf:*:g p
qg) = Needle (f p) -> Needle (g p) -> NeedleProductSpace f g p
forall (f :: * -> *) (g :: * -> *) p.
Needle (f p) -> Needle (g p) -> NeedleProductSpace f g p
NeedleProductSpace (f p
pff p -> f p -> Needle (f p)
forall x. (PseudoAffine x, HasCallStack) => x -> x -> Needle x
.-~!f p
qf) (g p
pgg p -> g p -> Needle (g p)
forall x. (PseudoAffine x, HasCallStack) => x -> x -> Needle x
.-~!g p
qg)
type VRep x = Gnrx.Rep x Void
data CD¹ x = CD¹ { CD¹ x -> Scalar (Needle x)
hParamCD¹ :: !(Scalar (Needle x))
, CD¹ x -> x
pParamCD¹ :: !x
} deriving ((forall x. CD¹ x -> Rep (CD¹ x) x)
-> (forall x. Rep (CD¹ x) x -> CD¹ x) -> Generic (CD¹ x)
forall x. Rep (CD¹ x) x -> CD¹ x
forall x. CD¹ x -> Rep (CD¹ x) x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
forall x x. Rep (CD¹ x) x -> CD¹ x
forall x x. CD¹ x -> Rep (CD¹ x) x
$cto :: forall x x. Rep (CD¹ x) x -> CD¹ x
$cfrom :: forall x x. CD¹ x -> Rep (CD¹ x) x
Generic)
deriving instance (Show x, Show (Scalar (Needle x))) => Show (CD¹ x)
data Cℝay x = Cℝay { Cℝay x -> Scalar (Needle x)
hParamCℝay :: !(Scalar (Needle x))
, Cℝay x -> x
pParamCℝay :: !x
} deriving ((forall x. Cℝay x -> Rep (Cℝay x) x)
-> (forall x. Rep (Cℝay x) x -> Cℝay x) -> Generic (Cℝay x)
forall x. Rep (Cℝay x) x -> Cℝay x
forall x. Cℝay x -> Rep (Cℝay x) x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
forall x x. Rep (Cℝay x) x -> Cℝay x
forall x x. Cℝay x -> Rep (Cℝay x) x
$cto :: forall x x. Rep (Cℝay x) x -> Cℝay x
$cfrom :: forall x x. Cℝay x -> Rep (Cℝay x) x
Generic)
deriving instance (Show x, Show (Scalar (Needle x))) => Show (Cℝay x)