{-# LANGUAGE DataKinds #-}
{-# LANGUAGE ScopedTypeVariables #-}
module Math.Tensor.Examples.Gravity.Schwarzschild (
schwarzschild,
schwarzschild',
christoffel,
ricci,
einstein
)
where
import Math.Tensor
import Numeric.AD.Internal.Forward (Forward(..))
schwarzschild :: Floating a => a -> STTens 0 2 (CFun [a] a)
schwarzschild :: a -> STTens 0 2 (CFun [a] a)
schwarzschild a
rs = [(IndTuple2 0 2 Ind3, CFun [a] a)] -> STTens 0 2 (CFun [a] a)
forall k1 v (n1 :: Nat) (n2 :: Nat).
(TIndex k1, TAdd v) =>
[(IndTuple2 n1 n2 k1, v)] -> AbsTensor2 n1 n2 k1 v
fromListT2
[
((IndList 0 Ind3
forall a. IndList 0 a
Empty, Int -> Ind3
Ind3 Int
0 Ind3 -> IndList (2 - 1) Ind3 -> IndList 2 Ind3
forall a (n :: Nat). a -> IndList (n - 1) a -> IndList n a
`Append` Ind3 -> IndList 1 Ind3
forall a. a -> IndList 1 a
singletonInd (Int -> Ind3
Ind3 Int
0)), ([a] -> a) -> CFun [a] a
forall a b. (a -> b) -> CFun a b
CFun (([a] -> a) -> CFun [a] a) -> ([a] -> a) -> CFun [a] a
forall a b. (a -> b) -> a -> b
$ \(a
_:a
r:[a]
_) -> a -> a
r' a
r ),
((IndList 0 Ind3
forall a. IndList 0 a
Empty, Int -> Ind3
Ind3 Int
1 Ind3 -> IndList (2 - 1) Ind3 -> IndList 2 Ind3
forall a (n :: Nat). a -> IndList (n - 1) a -> IndList n a
`Append` Ind3 -> IndList 1 Ind3
forall a. a -> IndList 1 a
singletonInd (Int -> Ind3
Ind3 Int
1)), ([a] -> a) -> CFun [a] a
forall a b. (a -> b) -> CFun a b
CFun (([a] -> a) -> CFun [a] a) -> ([a] -> a) -> CFun [a] a
forall a b. (a -> b) -> a -> b
$ \(a
_:a
r:[a]
_) -> -a
1a -> a -> a
forall a. Fractional a => a -> a -> a
/a -> a
r' a
r),
((IndList 0 Ind3
forall a. IndList 0 a
Empty, Int -> Ind3
Ind3 Int
2 Ind3 -> IndList (2 - 1) Ind3 -> IndList 2 Ind3
forall a (n :: Nat). a -> IndList (n - 1) a -> IndList n a
`Append` Ind3 -> IndList 1 Ind3
forall a. a -> IndList 1 a
singletonInd (Int -> Ind3
Ind3 Int
2)), ([a] -> a) -> CFun [a] a
forall a b. (a -> b) -> CFun a b
CFun (([a] -> a) -> CFun [a] a) -> ([a] -> a) -> CFun [a] a
forall a b. (a -> b) -> a -> b
$ \(a
_:a
r:[a]
_) -> -(a
ra -> a -> a
forall a. Floating a => a -> a -> a
**a
2)),
((IndList 0 Ind3
forall a. IndList 0 a
Empty, Int -> Ind3
Ind3 Int
3 Ind3 -> IndList (2 - 1) Ind3 -> IndList 2 Ind3
forall a (n :: Nat). a -> IndList (n - 1) a -> IndList n a
`Append` Ind3 -> IndList 1 Ind3
forall a. a -> IndList 1 a
singletonInd (Int -> Ind3
Ind3 Int
3)), ([a] -> a) -> CFun [a] a
forall a b. (a -> b) -> CFun a b
CFun (([a] -> a) -> CFun [a] a) -> ([a] -> a) -> CFun [a] a
forall a b. (a -> b) -> a -> b
$ \(a
_:a
r:a
theta:[a]
_) -> -(a
ra -> a -> a
forall a. Num a => a -> a -> a
*a -> a
forall a. Floating a => a -> a
sin a
theta)a -> a -> a
forall a. Floating a => a -> a -> a
**a
2)
]
where
r' :: a -> a
r' a
r = a
1 a -> a -> a
forall a. Num a => a -> a -> a
- a
rs a -> a -> a
forall a. Fractional a => a -> a -> a
/ a
r
schwarzschild' :: Floating a => a -> STTens 2 0 (CFun [a] a)
schwarzschild' :: a -> STTens 2 0 (CFun [a] a)
schwarzschild' a
rs = [(IndTuple2 2 0 Ind3, CFun [a] a)] -> STTens 2 0 (CFun [a] a)
forall k1 v (n1 :: Nat) (n2 :: Nat).
(TIndex k1, TAdd v) =>
[(IndTuple2 n1 n2 k1, v)] -> AbsTensor2 n1 n2 k1 v
fromListT2
[
((Int -> Ind3
Ind3 Int
0 Ind3 -> IndList (2 - 1) Ind3 -> IndList 2 Ind3
forall a (n :: Nat). a -> IndList (n - 1) a -> IndList n a
`Append` Ind3 -> IndList 1 Ind3
forall a. a -> IndList 1 a
singletonInd (Int -> Ind3
Ind3 Int
0), IndList 0 Ind3
forall a. IndList 0 a
Empty), ([a] -> a) -> CFun [a] a
forall a b. (a -> b) -> CFun a b
CFun (([a] -> a) -> CFun [a] a) -> ([a] -> a) -> CFun [a] a
forall a b. (a -> b) -> a -> b
$ \(a
_:a
r:[a]
_) -> a
1a -> a -> a
forall a. Fractional a => a -> a -> a
/a -> a
r' a
r),
((Int -> Ind3
Ind3 Int
1 Ind3 -> IndList (2 - 1) Ind3 -> IndList 2 Ind3
forall a (n :: Nat). a -> IndList (n - 1) a -> IndList n a
`Append` Ind3 -> IndList 1 Ind3
forall a. a -> IndList 1 a
singletonInd (Int -> Ind3
Ind3 Int
1), IndList 0 Ind3
forall a. IndList 0 a
Empty), ([a] -> a) -> CFun [a] a
forall a b. (a -> b) -> CFun a b
CFun (([a] -> a) -> CFun [a] a) -> ([a] -> a) -> CFun [a] a
forall a b. (a -> b) -> a -> b
$ \(a
_:a
r:[a]
_) -> - a -> a
r' a
r),
((Int -> Ind3
Ind3 Int
2 Ind3 -> IndList (2 - 1) Ind3 -> IndList 2 Ind3
forall a (n :: Nat). a -> IndList (n - 1) a -> IndList n a
`Append` Ind3 -> IndList 1 Ind3
forall a. a -> IndList 1 a
singletonInd (Int -> Ind3
Ind3 Int
2), IndList 0 Ind3
forall a. IndList 0 a
Empty), ([a] -> a) -> CFun [a] a
forall a b. (a -> b) -> CFun a b
CFun (([a] -> a) -> CFun [a] a) -> ([a] -> a) -> CFun [a] a
forall a b. (a -> b) -> a -> b
$ \(a
_:a
r:[a]
_) -> -a
1a -> a -> a
forall a. Fractional a => a -> a -> a
/(a
ra -> a -> a
forall a. Floating a => a -> a -> a
**a
2)),
((Int -> Ind3
Ind3 Int
3 Ind3 -> IndList (2 - 1) Ind3 -> IndList 2 Ind3
forall a (n :: Nat). a -> IndList (n - 1) a -> IndList n a
`Append` Ind3 -> IndList 1 Ind3
forall a. a -> IndList 1 a
singletonInd (Int -> Ind3
Ind3 Int
3), IndList 0 Ind3
forall a. IndList 0 a
Empty), ([a] -> a) -> CFun [a] a
forall a b. (a -> b) -> CFun a b
CFun (([a] -> a) -> CFun [a] a) -> ([a] -> a) -> CFun [a] a
forall a b. (a -> b) -> a -> b
$ \(a
_:a
r:a
theta:[a]
_) -> -a
1a -> a -> a
forall a. Fractional a => a -> a -> a
/(a
ra -> a -> a
forall a. Num a => a -> a -> a
*a -> a
forall a. Floating a => a -> a
sin a
theta)a -> a -> a
forall a. Floating a => a -> a -> a
**a
2)
]
where
r' :: a -> a
r' a
r = a
1 a -> a -> a
forall a. Num a => a -> a -> a
- a
rs a -> a -> a
forall a. Fractional a => a -> a -> a
/ a
r
half :: Fractional a => SField a
half :: SField a
half = a -> SField a
forall a. a -> SField a
SField (a -> SField a) -> a -> SField a
forall a b. (a -> b) -> a -> b
$ a
1a -> a -> a
forall a. Fractional a => a -> a -> a
/a
2
christoffel :: forall a.Floating a => a -> STTens 1 2 (CFun [a] a)
christoffel :: a -> STTens 1 2 (CFun [a] a)
christoffel a
rs = STTens 1 2 (CFun [a] a)
gamma
where
g :: STTens 0 2 (CFun [Forward a] (Forward a))
g = Forward a -> STTens 0 2 (CFun [Forward a] (Forward a))
forall a. Floating a => a -> STTens 0 2 (CFun [a] a)
schwarzschild (a -> Forward a
forall a. a -> Forward a
Lift a
rs)
g' :: STTens 2 0 (CFun [a] a)
g' = a -> STTens 2 0 (CFun [a] a)
forall a. Floating a => a -> STTens 2 0 (CFun [a] a)
schwarzschild' a
rs :: STTens 2 0 (CFun [a] a)
del_g :: STTens 0 3 (CFun [a] a)
del_g = STTens 0 2 (CFun [Forward a] (Forward a))
-> STTens 0 (2 + 1) (CFun [a] a)
forall a (n1 :: Nat) (n2 :: Nat).
Num a =>
STTens n1 n2 (CFun [Forward a] (Forward a))
-> STTens n1 (n2 + 1) (CFun [a] a)
partial STTens 0 2 (CFun [Forward a] (Forward a))
g :: STTens 0 3 (CFun [a] a)
g'_del_g :: TProd (STTens 2 0 (CFun [a] a)) (STTens 0 3 (CFun [a] a))
g'_del_g = STTens 2 0 (CFun [a] a)
g' STTens 2 0 (CFun [a] a)
-> STTens 0 3 (CFun [a] a)
-> TProd (STTens 2 0 (CFun [a] a)) (STTens 0 3 (CFun [a] a))
forall k v v' (n :: Nat) (m :: Nat).
(TIndex k, Prod v v') =>
Tensor n k v
-> Tensor m k v' -> TProd (Tensor n k v) (Tensor m k v')
&* STTens 0 3 (CFun [a] a)
del_g
t1 :: STTens 1 2 (CFun [a] a)
t1 = (Int, Int)
-> AbsTensor2 (1 + 1) (2 + 1) Ind3 (CFun [a] a)
-> STTens 1 2 (CFun [a] a)
forall k1 v (n1 :: Nat) (n2 :: Nat).
(TIndex k1, TAdd v) =>
(Int, Int)
-> AbsTensor2 (n1 + 1) (n2 + 1) k1 v -> AbsTensor2 n1 n2 k1 v
contrATens1 (Int
0, Int
0) Tensor 2 Ind3 (Tensor 3 Ind3 (CFun [a] a))
AbsTensor2 (1 + 1) (2 + 1) Ind3 (CFun [a] a)
g'_del_g
t2 :: STTens 1 2 (CFun [a] a)
t2 = (Int, Int)
-> AbsTensor2 (1 + 1) (2 + 1) Ind3 (CFun [a] a)
-> STTens 1 2 (CFun [a] a)
forall k1 v (n1 :: Nat) (n2 :: Nat).
(TIndex k1, TAdd v) =>
(Int, Int)
-> AbsTensor2 (n1 + 1) (n2 + 1) k1 v -> AbsTensor2 n1 n2 k1 v
contrATens1 (Int
0, Int
1) Tensor 2 Ind3 (Tensor 3 Ind3 (CFun [a] a))
AbsTensor2 (1 + 1) (2 + 1) Ind3 (CFun [a] a)
g'_del_g
t3 :: STTens 1 2 (CFun [a] a)
t3 = (Int, Int) -> STTens 1 2 (CFun [a] a) -> STTens 1 2 (CFun [a] a)
forall k1 v (n1 :: Nat) (n2 :: Nat).
(TIndex k1, TAdd v) =>
(Int, Int) -> AbsTensor2 n1 n2 k1 v -> AbsTensor2 n1 n2 k1 v
tensorTrans2 (Int
0, Int
1) STTens 1 2 (CFun [a] a)
t2
s :: STTens 1 2 (CFun [a] a)
s = STTens 1 2 (CFun [a] a)
t2 STTens 1 2 (CFun [a] a)
-> STTens 1 2 (CFun [a] a) -> STTens 1 2 (CFun [a] a)
forall k v (n :: Nat).
(TIndex k, TAdd v) =>
Tensor n k v -> Tensor n k v -> Tensor n k v
&+ (STTens 1 2 (CFun [a] a)
t3 STTens 1 2 (CFun [a] a)
-> STTens 1 2 (CFun [a] a) -> STTens 1 2 (CFun [a] a)
forall k v (n :: Nat).
(TIndex k, TAdd v) =>
Tensor n k v -> Tensor n k v -> Tensor n k v
&- STTens 1 2 (CFun [a] a)
t1)
h :: SField a
h = SField a
forall a. Fractional a => SField a
half :: SField a
gamma :: Tensor 1 Ind3 (TProd (SField a) (Tensor 2 Ind3 (CFun [a] a)))
gamma = SField a
h SField a
-> STTens 1 2 (CFun [a] a)
-> Tensor 1 Ind3 (TProd (SField a) (Tensor 2 Ind3 (CFun [a] a)))
forall k s v (n :: Nat).
(TIndex k, Prod s v) =>
s -> Tensor n k v -> Tensor n k (TProd s v)
&. STTens 1 2 (CFun [a] a)
s
ricci :: forall a.Floating a => a -> STTens 0 2 (CFun [a] a)
ricci :: a -> STTens 0 2 (CFun [a] a)
ricci a
rs = (STTens 0 2 (CFun [a] a)
term1 STTens 0 2 (CFun [a] a)
-> STTens 0 2 (CFun [a] a) -> STTens 0 2 (CFun [a] a)
forall k v (n :: Nat).
(TIndex k, TAdd v) =>
Tensor n k v -> Tensor n k v -> Tensor n k v
&- STTens 0 2 (CFun [a] a)
term2) STTens 0 2 (CFun [a] a)
-> STTens 0 2 (CFun [a] a) -> STTens 0 2 (CFun [a] a)
forall k v (n :: Nat).
(TIndex k, TAdd v) =>
Tensor n k v -> Tensor n k v -> Tensor n k v
&+ (STTens 0 2 (CFun [a] a)
term3 STTens 0 2 (CFun [a] a)
-> STTens 0 2 (CFun [a] a) -> STTens 0 2 (CFun [a] a)
forall k v (n :: Nat).
(TIndex k, TAdd v) =>
Tensor n k v -> Tensor n k v -> Tensor n k v
&- STTens 0 2 (CFun [a] a)
term4)
where
gamma1 :: STTens 1 2 (CFun [Forward a] (Forward a))
gamma1 = Forward a -> STTens 1 2 (CFun [Forward a] (Forward a))
forall a. Floating a => a -> STTens 1 2 (CFun [a] a)
christoffel (a -> Forward a
forall a. a -> Forward a
Lift a
rs)
gamma2 :: STTens 1 2 (CFun [a] a)
gamma2 = a -> STTens 1 2 (CFun [a] a)
forall a. Floating a => a -> STTens 1 2 (CFun [a] a)
christoffel a
rs
del_gamma :: STTens 1 3 (CFun [a] a)
del_gamma = STTens 1 2 (CFun [Forward a] (Forward a))
-> STTens 1 (2 + 1) (CFun [a] a)
forall a (n1 :: Nat) (n2 :: Nat).
Num a =>
STTens n1 n2 (CFun [Forward a] (Forward a))
-> STTens n1 (n2 + 1) (CFun [a] a)
partial STTens 1 2 (CFun [Forward a] (Forward a))
gamma1 :: STTens 1 3 (CFun [a] a)
gamma_gamma :: STTens 1 3 (CFun [a] a)
gamma_gamma = (Int, Int)
-> AbsTensor2 (1 + 1) (3 + 1) Ind3 (CFun [a] a)
-> STTens 1 3 (CFun [a] a)
forall k1 v (n1 :: Nat) (n2 :: Nat).
(TIndex k1, TAdd v) =>
(Int, Int)
-> AbsTensor2 (n1 + 1) (n2 + 1) k1 v -> AbsTensor2 n1 n2 k1 v
contrATens1 (Int
1,Int
1) (AbsTensor2 (1 + 1) (3 + 1) Ind3 (CFun [a] a)
-> STTens 1 3 (CFun [a] a))
-> AbsTensor2 (1 + 1) (3 + 1) Ind3 (CFun [a] a)
-> STTens 1 3 (CFun [a] a)
forall a b. (a -> b) -> a -> b
$ STTens 1 2 (CFun [a] a)
gamma2 STTens 1 2 (CFun [a] a)
-> STTens 1 2 (CFun [a] a)
-> TProd (STTens 1 2 (CFun [a] a)) (STTens 1 2 (CFun [a] a))
forall k v v' (n :: Nat) (m :: Nat).
(TIndex k, Prod v v') =>
Tensor n k v
-> Tensor m k v' -> TProd (Tensor n k v) (Tensor m k v')
&* STTens 1 2 (CFun [a] a)
gamma2 :: STTens 1 3 (CFun [a] a)
term1 :: STTens 0 2 (CFun [a] a)
term1 = (Int, Int)
-> AbsTensor2 (0 + 1) (2 + 1) Ind3 (CFun [a] a)
-> STTens 0 2 (CFun [a] a)
forall k1 v (n1 :: Nat) (n2 :: Nat).
(TIndex k1, TAdd v) =>
(Int, Int)
-> AbsTensor2 (n1 + 1) (n2 + 1) k1 v -> AbsTensor2 n1 n2 k1 v
contrATens1 (Int
0,Int
0) STTens 1 3 (CFun [a] a)
AbsTensor2 (0 + 1) (2 + 1) Ind3 (CFun [a] a)
del_gamma
term2 :: STTens 0 2 (CFun [a] a)
term2 = (Int, Int)
-> AbsTensor2 (0 + 1) (2 + 1) Ind3 (CFun [a] a)
-> STTens 0 2 (CFun [a] a)
forall k1 v (n1 :: Nat) (n2 :: Nat).
(TIndex k1, TAdd v) =>
(Int, Int)
-> AbsTensor2 (n1 + 1) (n2 + 1) k1 v -> AbsTensor2 n1 n2 k1 v
contrATens1 (Int
0,Int
1) STTens 1 3 (CFun [a] a)
AbsTensor2 (0 + 1) (2 + 1) Ind3 (CFun [a] a)
del_gamma
term3 :: STTens 0 2 (CFun [a] a)
term3 = (Int, Int)
-> AbsTensor2 (0 + 1) (2 + 1) Ind3 (CFun [a] a)
-> STTens 0 2 (CFun [a] a)
forall k1 v (n1 :: Nat) (n2 :: Nat).
(TIndex k1, TAdd v) =>
(Int, Int)
-> AbsTensor2 (n1 + 1) (n2 + 1) k1 v -> AbsTensor2 n1 n2 k1 v
contrATens1 (Int
0,Int
0) STTens 1 3 (CFun [a] a)
AbsTensor2 (0 + 1) (2 + 1) Ind3 (CFun [a] a)
gamma_gamma
term4 :: STTens 0 2 (CFun [a] a)
term4 = (Int, Int)
-> AbsTensor2 (0 + 1) (2 + 1) Ind3 (CFun [a] a)
-> STTens 0 2 (CFun [a] a)
forall k1 v (n1 :: Nat) (n2 :: Nat).
(TIndex k1, TAdd v) =>
(Int, Int)
-> AbsTensor2 (n1 + 1) (n2 + 1) k1 v -> AbsTensor2 n1 n2 k1 v
contrATens1 (Int
0,Int
1) STTens 1 3 (CFun [a] a)
AbsTensor2 (0 + 1) (2 + 1) Ind3 (CFun [a] a)
gamma_gamma
einstein :: forall a.Floating a => a -> STTens 0 2 (CFun [a] a)
einstein :: a -> STTens 0 2 (CFun [a] a)
einstein a
rs = STTens 0 2 (CFun [a] a)
r_ab STTens 0 2 (CFun [a] a)
-> STTens 0 2 (CFun [a] a) -> STTens 0 2 (CFun [a] a)
forall k v (n :: Nat).
(TIndex k, TAdd v) =>
Tensor n k v -> Tensor n k v -> Tensor n k v
&- (SField a
h SField a
-> Tensor 0 Ind3 (Tensor 0 Ind3 (CFun [a] a))
-> Tensor 0 Ind3 (TProd (SField a) (Tensor 0 Ind3 (CFun [a] a)))
forall k s v (n :: Nat).
(TIndex k, Prod s v) =>
s -> Tensor n k v -> Tensor n k (TProd s v)
&. Tensor 0 Ind3 (Tensor 0 Ind3 (CFun [a] a))
r Tensor 0 Ind3 (Tensor 0 Ind3 (CFun [a] a))
-> STTens 0 2 (CFun [a] a)
-> TProd
(Tensor 0 Ind3 (Tensor 0 Ind3 (CFun [a] a)))
(STTens 0 2 (CFun [a] a))
forall k v v' (n :: Nat) (m :: Nat).
(TIndex k, Prod v v') =>
Tensor n k v
-> Tensor m k v' -> TProd (Tensor n k v) (Tensor m k v')
&* STTens 0 2 (CFun [a] a)
g)
where
r_ab :: STTens 0 2 (CFun [a] a)
r_ab = a -> STTens 0 2 (CFun [a] a)
forall a. Floating a => a -> STTens 0 2 (CFun [a] a)
ricci a
rs :: STTens 0 2 (CFun [a] a)
g :: STTens 0 2 (CFun [a] a)
g = a -> STTens 0 2 (CFun [a] a)
forall a. Floating a => a -> STTens 0 2 (CFun [a] a)
schwarzschild a
rs :: STTens 0 2 (CFun [a] a)
g' :: STTens 2 0 (CFun [a] a)
g' = a -> STTens 2 0 (CFun [a] a)
forall a. Floating a => a -> STTens 2 0 (CFun [a] a)
schwarzschild' a
rs :: STTens 2 0 (CFun [a] a)
r :: Tensor 0 Ind3 (Tensor 0 Ind3 (CFun [a] a))
r = (Int, Int)
-> AbsTensor2 (0 + 1) (0 + 1) Ind3 (CFun [a] a)
-> Tensor 0 Ind3 (Tensor 0 Ind3 (CFun [a] a))
forall k1 v (n1 :: Nat) (n2 :: Nat).
(TIndex k1, TAdd v) =>
(Int, Int)
-> AbsTensor2 (n1 + 1) (n2 + 1) k1 v -> AbsTensor2 n1 n2 k1 v
contrATens1 (Int
0,Int
0) (AbsTensor2 (0 + 1) (0 + 1) Ind3 (CFun [a] a)
-> Tensor 0 Ind3 (Tensor 0 Ind3 (CFun [a] a)))
-> AbsTensor2 (0 + 1) (0 + 1) Ind3 (CFun [a] a)
-> Tensor 0 Ind3 (Tensor 0 Ind3 (CFun [a] a))
forall a b. (a -> b) -> a -> b
$ (Int, Int)
-> AbsTensor2 (1 + 1) (1 + 1) Ind3 (CFun [a] a)
-> AbsTensor2 1 1 Ind3 (CFun [a] a)
forall k1 v (n1 :: Nat) (n2 :: Nat).
(TIndex k1, TAdd v) =>
(Int, Int)
-> AbsTensor2 (n1 + 1) (n2 + 1) k1 v -> AbsTensor2 n1 n2 k1 v
contrATens1 (Int
1,Int
1) (AbsTensor2 (1 + 1) (1 + 1) Ind3 (CFun [a] a)
-> AbsTensor2 1 1 Ind3 (CFun [a] a))
-> AbsTensor2 (1 + 1) (1 + 1) Ind3 (CFun [a] a)
-> AbsTensor2 1 1 Ind3 (CFun [a] a)
forall a b. (a -> b) -> a -> b
$ STTens 2 0 (CFun [a] a)
g' STTens 2 0 (CFun [a] a)
-> STTens 0 2 (CFun [a] a)
-> TProd (STTens 2 0 (CFun [a] a)) (STTens 0 2 (CFun [a] a))
forall k v v' (n :: Nat) (m :: Nat).
(TIndex k, Prod v v') =>
Tensor n k v
-> Tensor m k v' -> TProd (Tensor n k v) (Tensor m k v')
&* STTens 0 2 (CFun [a] a)
r_ab
h :: SField a
h = SField a
forall a. Fractional a => SField a
half :: SField a