-----------------------------------------------------------------------------
-- |
-- Module      :  Math.Tensor.Examples.Gravity
-- Copyright   :  (c) 2019 Tobias Reinhart and Nils Alex
-- License     :  MIT
-- Maintainer  :  tobi.reinhart@fau.de, nils.alex@fau.de
--
--
-- This module provides a variety of @'Tensor'@s that are currently predefined in the sparse-tensor package.
--
-- Amongst many standard tensor from differential geometry and classical field theories such as Kronecker deltas \(\delta^a_b \) in multiple different dimensions,
-- the Levi-Civita symbol \(\epsilon^{abcd} \) and the Minkowski metric \(\eta_{ab}\) and its inverse \(\eta^{ab}\), most included tensors were implemented during
-- the initial use of the sparse-tensor package, the perturbative construction of generalized gravity theories. Thus many of the included tensors stem from this area of research.
--
-- Additionally to providing basic predefined @'Tensor'@s for further computations this module also nicely illustrates how the construction of @'Tensor'@s is achieved.
--
-- The majority of the tensors in this module are defined as type @'ATens'@ which describes a tensor that takes the three different index types
-- @'Ind20'@, @'Ind9'@, @'Ind3'@ each one appearing in contravariant and covariant position. If in the following expression that are formed from such tensors are additionally
-- explained via their algebraic expression using appropriate symbols for the individual tensors we label indices of type @'Ind20'@ by \(A,B,C,D,...\), indices of type
-- \(I,J,K,L,...\) and spacetime indices of type @'ind3'@ are labeled by \(a,b,c,d,...\). Hence a general such tensor is displayed as \(T^{A_1...A_m I_1...I_r a_1...a_p}_{B_1...B_n J_1...J_s b_1...b_s} \).
-- Such a tensor then has the type @'ATens' m n r s p q@.
-----------------------------------------------------------------------------
{-# LANGUAGE DataKinds #-}
{-# LANGUAGE GADTs #-}

module Math.Tensor.Examples.Gravity (
-- * Standard Tensors
-- ** Kronecker Delta
delta3, delta9, delta20,
delta3A,
-- ** Minkowski Metric
eta, invEta, etaA, invEtaA, etaAbs,
-- ** Levi-Civita Symbol
epsilon, epsilonInv, epsilonA, epsilonInvA,
-- ** Generators of the Lorentz Group
-- | The following six tensors are a choice of generators of the Lorentz group \( \mathrm{SO}(3,1)\), i.e. they constitute a basis of the
-- corresponding Lie algebra \( \mathrm{so}(3,1)\).
--
-- The Lie algebra \( \mathrm{so}(3,1)\) is isomorphic to the algebra of \(\eta_{ab}\) anti symmetric matrices.
-- Thus the following six tensors \( (K_i)^a_b \) for \( i = 1,...,6 \) all satisfy \( (K_i)^a_{b} \eta_{ca} = - (K_i)^a_{c} \eta_{ba}  \).
--
-- The six generators are obtained by \(2 (K_1)^a_b = \eta_{b0} \delta^ a_{1} - \eta_{b0} \delta^ a_{1} \), and similar for
-- the remaining @5@ independent components of the anti symmetric index pair.
lorentzJ1, lorentzJ2, lorentzJ3, lorentzK1, lorentzK2, lorentzK3,
-- ** Area Metric
flatArea,
-- * Constructive Gravity Specific Tensors
-- ** Intertwiners
-- | The following tensors are used to relate the abstract indices of type @'Ind9'@ to symmetric pairs of spacetime indices of type @'Ind3'@.
interI2, interJ2,
-- | The following tensors are used to relate the abstract indices of type @'Ind20'@ to blocks of @4@ spacetime indices \( (abcd)\) of type @'Ind3'@, that are anti symmetric in
-- \( a \leftrightarrow b \), anti symmetric in \( c \leftrightarrow d \) and further symmetric w.r.t. \( (ab) \leftrightarrow (cd) \).
interIArea, interJArea,
-- ** Infinitesimal Diffeomorphisms
-- | The following two tensors \(C^{Am}_{Bn} \) and \(K^{Im}_{Jn}\) encode the infinitesimal transformation behavior of tensors of type @'ATens' 0 0 0 1 0 0@  and tensors of type
-- @'ATens' 0 1 0 0 0 0@ respectively under spacetime diffeomorphisms. They are related to the Lie derivative via \(\mathscr{L}_{\xi}G_A = \partial_m G_A \cdot \xi^m + C^{Bm}_{An} G_B \cdot \partial_m \xi ^n \).
interArea, interMetric,
-- | __ Further such Tensors__
flatInterMetric, flatInter,
interEqn2, interEqn3, interEqn4, interEqn5,
interEqn2Metric, interEqn3Metric, interEqn4Metric, interEqn5Metric,
-- ** Random Tensor
-- | The following tensors are filled with random components. They can for instance be used to test ranks of tensorial equations.
randArea, randFlatArea, randAreaDerivative1, randAreaDerivative2, randMetric, randAxon,
-- * Unknown Tensors
-- The following tensors have all there individual components filled with different variables using the @'AnsVarR'@ type.
-- Thus they represent general tensors with unknown components.
generic4Ansatz, generic5Ansatz, generic6Ansatz,
generic8Ansatz, generic9Ansatz, generic10_1Ansatz, generic10_2Ansatz, generic11Ansatz, generic12_1Ansatz,
) where

import System.Random.TF.Instances (randomRs)
import System.Random.TF.Init (newTFGen)

import qualified Data.Map.Strict as M
import qualified Data.IntMap.Strict as I

import Data.List (permutations, nub, sort)

import Math.Tensor

liftSTtoATens :: STTens n1 n2 v -> ATens 0 0 0 0 n1 n2 v
liftSTtoATens :: STTens n1 n2 v -> ATens 0 0 0 0 n1 n2 v
liftSTtoATens = Tensor 0 Ind20 (Tensor 0 Ind9 (Tensor 0 Ind9 (STTens n1 n2 v)))
-> ATens 0 0 0 0 n1 n2 v
forall v k. v -> Tensor 0 k v
Scalar (Tensor 0 Ind20 (Tensor 0 Ind9 (Tensor 0 Ind9 (STTens n1 n2 v)))
 -> ATens 0 0 0 0 n1 n2 v)
-> (STTens n1 n2 v
    -> Tensor 0 Ind20 (Tensor 0 Ind9 (Tensor 0 Ind9 (STTens n1 n2 v))))
-> STTens n1 n2 v
-> ATens 0 0 0 0 n1 n2 v
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Tensor 0 Ind9 (Tensor 0 Ind9 (STTens n1 n2 v))
-> Tensor 0 Ind20 (Tensor 0 Ind9 (Tensor 0 Ind9 (STTens n1 n2 v)))
forall v k. v -> Tensor 0 k v
Scalar (Tensor 0 Ind9 (Tensor 0 Ind9 (STTens n1 n2 v))
 -> Tensor 0 Ind20 (Tensor 0 Ind9 (Tensor 0 Ind9 (STTens n1 n2 v))))
-> (STTens n1 n2 v
    -> Tensor 0 Ind9 (Tensor 0 Ind9 (STTens n1 n2 v)))
-> STTens n1 n2 v
-> Tensor 0 Ind20 (Tensor 0 Ind9 (Tensor 0 Ind9 (STTens n1 n2 v)))
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Tensor 0 Ind9 (STTens n1 n2 v)
-> Tensor 0 Ind9 (Tensor 0 Ind9 (STTens n1 n2 v))
forall v k. v -> Tensor 0 k v
Scalar (Tensor 0 Ind9 (STTens n1 n2 v)
 -> Tensor 0 Ind9 (Tensor 0 Ind9 (STTens n1 n2 v)))
-> (STTens n1 n2 v -> Tensor 0 Ind9 (STTens n1 n2 v))
-> STTens n1 n2 v
-> Tensor 0 Ind9 (Tensor 0 Ind9 (STTens n1 n2 v))
forall b c a. (b -> c) -> (a -> b) -> a -> c
. STTens n1 n2 v -> Tensor 0 Ind9 (STTens n1 n2 v)
forall v k. v -> Tensor 0 k v
Scalar

--start with deltas

-- | Standard spacetime Kronecker delta \(\delta^a_b\) as @'STTens' 1 1 ('SField' 'Rational')@.
--
-- > delta3 = fromListT2 $ zip [(singletonInd (Ind3 i),singletonInd (Ind3 i)) | i <- [0..3]] (repeat $ SField 1)
delta3 :: STTens 1 1 (SField Rational)
delta3 :: STTens 1 1 (SField Rational)
delta3 = [(IndTuple2 1 1 Ind3, SField Rational)]
-> STTens 1 1 (SField Rational)
forall k1 v (n1 :: Nat) (n2 :: Nat).
(TIndex k1, TAdd v) =>
[(IndTuple2 n1 n2 k1, v)] -> AbsTensor2 n1 n2 k1 v
fromListT2 ([(IndTuple2 1 1 Ind3, SField Rational)]
 -> STTens 1 1 (SField Rational))
-> [(IndTuple2 1 1 Ind3, SField Rational)]
-> STTens 1 1 (SField Rational)
forall a b. (a -> b) -> a -> b
$ [IndTuple2 1 1 Ind3]
-> [SField Rational] -> [(IndTuple2 1 1 Ind3, SField Rational)]
forall a b. [a] -> [b] -> [(a, b)]
zip [(Ind3 -> IndList 1 Ind3
forall a. a -> IndList 1 a
singletonInd (Int -> Ind3
Ind3 Int
i),Ind3 -> IndList 1 Ind3
forall a. a -> IndList 1 a
singletonInd (Int -> Ind3
Ind3 Int
i)) | Int
i <- [Int
0..Int
3]] (SField Rational -> [SField Rational]
forall a. a -> [a]
repeat (SField Rational -> [SField Rational])
-> SField Rational -> [SField Rational]
forall a b. (a -> b) -> a -> b
$ Rational -> SField Rational
forall a. a -> SField a
SField Rational
1)

-- | Spacetime Kronecker delta as @'ATens'@.
delta3A :: ATens 0 0 0 0 1 1 (SField Rational)
delta3A :: ATens 0 0 0 0 1 1 (SField Rational)
delta3A = STTens 1 1 (SField Rational) -> ATens 0 0 0 0 1 1 (SField Rational)
forall (n1 :: Nat) (n2 :: Nat) v.
STTens n1 n2 v -> ATens 0 0 0 0 n1 n2 v
liftSTtoATens STTens 1 1 (SField Rational)
delta3

-- | Standard Kronecker delta for the @'Ind9'@ index type \(\delta^I_J\) as @'ATens' 0 0 1 1 0 0 ('SField' 'Rational')@.
--
-- > delta9 = fromListT6 $ zip [(Empty, Empty, singletonInd (Ind9 i),singletonInd (Ind9 i), Empty, Empty) | i <- [0..9]] (repeat $ SField 1)
delta9 :: ATens 0 0 1 1 0 0 (SField Rational)
delta9 :: ATens 0 0 1 1 0 0 (SField Rational)
delta9 = [(IndTuple6 0 0 1 1 0 0 Ind20 Ind9 Ind3, SField Rational)]
-> ATens 0 0 1 1 0 0 (SField Rational)
forall k1 k2 k3 v (n1 :: Nat) (n2 :: Nat) (n3 :: Nat) (n4 :: Nat)
       (n5 :: Nat) (n6 :: Nat).
(TIndex k1, TIndex k2, TIndex k3, TAdd v) =>
[(IndTuple6 n1 n2 n3 n4 n5 n6 k1 k2 k3, v)]
-> AbsTensor6 n1 n2 n3 n4 n5 n6 k1 k2 k3 v
fromListT6 ([(IndTuple6 0 0 1 1 0 0 Ind20 Ind9 Ind3, SField Rational)]
 -> ATens 0 0 1 1 0 0 (SField Rational))
-> [(IndTuple6 0 0 1 1 0 0 Ind20 Ind9 Ind3, SField Rational)]
-> ATens 0 0 1 1 0 0 (SField Rational)
forall a b. (a -> b) -> a -> b
$ [IndTuple6 0 0 1 1 0 0 Ind20 Ind9 Ind3]
-> [SField Rational]
-> [(IndTuple6 0 0 1 1 0 0 Ind20 Ind9 Ind3, SField Rational)]
forall a b. [a] -> [b] -> [(a, b)]
zip [(IndList 0 Ind20
forall a. IndList 0 a
Empty, IndList 0 Ind20
forall a. IndList 0 a
Empty, Ind9 -> IndList 1 Ind9
forall a. a -> IndList 1 a
singletonInd (Int -> Ind9
Ind9 Int
i),Ind9 -> IndList 1 Ind9
forall a. a -> IndList 1 a
singletonInd (Int -> Ind9
Ind9 Int
i), IndList 0 Ind3
forall a. IndList 0 a
Empty, IndList 0 Ind3
forall a. IndList 0 a
Empty) | Int
i <- [Int
0..Int
9]] (SField Rational -> [SField Rational]
forall a. a -> [a]
repeat (SField Rational -> [SField Rational])
-> SField Rational -> [SField Rational]
forall a b. (a -> b) -> a -> b
$ Rational -> SField Rational
forall a. a -> SField a
SField Rational
1)

-- | Standard Kronecker delta for the @'Ind20'@ index type \(\delta^A_B\) as @'ATens' 1 1 0 0 0 0 ('SField' 'Rational')@.
--
-- > delta20 = fromListT6 $ zip [(singletonInd (Ind20 i),singletonInd (Ind20 i), Empty, Empty, Empty, Empty) | i <- [0..20]] (repeat $ SField 1)
delta20 :: ATens 1 1 0 0 0 0 (SField Rational)
delta20 :: ATens 1 1 0 0 0 0 (SField Rational)
delta20 = [(IndTuple6 1 1 0 0 0 0 Ind20 Ind9 Ind3, SField Rational)]
-> ATens 1 1 0 0 0 0 (SField Rational)
forall k1 k2 k3 v (n1 :: Nat) (n2 :: Nat) (n3 :: Nat) (n4 :: Nat)
       (n5 :: Nat) (n6 :: Nat).
(TIndex k1, TIndex k2, TIndex k3, TAdd v) =>
[(IndTuple6 n1 n2 n3 n4 n5 n6 k1 k2 k3, v)]
-> AbsTensor6 n1 n2 n3 n4 n5 n6 k1 k2 k3 v
fromListT6 ([(IndTuple6 1 1 0 0 0 0 Ind20 Ind9 Ind3, SField Rational)]
 -> ATens 1 1 0 0 0 0 (SField Rational))
-> [(IndTuple6 1 1 0 0 0 0 Ind20 Ind9 Ind3, SField Rational)]
-> ATens 1 1 0 0 0 0 (SField Rational)
forall a b. (a -> b) -> a -> b
$ [IndTuple6 1 1 0 0 0 0 Ind20 Ind9 Ind3]
-> [SField Rational]
-> [(IndTuple6 1 1 0 0 0 0 Ind20 Ind9 Ind3, SField Rational)]
forall a b. [a] -> [b] -> [(a, b)]
zip [(Ind20 -> IndList 1 Ind20
forall a. a -> IndList 1 a
singletonInd (Int -> Ind20
Ind20 Int
i),Ind20 -> IndList 1 Ind20
forall a. a -> IndList 1 a
singletonInd (Int -> Ind20
Ind20 Int
i), IndList 0 Ind9
forall a. IndList 0 a
Empty, IndList 0 Ind9
forall a. IndList 0 a
Empty, IndList 0 Ind3
forall a. IndList 0 a
Empty, IndList 0 Ind3
forall a. IndList 0 a
Empty) | Int
i <- [Int
0..Int
20]] (SField Rational -> [SField Rational]
forall a. a -> [a]
repeat (SField Rational -> [SField Rational])
-> SField Rational -> [SField Rational]
forall a b. (a -> b) -> a -> b
$ Rational -> SField Rational
forall a. a -> SField a
SField Rational
1)

-- | Spacetime Minkowski metric \(\eta_{ab}\) as @'ATens' 0 0 0 0 0 2 ('SField' 'Rational')@. The Minkowski metric could
-- also be defined as @'STTens' 0 2 ('SField' 'Rational')@ in similar fashion.
--
-- > eta =  fromListT2 map (\(x,y,z) -> ((Empty,Append (Ind3 x) $ Append (Ind3 y) Empty),SField z)) [(0,0,-1),(1,1,1),(2,2,1),(3,3,1)]
eta :: STTens 0 2 (SField Rational)
eta :: STTens 0 2 (SField Rational)
eta =  [(IndTuple2 0 2 Ind3, SField Rational)]
-> STTens 0 2 (SField Rational)
forall k1 v (n1 :: Nat) (n2 :: Nat).
(TIndex k1, TAdd v) =>
[(IndTuple2 n1 n2 k1, v)] -> AbsTensor2 n1 n2 k1 v
fromListT2 [(IndTuple2 0 2 Ind3, SField Rational)]
forall a. [((IndList 0 a, IndList 2 Ind3), SField Rational)]
l
            where
                l :: [((IndList 0 a, IndList 2 Ind3), SField Rational)]
l = ((Int, Int, Rational)
 -> ((IndList 0 a, IndList 2 Ind3), SField Rational))
-> [(Int, Int, Rational)]
-> [((IndList 0 a, IndList 2 Ind3), SField Rational)]
forall a b. (a -> b) -> [a] -> [b]
map (\(Int
x,Int
y,Rational
z) -> ((IndList 0 a
forall a. IndList 0 a
Empty,Ind3 -> IndList (2 - 1) Ind3 -> IndList 2 Ind3
forall a (n :: Nat). a -> IndList (n - 1) a -> IndList n a
Append (Int -> Ind3
Ind3 Int
x) (IndList (2 - 1) Ind3 -> IndList 2 Ind3)
-> IndList (2 - 1) Ind3 -> IndList 2 Ind3
forall a b. (a -> b) -> a -> b
$ Ind3 -> IndList (1 - 1) Ind3 -> IndList 1 Ind3
forall a (n :: Nat). a -> IndList (n - 1) a -> IndList n a
Append (Int -> Ind3
Ind3 Int
y) IndList (1 - 1) Ind3
forall a. IndList 0 a
Empty),Rational -> SField Rational
forall a. a -> SField a
SField Rational
z))
                    [(Int
0,Int
0,-Rational
1),(Int
1,Int
1,Rational
1),(Int
2,Int
2,Rational
1),(Int
3,Int
3,Rational
1)]

-- | Minkowski metric lifted to @'ATens'@.
etaA :: ATens 0 0 0 0 0 2 (SField Rational)
etaA :: ATens 0 0 0 0 0 2 (SField Rational)
etaA = STTens 0 2 (SField Rational) -> ATens 0 0 0 0 0 2 (SField Rational)
forall (n1 :: Nat) (n2 :: Nat) v.
STTens n1 n2 v -> ATens 0 0 0 0 n1 n2 v
liftSTtoATens STTens 0 2 (SField Rational)
eta

-- | Inverse spacetime Minkowski metric \(\eta^{ab}\) as @'ATens' 0 0 0 0 2 0 ('SField' 'Rational')@. The inverse Minkowski metric could
-- also be defined as @'STTens' 2 0 ('SField' 'Rational')@ in similar fashion.
--
-- > invEta = fromListT2 $ map (\(x,y,z) -> ((Append (Ind3 x) $ Append (Ind3 y) Empty,Empty),SField z)) [(0,0,-1),(1,1,1),(2,2,1),(3,3,1)]
invEta :: STTens 2 0 (SField Rational)
invEta :: STTens 2 0 (SField Rational)
invEta =  [(IndTuple2 2 0 Ind3, SField Rational)]
-> STTens 2 0 (SField Rational)
forall k1 v (n1 :: Nat) (n2 :: Nat).
(TIndex k1, TAdd v) =>
[(IndTuple2 n1 n2 k1, v)] -> AbsTensor2 n1 n2 k1 v
fromListT2 [(IndTuple2 2 0 Ind3, SField Rational)]
forall a. [((IndList 2 Ind3, IndList 0 a), SField Rational)]
l
            where
                l :: [((IndList 2 Ind3, IndList 0 a), SField Rational)]
l = ((Int, Int, Rational)
 -> ((IndList 2 Ind3, IndList 0 a), SField Rational))
-> [(Int, Int, Rational)]
-> [((IndList 2 Ind3, IndList 0 a), SField Rational)]
forall a b. (a -> b) -> [a] -> [b]
map (\(Int
x,Int
y,Rational
z) -> ((Ind3 -> IndList (2 - 1) Ind3 -> IndList 2 Ind3
forall a (n :: Nat). a -> IndList (n - 1) a -> IndList n a
Append (Int -> Ind3
Ind3 Int
x) (IndList (2 - 1) Ind3 -> IndList 2 Ind3)
-> IndList (2 - 1) Ind3 -> IndList 2 Ind3
forall a b. (a -> b) -> a -> b
$ Ind3 -> IndList (1 - 1) Ind3 -> IndList 1 Ind3
forall a (n :: Nat). a -> IndList (n - 1) a -> IndList n a
Append (Int -> Ind3
Ind3 Int
y) IndList (1 - 1) Ind3
forall a. IndList 0 a
Empty,IndList 0 a
forall a. IndList 0 a
Empty),Rational -> SField Rational
forall a. a -> SField a
SField Rational
z))
                    [(Int
0,Int
0,-Rational
1),(Int
1,Int
1,Rational
1),(Int
2,Int
2,Rational
1),(Int
3,Int
3,Rational
1)]

-- | Inverse Minkowski metric lifted to @'ATens'@.
invEtaA :: ATens 0 0 0 0 2 0 (SField Rational)
invEtaA :: ATens 0 0 0 0 2 0 (SField Rational)
invEtaA = STTens 2 0 (SField Rational) -> ATens 0 0 0 0 2 0 (SField Rational)
forall (n1 :: Nat) (n2 :: Nat) v.
STTens n1 n2 v -> ATens 0 0 0 0 n1 n2 v
liftSTtoATens STTens 2 0 (SField Rational)
invEta

-- | The tensor \(\eta_I\) provides an equivalent version of the Minkowski metric that uses an index of type @'Ind9'@ to label the @10@ different values of the symmetric spacetime index pair.
etaAbs :: ATens 0 0 0 1 0 0 (SField Rational)
etaAbs :: ATens 0 0 0 1 0 0 (SField Rational)
etaAbs = [(IndTuple6 0 0 0 1 0 0 Ind20 Ind9 Ind3, SField Rational)]
-> ATens 0 0 0 1 0 0 (SField Rational)
forall k1 k2 k3 v (n1 :: Nat) (n2 :: Nat) (n3 :: Nat) (n4 :: Nat)
       (n5 :: Nat) (n6 :: Nat).
(TIndex k1, TIndex k2, TIndex k3, TAdd v) =>
[(IndTuple6 n1 n2 n3 n4 n5 n6 k1 k2 k3, v)]
-> AbsTensor6 n1 n2 n3 n4 n5 n6 k1 k2 k3 v
fromListT6 [(IndTuple6 0 0 0 1 0 0 Ind20 Ind9 Ind3, SField Rational)]
forall a a a a a.
[((IndList 0 a, IndList 0 a, IndList 0 a, IndList 1 Ind9,
   IndList 0 a, IndList 0 a),
  SField Rational)]
l
            where
                l :: [((IndList 0 a, IndList 0 a, IndList 0 a, IndList 1 Ind9,
   IndList 0 a, IndList 0 a),
  SField Rational)]
l = ((Int, Rational)
 -> ((IndList 0 a, IndList 0 a, IndList 0 a, IndList 1 Ind9,
      IndList 0 a, IndList 0 a),
     SField Rational))
-> [(Int, Rational)]
-> [((IndList 0 a, IndList 0 a, IndList 0 a, IndList 1 Ind9,
      IndList 0 a, IndList 0 a),
     SField Rational)]
forall a b. (a -> b) -> [a] -> [b]
map (\(Int
x,Rational
y) -> ((IndList 0 a
forall a. IndList 0 a
Empty, IndList 0 a
forall a. IndList 0 a
Empty, IndList 0 a
forall a. IndList 0 a
Empty, Ind9 -> IndList 1 Ind9
forall a. a -> IndList 1 a
singletonInd (Ind9 -> IndList 1 Ind9) -> Ind9 -> IndList 1 Ind9
forall a b. (a -> b) -> a -> b
$ Int -> Ind9
Ind9 Int
x, IndList 0 a
forall a. IndList 0 a
Empty, IndList 0 a
forall a. IndList 0 a
Empty),Rational -> SField Rational
forall a. a -> SField a
SField Rational
y))
                    [(Int
0,-Rational
1),(Int
4,Rational
1),(Int
7,Rational
1),(Int
9,Rational
1)]

-- | Covariant spacetime Levi-Civita symbol \(\epsilon_{abcd}\) as type @'ATTens' 0 4 ('SField' 'Rational')@.
epsilon :: STTens 0 4 (SField Rational)
epsilon :: STTens 0 4 (SField Rational)
epsilon = [(IndTuple2 0 4 Ind3, SField Rational)]
-> STTens 0 4 (SField Rational)
forall k1 v (n1 :: Nat) (n2 :: Nat).
(TIndex k1, TAdd v) =>
[(IndTuple2 n1 n2 k1, v)] -> AbsTensor2 n1 n2 k1 v
fromListT2 [(IndTuple2 0 4 Ind3, SField Rational)]
ls
                where
                   ls :: [(IndTuple2 0 4 Ind3, SField Rational)]
ls = (([Int], Rational) -> (IndTuple2 0 4 Ind3, SField Rational))
-> [([Int], Rational)] -> [(IndTuple2 0 4 Ind3, SField Rational)]
forall a b. (a -> b) -> [a] -> [b]
map (\([Int
i,Int
j,Int
k,Int
l],Rational
v) -> ((IndList 0 Ind3
forall a. IndList 0 a
Empty, Ind3 -> IndList (4 - 1) Ind3 -> IndList 4 Ind3
forall a (n :: Nat). a -> IndList (n - 1) a -> IndList n a
Append (Int -> Ind3
Ind3 Int
i) (IndList (4 - 1) Ind3 -> IndList 4 Ind3)
-> IndList (4 - 1) Ind3 -> IndList 4 Ind3
forall a b. (a -> b) -> a -> b
$ Ind3 -> IndList (3 - 1) Ind3 -> IndList 3 Ind3
forall a (n :: Nat). a -> IndList (n - 1) a -> IndList n a
Append (Int -> Ind3
Ind3 Int
j) (IndList (3 - 1) Ind3 -> IndList 3 Ind3)
-> IndList (3 - 1) Ind3 -> IndList 3 Ind3
forall a b. (a -> b) -> a -> b
$ Ind3 -> IndList (2 - 1) Ind3 -> IndList 2 Ind3
forall a (n :: Nat). a -> IndList (n - 1) a -> IndList n a
Append (Int -> Ind3
Ind3 Int
k) (IndList (2 - 1) Ind3 -> IndList 2 Ind3)
-> IndList (2 - 1) Ind3 -> IndList 2 Ind3
forall a b. (a -> b) -> a -> b
$ Ind3 -> IndList 1 Ind3
forall a. a -> IndList 1 a
singletonInd (Int -> Ind3
Ind3 Int
l)),Rational -> SField Rational
forall a. a -> SField a
SField Rational
v)) [([Int], Rational)]
epsL
                   epsSign :: a -> a -> a -> a -> a
epsSign a
i a
j a
k a
l = (-a
1) a -> Int -> a
forall a b. (Num a, Integral b) => a -> b -> a
^ [Bool] -> Int
forall (t :: * -> *) a. Foldable t => t a -> Int
length ((Bool -> Bool) -> [Bool] -> [Bool]
forall a. (a -> Bool) -> [a] -> [a]
filter (Bool -> Bool -> Bool
forall a. Eq a => a -> a -> Bool
==Bool
True) [a
ja -> a -> Bool
forall a. Ord a => a -> a -> Bool
>a
i,a
ka -> a -> Bool
forall a. Ord a => a -> a -> Bool
>a
i,a
la -> a -> Bool
forall a. Ord a => a -> a -> Bool
>a
i,a
ka -> a -> Bool
forall a. Ord a => a -> a -> Bool
>a
j,a
la -> a -> Bool
forall a. Ord a => a -> a -> Bool
>a
j,a
la -> a -> Bool
forall a. Ord a => a -> a -> Bool
>a
k])
                   epsL :: [([Int], Rational)]
epsL = ([Int] -> ([Int], Rational)) -> [[Int]] -> [([Int], Rational)]
forall a b. (a -> b) -> [a] -> [b]
map (\x :: [Int]
x@[Int
i,Int
j,Int
k,Int
l] -> ([Int]
x, Int -> Int -> Int -> Int -> Rational
forall a a. (Num a, Ord a) => a -> a -> a -> a -> a
epsSign Int
i Int
j Int
k Int
l)) ([[Int]] -> [([Int], Rational)]) -> [[Int]] -> [([Int], Rational)]
forall a b. (a -> b) -> a -> b
$ [Int] -> [[Int]]
forall a. [a] -> [[a]]
permutations [Int
0,Int
1,Int
2,Int
3]

-- | Covariant Levi-Civita symbol lifted to @'ATens'@.
epsilonA :: ATens 0 0 0 0 0 4 (SField Rational)
epsilonA :: ATens 0 0 0 0 0 4 (SField Rational)
epsilonA = STTens 0 4 (SField Rational) -> ATens 0 0 0 0 0 4 (SField Rational)
forall (n1 :: Nat) (n2 :: Nat) v.
STTens n1 n2 v -> ATens 0 0 0 0 n1 n2 v
liftSTtoATens STTens 0 4 (SField Rational)
epsilon

-- | Contravariant spacetime Levi-Civita symbol \(\epsilon^{abcd}\) as type @'STTens'4 0 ('SField' 'Rational')@. T
epsilonInv :: STTens 4 0 (SField Rational)
epsilonInv :: STTens 4 0 (SField Rational)
epsilonInv = [(IndTuple2 4 0 Ind3, SField Rational)]
-> STTens 4 0 (SField Rational)
forall k1 v (n1 :: Nat) (n2 :: Nat).
(TIndex k1, TAdd v) =>
[(IndTuple2 n1 n2 k1, v)] -> AbsTensor2 n1 n2 k1 v
fromListT2 [(IndTuple2 4 0 Ind3, SField Rational)]
ls
                where
                   ls :: [(IndTuple2 4 0 Ind3, SField Rational)]
ls = (([Int], Rational) -> (IndTuple2 4 0 Ind3, SField Rational))
-> [([Int], Rational)] -> [(IndTuple2 4 0 Ind3, SField Rational)]
forall a b. (a -> b) -> [a] -> [b]
map (\([Int
i,Int
j,Int
k,Int
l],Rational
v) -> ((Ind3 -> IndList (4 - 1) Ind3 -> IndList 4 Ind3
forall a (n :: Nat). a -> IndList (n - 1) a -> IndList n a
Append (Int -> Ind3
Ind3 Int
i) (IndList (4 - 1) Ind3 -> IndList 4 Ind3)
-> IndList (4 - 1) Ind3 -> IndList 4 Ind3
forall a b. (a -> b) -> a -> b
$ Ind3 -> IndList (3 - 1) Ind3 -> IndList 3 Ind3
forall a (n :: Nat). a -> IndList (n - 1) a -> IndList n a
Append (Int -> Ind3
Ind3 Int
j) (IndList (3 - 1) Ind3 -> IndList 3 Ind3)
-> IndList (3 - 1) Ind3 -> IndList 3 Ind3
forall a b. (a -> b) -> a -> b
$ Ind3 -> IndList (2 - 1) Ind3 -> IndList 2 Ind3
forall a (n :: Nat). a -> IndList (n - 1) a -> IndList n a
Append (Int -> Ind3
Ind3 Int
k) (IndList (2 - 1) Ind3 -> IndList 2 Ind3)
-> IndList (2 - 1) Ind3 -> IndList 2 Ind3
forall a b. (a -> b) -> a -> b
$ Ind3 -> IndList 1 Ind3
forall a. a -> IndList 1 a
singletonInd (Int -> Ind3
Ind3 Int
l), IndList 0 Ind3
forall a. IndList 0 a
Empty),Rational -> SField Rational
forall a. a -> SField a
SField Rational
v)) [([Int], Rational)]
epsL
                   epsSign :: a -> a -> a -> a -> a
epsSign a
i a
j a
k a
l = (-a
1) a -> Int -> a
forall a b. (Num a, Integral b) => a -> b -> a
^ [Bool] -> Int
forall (t :: * -> *) a. Foldable t => t a -> Int
length ((Bool -> Bool) -> [Bool] -> [Bool]
forall a. (a -> Bool) -> [a] -> [a]
filter (Bool -> Bool -> Bool
forall a. Eq a => a -> a -> Bool
==Bool
True) [a
ja -> a -> Bool
forall a. Ord a => a -> a -> Bool
>a
i,a
ka -> a -> Bool
forall a. Ord a => a -> a -> Bool
>a
i,a
la -> a -> Bool
forall a. Ord a => a -> a -> Bool
>a
i,a
ka -> a -> Bool
forall a. Ord a => a -> a -> Bool
>a
j,a
la -> a -> Bool
forall a. Ord a => a -> a -> Bool
>a
j,a
la -> a -> Bool
forall a. Ord a => a -> a -> Bool
>a
k])
                   epsL :: [([Int], Rational)]
epsL = ([Int] -> ([Int], Rational)) -> [[Int]] -> [([Int], Rational)]
forall a b. (a -> b) -> [a] -> [b]
map (\x :: [Int]
x@[Int
i,Int
j,Int
k,Int
l] -> ([Int]
x, Int -> Int -> Int -> Int -> Rational
forall a a. (Num a, Ord a) => a -> a -> a -> a -> a
epsSign Int
i Int
j Int
k Int
l)) ([[Int]] -> [([Int], Rational)]) -> [[Int]] -> [([Int], Rational)]
forall a b. (a -> b) -> a -> b
$ [Int] -> [[Int]]
forall a. [a] -> [[a]]
permutations [Int
0,Int
1,Int
2,Int
3]

-- | Contravariant Levi-Civita symbol lifted to @'ATens'@.
epsilonInvA :: ATens 0 0 0 0 4 0 (SField Rational)
epsilonInvA :: ATens 0 0 0 0 4 0 (SField Rational)
epsilonInvA = STTens 4 0 (SField Rational) -> ATens 0 0 0 0 4 0 (SField Rational)
forall (n1 :: Nat) (n2 :: Nat) v.
STTens n1 n2 v -> ATens 0 0 0 0 n1 n2 v
liftSTtoATens STTens 4 0 (SField Rational)
epsilonInv

--generators of the Lorentz group lie algebra (for flat metric eta)

lorentzJ1 :: ATens 0 0 0 0 1 1 (SField Rational)
lorentzJ1 :: ATens 0 0 0 0 1 1 (SField Rational)
lorentzJ1 = [(IndTuple6 0 0 0 0 1 1 Ind20 Ind9 Ind3, SField Rational)]
-> ATens 0 0 0 0 1 1 (SField Rational)
forall k1 k2 k3 v (n1 :: Nat) (n2 :: Nat) (n3 :: Nat) (n4 :: Nat)
       (n5 :: Nat) (n6 :: Nat).
(TIndex k1, TIndex k2, TIndex k3, TAdd v) =>
[(IndTuple6 n1 n2 n3 n4 n5 n6 k1 k2 k3, v)]
-> AbsTensor6 n1 n2 n3 n4 n5 n6 k1 k2 k3 v
fromListT6 [(IndTuple6 0 0 0 0 1 1 Ind20 Ind9 Ind3, SField Rational)]
forall a a a a.
[((IndList 0 a, IndList 0 a, IndList 0 a, IndList 0 a,
   IndList 1 Ind3, IndList 1 Ind3),
  SField Rational)]
l
        where
            l :: [((IndList 0 a, IndList 0 a, IndList 0 a, IndList 0 a,
   IndList 1 Ind3, IndList 1 Ind3),
  SField Rational)]
l = ((Int, Int, Rational)
 -> ((IndList 0 a, IndList 0 a, IndList 0 a, IndList 0 a,
      IndList 1 Ind3, IndList 1 Ind3),
     SField Rational))
-> [(Int, Int, Rational)]
-> [((IndList 0 a, IndList 0 a, IndList 0 a, IndList 0 a,
      IndList 1 Ind3, IndList 1 Ind3),
     SField Rational)]
forall a b. (a -> b) -> [a] -> [b]
map (\(Int
x,Int
y,Rational
z) -> ((IndList 0 a
forall a. IndList 0 a
Empty,IndList 0 a
forall a. IndList 0 a
Empty,IndList 0 a
forall a. IndList 0 a
Empty,IndList 0 a
forall a. IndList 0 a
Empty,Ind3 -> IndList 1 Ind3
forall a. a -> IndList 1 a
singletonInd (Ind3 -> IndList 1 Ind3) -> Ind3 -> IndList 1 Ind3
forall a b. (a -> b) -> a -> b
$ Int -> Ind3
Ind3 Int
x,Ind3 -> IndList 1 Ind3
forall a. a -> IndList 1 a
singletonInd (Ind3 -> IndList 1 Ind3) -> Ind3 -> IndList 1 Ind3
forall a b. (a -> b) -> a -> b
$ Int -> Ind3
Ind3 Int
y), Rational -> SField Rational
forall a. a -> SField a
SField Rational
z)) [(Int
3,Int
2,Rational
1),(Int
2,Int
3,-Rational
1)]

lorentzJ2 :: ATens 0 0 0 0 1 1 (SField Rational)
lorentzJ2 :: ATens 0 0 0 0 1 1 (SField Rational)
lorentzJ2 = [(IndTuple6 0 0 0 0 1 1 Ind20 Ind9 Ind3, SField Rational)]
-> ATens 0 0 0 0 1 1 (SField Rational)
forall k1 k2 k3 v (n1 :: Nat) (n2 :: Nat) (n3 :: Nat) (n4 :: Nat)
       (n5 :: Nat) (n6 :: Nat).
(TIndex k1, TIndex k2, TIndex k3, TAdd v) =>
[(IndTuple6 n1 n2 n3 n4 n5 n6 k1 k2 k3, v)]
-> AbsTensor6 n1 n2 n3 n4 n5 n6 k1 k2 k3 v
fromListT6 [(IndTuple6 0 0 0 0 1 1 Ind20 Ind9 Ind3, SField Rational)]
forall a a a a.
[((IndList 0 a, IndList 0 a, IndList 0 a, IndList 0 a,
   IndList 1 Ind3, IndList 1 Ind3),
  SField Rational)]
l
        where
            l :: [((IndList 0 a, IndList 0 a, IndList 0 a, IndList 0 a,
   IndList 1 Ind3, IndList 1 Ind3),
  SField Rational)]
l = ((Int, Int, Rational)
 -> ((IndList 0 a, IndList 0 a, IndList 0 a, IndList 0 a,
      IndList 1 Ind3, IndList 1 Ind3),
     SField Rational))
-> [(Int, Int, Rational)]
-> [((IndList 0 a, IndList 0 a, IndList 0 a, IndList 0 a,
      IndList 1 Ind3, IndList 1 Ind3),
     SField Rational)]
forall a b. (a -> b) -> [a] -> [b]
map (\(Int
x,Int
y,Rational
z) -> ((IndList 0 a
forall a. IndList 0 a
Empty,IndList 0 a
forall a. IndList 0 a
Empty,IndList 0 a
forall a. IndList 0 a
Empty,IndList 0 a
forall a. IndList 0 a
Empty,Ind3 -> IndList 1 Ind3
forall a. a -> IndList 1 a
singletonInd (Ind3 -> IndList 1 Ind3) -> Ind3 -> IndList 1 Ind3
forall a b. (a -> b) -> a -> b
$ Int -> Ind3
Ind3 Int
x,Ind3 -> IndList 1 Ind3
forall a. a -> IndList 1 a
singletonInd (Ind3 -> IndList 1 Ind3) -> Ind3 -> IndList 1 Ind3
forall a b. (a -> b) -> a -> b
$ Int -> Ind3
Ind3 Int
y), Rational -> SField Rational
forall a. a -> SField a
SField Rational
z)) [(Int
3,Int
1,-Rational
1),(Int
1,Int
3,Rational
1)]

lorentzJ3 :: ATens 0 0 0 0 1 1 (SField Rational)
lorentzJ3 :: ATens 0 0 0 0 1 1 (SField Rational)
lorentzJ3 = [(IndTuple6 0 0 0 0 1 1 Ind20 Ind9 Ind3, SField Rational)]
-> ATens 0 0 0 0 1 1 (SField Rational)
forall k1 k2 k3 v (n1 :: Nat) (n2 :: Nat) (n3 :: Nat) (n4 :: Nat)
       (n5 :: Nat) (n6 :: Nat).
(TIndex k1, TIndex k2, TIndex k3, TAdd v) =>
[(IndTuple6 n1 n2 n3 n4 n5 n6 k1 k2 k3, v)]
-> AbsTensor6 n1 n2 n3 n4 n5 n6 k1 k2 k3 v
fromListT6 [(IndTuple6 0 0 0 0 1 1 Ind20 Ind9 Ind3, SField Rational)]
forall a a a a.
[((IndList 0 a, IndList 0 a, IndList 0 a, IndList 0 a,
   IndList 1 Ind3, IndList 1 Ind3),
  SField Rational)]
l
        where
            l :: [((IndList 0 a, IndList 0 a, IndList 0 a, IndList 0 a,
   IndList 1 Ind3, IndList 1 Ind3),
  SField Rational)]
l = ((Int, Int, Rational)
 -> ((IndList 0 a, IndList 0 a, IndList 0 a, IndList 0 a,
      IndList 1 Ind3, IndList 1 Ind3),
     SField Rational))
-> [(Int, Int, Rational)]
-> [((IndList 0 a, IndList 0 a, IndList 0 a, IndList 0 a,
      IndList 1 Ind3, IndList 1 Ind3),
     SField Rational)]
forall a b. (a -> b) -> [a] -> [b]
map (\(Int
x,Int
y,Rational
z) -> ((IndList 0 a
forall a. IndList 0 a
Empty,IndList 0 a
forall a. IndList 0 a
Empty,IndList 0 a
forall a. IndList 0 a
Empty,IndList 0 a
forall a. IndList 0 a
Empty,Ind3 -> IndList 1 Ind3
forall a. a -> IndList 1 a
singletonInd (Ind3 -> IndList 1 Ind3) -> Ind3 -> IndList 1 Ind3
forall a b. (a -> b) -> a -> b
$ Int -> Ind3
Ind3 Int
x,Ind3 -> IndList 1 Ind3
forall a. a -> IndList 1 a
singletonInd (Ind3 -> IndList 1 Ind3) -> Ind3 -> IndList 1 Ind3
forall a b. (a -> b) -> a -> b
$ Int -> Ind3
Ind3 Int
y), Rational -> SField Rational
forall a. a -> SField a
SField Rational
z)) [(Int
2,Int
1,Rational
1),(Int
1,Int
2,-Rational
1)]

lorentzK1 :: ATens 0 0 0 0 1 1 (SField Rational)
lorentzK1 :: ATens 0 0 0 0 1 1 (SField Rational)
lorentzK1 = [(IndTuple6 0 0 0 0 1 1 Ind20 Ind9 Ind3, SField Rational)]
-> ATens 0 0 0 0 1 1 (SField Rational)
forall k1 k2 k3 v (n1 :: Nat) (n2 :: Nat) (n3 :: Nat) (n4 :: Nat)
       (n5 :: Nat) (n6 :: Nat).
(TIndex k1, TIndex k2, TIndex k3, TAdd v) =>
[(IndTuple6 n1 n2 n3 n4 n5 n6 k1 k2 k3, v)]
-> AbsTensor6 n1 n2 n3 n4 n5 n6 k1 k2 k3 v
fromListT6 [(IndTuple6 0 0 0 0 1 1 Ind20 Ind9 Ind3, SField Rational)]
forall a a a a.
[((IndList 0 a, IndList 0 a, IndList 0 a, IndList 0 a,
   IndList 1 Ind3, IndList 1 Ind3),
  SField Rational)]
l
        where
            l :: [((IndList 0 a, IndList 0 a, IndList 0 a, IndList 0 a,
   IndList 1 Ind3, IndList 1 Ind3),
  SField Rational)]
l = ((Int, Int, Rational)
 -> ((IndList 0 a, IndList 0 a, IndList 0 a, IndList 0 a,
      IndList 1 Ind3, IndList 1 Ind3),
     SField Rational))
-> [(Int, Int, Rational)]
-> [((IndList 0 a, IndList 0 a, IndList 0 a, IndList 0 a,
      IndList 1 Ind3, IndList 1 Ind3),
     SField Rational)]
forall a b. (a -> b) -> [a] -> [b]
map (\(Int
x,Int
y,Rational
z) -> ((IndList 0 a
forall a. IndList 0 a
Empty,IndList 0 a
forall a. IndList 0 a
Empty,IndList 0 a
forall a. IndList 0 a
Empty,IndList 0 a
forall a. IndList 0 a
Empty,Ind3 -> IndList 1 Ind3
forall a. a -> IndList 1 a
singletonInd (Ind3 -> IndList 1 Ind3) -> Ind3 -> IndList 1 Ind3
forall a b. (a -> b) -> a -> b
$ Int -> Ind3
Ind3 Int
x,Ind3 -> IndList 1 Ind3
forall a. a -> IndList 1 a
singletonInd (Ind3 -> IndList 1 Ind3) -> Ind3 -> IndList 1 Ind3
forall a b. (a -> b) -> a -> b
$ Int -> Ind3
Ind3 Int
y), Rational -> SField Rational
forall a. a -> SField a
SField Rational
z)) [(Int
0,Int
1,Rational
1),(Int
1,Int
0,Rational
1)]

lorentzK2 :: ATens 0 0 0 0 1 1 (SField Rational)
lorentzK2 :: ATens 0 0 0 0 1 1 (SField Rational)
lorentzK2 = [(IndTuple6 0 0 0 0 1 1 Ind20 Ind9 Ind3, SField Rational)]
-> ATens 0 0 0 0 1 1 (SField Rational)
forall k1 k2 k3 v (n1 :: Nat) (n2 :: Nat) (n3 :: Nat) (n4 :: Nat)
       (n5 :: Nat) (n6 :: Nat).
(TIndex k1, TIndex k2, TIndex k3, TAdd v) =>
[(IndTuple6 n1 n2 n3 n4 n5 n6 k1 k2 k3, v)]
-> AbsTensor6 n1 n2 n3 n4 n5 n6 k1 k2 k3 v
fromListT6 [(IndTuple6 0 0 0 0 1 1 Ind20 Ind9 Ind3, SField Rational)]
forall a a a a.
[((IndList 0 a, IndList 0 a, IndList 0 a, IndList 0 a,
   IndList 1 Ind3, IndList 1 Ind3),
  SField Rational)]
l
        where
            l :: [((IndList 0 a, IndList 0 a, IndList 0 a, IndList 0 a,
   IndList 1 Ind3, IndList 1 Ind3),
  SField Rational)]
l = ((Int, Int, Rational)
 -> ((IndList 0 a, IndList 0 a, IndList 0 a, IndList 0 a,
      IndList 1 Ind3, IndList 1 Ind3),
     SField Rational))
-> [(Int, Int, Rational)]
-> [((IndList 0 a, IndList 0 a, IndList 0 a, IndList 0 a,
      IndList 1 Ind3, IndList 1 Ind3),
     SField Rational)]
forall a b. (a -> b) -> [a] -> [b]
map (\(Int
x,Int
y,Rational
z) -> ((IndList 0 a
forall a. IndList 0 a
Empty,IndList 0 a
forall a. IndList 0 a
Empty,IndList 0 a
forall a. IndList 0 a
Empty,IndList 0 a
forall a. IndList 0 a
Empty,Ind3 -> IndList 1 Ind3
forall a. a -> IndList 1 a
singletonInd (Ind3 -> IndList 1 Ind3) -> Ind3 -> IndList 1 Ind3
forall a b. (a -> b) -> a -> b
$ Int -> Ind3
Ind3 Int
x,Ind3 -> IndList 1 Ind3
forall a. a -> IndList 1 a
singletonInd (Ind3 -> IndList 1 Ind3) -> Ind3 -> IndList 1 Ind3
forall a b. (a -> b) -> a -> b
$ Int -> Ind3
Ind3 Int
y), Rational -> SField Rational
forall a. a -> SField a
SField Rational
z)) [(Int
0,Int
2,Rational
1),(Int
2,Int
0,Rational
1)]

lorentzK3 :: ATens 0 0 0 0 1 1 (SField Rational)
lorentzK3 :: ATens 0 0 0 0 1 1 (SField Rational)
lorentzK3 = [(IndTuple6 0 0 0 0 1 1 Ind20 Ind9 Ind3, SField Rational)]
-> ATens 0 0 0 0 1 1 (SField Rational)
forall k1 k2 k3 v (n1 :: Nat) (n2 :: Nat) (n3 :: Nat) (n4 :: Nat)
       (n5 :: Nat) (n6 :: Nat).
(TIndex k1, TIndex k2, TIndex k3, TAdd v) =>
[(IndTuple6 n1 n2 n3 n4 n5 n6 k1 k2 k3, v)]
-> AbsTensor6 n1 n2 n3 n4 n5 n6 k1 k2 k3 v
fromListT6 [(IndTuple6 0 0 0 0 1 1 Ind20 Ind9 Ind3, SField Rational)]
forall a a a a.
[((IndList 0 a, IndList 0 a, IndList 0 a, IndList 0 a,
   IndList 1 Ind3, IndList 1 Ind3),
  SField Rational)]
l
        where
            l :: [((IndList 0 a, IndList 0 a, IndList 0 a, IndList 0 a,
   IndList 1 Ind3, IndList 1 Ind3),
  SField Rational)]
l = ((Int, Int, Rational)
 -> ((IndList 0 a, IndList 0 a, IndList 0 a, IndList 0 a,
      IndList 1 Ind3, IndList 1 Ind3),
     SField Rational))
-> [(Int, Int, Rational)]
-> [((IndList 0 a, IndList 0 a, IndList 0 a, IndList 0 a,
      IndList 1 Ind3, IndList 1 Ind3),
     SField Rational)]
forall a b. (a -> b) -> [a] -> [b]
map (\(Int
x,Int
y,Rational
z) -> ((IndList 0 a
forall a. IndList 0 a
Empty,IndList 0 a
forall a. IndList 0 a
Empty,IndList 0 a
forall a. IndList 0 a
Empty,IndList 0 a
forall a. IndList 0 a
Empty,Ind3 -> IndList 1 Ind3
forall a. a -> IndList 1 a
singletonInd (Ind3 -> IndList 1 Ind3) -> Ind3 -> IndList 1 Ind3
forall a b. (a -> b) -> a -> b
$ Int -> Ind3
Ind3 Int
x,Ind3 -> IndList 1 Ind3
forall a. a -> IndList 1 a
singletonInd (Ind3 -> IndList 1 Ind3) -> Ind3 -> IndList 1 Ind3
forall a b. (a -> b) -> a -> b
$ Int -> Ind3
Ind3 Int
y), Rational -> SField Rational
forall a. a -> SField a
SField Rational
z)) [(Int
0,Int
3,Rational
1),(Int
3,Int
0,Rational
1)]

-- Area Metric

-- | Flat area metric tensor. Can be obtained via the @'interJArea'@ intertwiner \( J_A^{abcd}\) as: \( N_A = J_A^{abcd} \left ( \eta_{ac} \eta_{bd} - \eta_{ad} \eta_{bc} - \epsilon_{abcd} \right ) \).
flatArea :: ATens 0 1 0 0 0 0 (SField Rational)
flatArea :: ATens 0 1 0 0 0 0 (SField Rational)
flatArea = [(IndTuple6 0 1 0 0 0 0 Ind20 Ind9 Ind3, SField Rational)]
-> ATens 0 1 0 0 0 0 (SField Rational)
forall k1 k2 k3 v (n1 :: Nat) (n2 :: Nat) (n3 :: Nat) (n4 :: Nat)
       (n5 :: Nat) (n6 :: Nat).
(TIndex k1, TIndex k2, TIndex k3, TAdd v) =>
[(IndTuple6 n1 n2 n3 n4 n5 n6 k1 k2 k3, v)]
-> AbsTensor6 n1 n2 n3 n4 n5 n6 k1 k2 k3 v
fromListT6 ([(IndTuple6 0 1 0 0 0 0 Ind20 Ind9 Ind3, SField Rational)]
 -> ATens 0 1 0 0 0 0 (SField Rational))
-> [(IndTuple6 0 1 0 0 0 0 Ind20 Ind9 Ind3, SField Rational)]
-> ATens 0 1 0 0 0 0 (SField Rational)
forall a b. (a -> b) -> a -> b
$ ((Int, Rational)
 -> (IndTuple6 0 1 0 0 0 0 Ind20 Ind9 Ind3, SField Rational))
-> [(Int, Rational)]
-> [(IndTuple6 0 1 0 0 0 0 Ind20 Ind9 Ind3, SField Rational)]
forall a b. (a -> b) -> [a] -> [b]
map (\(Int
i,Rational
v) -> ( (IndList 0 Ind20
forall a. IndList 0 a
Empty, Ind20 -> IndList 1 Ind20
forall a. a -> IndList 1 a
singletonInd (Ind20 -> IndList 1 Ind20) -> Ind20 -> IndList 1 Ind20
forall a b. (a -> b) -> a -> b
$ Int -> Ind20
Ind20 Int
i, IndList 0 Ind9
forall a. IndList 0 a
Empty, IndList 0 Ind9
forall a. IndList 0 a
Empty, IndList 0 Ind3
forall a. IndList 0 a
Empty, IndList 0 Ind3
forall a. IndList 0 a
Empty), Rational -> SField Rational
forall a. a -> SField a
SField Rational
v))
                        [(Int
0,-Rational
1),(Int
5,-Rational
1),(Int
6,-Rational
1),(Int
9,Rational
1),(Int
11,-Rational
1),(Int
12,-Rational
1),(Int
15,Rational
1),(Int
18,Rational
1),(Int
20,Rational
1)]


--now the Area metric tensors

trianMap2 :: M.Map (IndList 2 Ind3) (IndList 1 Ind9)
trianMap2 :: Map (IndList 2 Ind3) (IndList 1 Ind9)
trianMap2 = [(IndList 2 Ind3, IndList 1 Ind9)]
-> Map (IndList 2 Ind3) (IndList 1 Ind9)
forall k a. Ord k => [(k, a)] -> Map k a
M.fromList ([(IndList 2 Ind3, IndList 1 Ind9)]
 -> Map (IndList 2 Ind3) (IndList 1 Ind9))
-> [(IndList 2 Ind3, IndList 1 Ind9)]
-> Map (IndList 2 Ind3) (IndList 1 Ind9)
forall a b. (a -> b) -> a -> b
$ [IndList 2 Ind3]
-> [IndList 1 Ind9] -> [(IndList 2 Ind3, IndList 1 Ind9)]
forall a b. [a] -> [b] -> [(a, b)]
zip [ Ind3 -> IndList (2 - 1) Ind3 -> IndList 2 Ind3
forall a (n :: Nat). a -> IndList (n - 1) a -> IndList n a
Append (Int -> Ind3
Ind3 Int
a) (IndList (2 - 1) Ind3 -> IndList 2 Ind3)
-> IndList (2 - 1) Ind3 -> IndList 2 Ind3
forall a b. (a -> b) -> a -> b
$ Ind3 -> IndList 1 Ind3
forall a. a -> IndList 1 a
singletonInd (Ind3 -> IndList 1 Ind3) -> Ind3 -> IndList 1 Ind3
forall a b. (a -> b) -> a -> b
$ Int -> Ind3
Ind3 Int
b | Int
a <- [Int
0..Int
3], Int
b <- [Int
a..Int
3] ] ([IndList 1 Ind9] -> [(IndList 2 Ind3, IndList 1 Ind9)])
-> [IndList 1 Ind9] -> [(IndList 2 Ind3, IndList 1 Ind9)]
forall a b. (a -> b) -> a -> b
$ (Int -> IndList 1 Ind9) -> [Int] -> [IndList 1 Ind9]
forall a b. (a -> b) -> [a] -> [b]
map (Ind9 -> IndList 1 Ind9
forall a. a -> IndList 1 a
singletonInd (Ind9 -> IndList 1 Ind9) -> (Int -> Ind9) -> Int -> IndList 1 Ind9
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Int -> Ind9
Ind9) [Int
0..]

trianMapArea :: M.Map (IndList 4 Ind3) (IndList 1 Ind20)
trianMapArea :: Map (IndList 4 Ind3) (IndList 1 Ind20)
trianMapArea = [(IndList 4 Ind3, IndList 1 Ind20)]
-> Map (IndList 4 Ind3) (IndList 1 Ind20)
forall k a. Ord k => [(k, a)] -> Map k a
M.fromList ([(IndList 4 Ind3, IndList 1 Ind20)]
 -> Map (IndList 4 Ind3) (IndList 1 Ind20))
-> [(IndList 4 Ind3, IndList 1 Ind20)]
-> Map (IndList 4 Ind3) (IndList 1 Ind20)
forall a b. (a -> b) -> a -> b
$ [IndList 4 Ind3]
-> [IndList 1 Ind20] -> [(IndList 4 Ind3, IndList 1 Ind20)]
forall a b. [a] -> [b] -> [(a, b)]
zip [ Ind3 -> IndList (4 - 1) Ind3 -> IndList 4 Ind3
forall a (n :: Nat). a -> IndList (n - 1) a -> IndList n a
Append (Int -> Ind3
Ind3 Int
a) (IndList (4 - 1) Ind3 -> IndList 4 Ind3)
-> IndList (4 - 1) Ind3 -> IndList 4 Ind3
forall a b. (a -> b) -> a -> b
$ Ind3 -> IndList (3 - 1) Ind3 -> IndList 3 Ind3
forall a (n :: Nat). a -> IndList (n - 1) a -> IndList n a
Append (Int -> Ind3
Ind3 Int
b) (IndList (3 - 1) Ind3 -> IndList 3 Ind3)
-> IndList (3 - 1) Ind3 -> IndList 3 Ind3
forall a b. (a -> b) -> a -> b
$ Ind3 -> IndList (2 - 1) Ind3 -> IndList 2 Ind3
forall a (n :: Nat). a -> IndList (n - 1) a -> IndList n a
Append (Int -> Ind3
Ind3 Int
c) (IndList (2 - 1) Ind3 -> IndList 2 Ind3)
-> IndList (2 - 1) Ind3 -> IndList 2 Ind3
forall a b. (a -> b) -> a -> b
$ Ind3 -> IndList 1 Ind3
forall a. a -> IndList 1 a
singletonInd (Ind3 -> IndList 1 Ind3) -> Ind3 -> IndList 1 Ind3
forall a b. (a -> b) -> a -> b
$ Int -> Ind3
Ind3 Int
d | Int
a <- [Int
0..Int
2], Int
b <- [Int
aInt -> Int -> Int
forall a. Num a => a -> a -> a
+Int
1..Int
3], Int
c <- [Int
a..Int
2], Int
d <- [Int
cInt -> Int -> Int
forall a. Num a => a -> a -> a
+Int
1..Int
3], Bool -> Bool
not (Bool -> Bool) -> Bool -> Bool
forall a b. (a -> b) -> a -> b
$ Int
a Int -> Int -> Bool
forall a. Eq a => a -> a -> Bool
== Int
c Bool -> Bool -> Bool
&& Int
b Int -> Int -> Bool
forall a. Ord a => a -> a -> Bool
> Int
d ] ([IndList 1 Ind20] -> [(IndList 4 Ind3, IndList 1 Ind20)])
-> [IndList 1 Ind20] -> [(IndList 4 Ind3, IndList 1 Ind20)]
forall a b. (a -> b) -> a -> b
$ (Int -> IndList 1 Ind20) -> [Int] -> [IndList 1 Ind20]
forall a b. (a -> b) -> [a] -> [b]
map (Ind20 -> IndList 1 Ind20
forall a. a -> IndList 1 a
singletonInd (Ind20 -> IndList 1 Ind20)
-> (Int -> Ind20) -> Int -> IndList 1 Ind20
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Int -> Ind20
Ind20) [Int
0..]

jMult2 :: (Eq a) => IndList 2 a -> Rational
jMult2 :: IndList 2 a -> Rational
jMult2 (Append a
a (Append a
b IndList ((2 - 1) - 1) a
Empty))
        | a
a a -> a -> Bool
forall a. Eq a => a -> a -> Bool
== a
b = Rational
1
        | Bool
otherwise = Rational
1Rational -> Rational -> Rational
forall a. Fractional a => a -> a -> a
/Rational
2

_jMult3 :: (Eq a) => IndList 3 a -> Rational
_jMult3 :: IndList 3 a -> Rational
_jMult3 (Append a
a (Append a
b (Append a
c IndList (((3 - 1) - 1) - 1) a
Empty)))
        | Int
i Int -> Int -> Bool
forall a. Eq a => a -> a -> Bool
== Int
1 = Rational
1
        | Int
i Int -> Int -> Bool
forall a. Eq a => a -> a -> Bool
== Int
2 = Rational
1Rational -> Rational -> Rational
forall a. Fractional a => a -> a -> a
/Rational
3
        | Bool
otherwise = Rational
1Rational -> Rational -> Rational
forall a. Fractional a => a -> a -> a
/Rational
6
         where
            i :: Int
i = [a] -> Int
forall (t :: * -> *) a. Foldable t => t a -> Int
length ([a] -> Int) -> [a] -> Int
forall a b. (a -> b) -> a -> b
$ [a] -> [a]
forall a. Eq a => [a] -> [a]
nub [a
a,a
b,a
c]

jMultArea :: (Eq a) => IndList 4 a -> Rational
jMultArea :: IndList 4 a -> Rational
jMultArea (Append a
a (Append a
b (Append a
c (Append a
d IndList ((((4 - 1) - 1) - 1) - 1) a
Empty))))
            | a
a a -> a -> Bool
forall a. Eq a => a -> a -> Bool
== a
c Bool -> Bool -> Bool
&& a
b a -> a -> Bool
forall a. Eq a => a -> a -> Bool
== a
d = Rational
1Rational -> Rational -> Rational
forall a. Fractional a => a -> a -> a
/Rational
4
            | Bool
otherwise = Rational
1Rational -> Rational -> Rational
forall a. Fractional a => a -> a -> a
/Rational
8

_isZeroArea :: (Eq a) => IndList 4 a -> Bool
_isZeroArea :: IndList 4 a -> Bool
_isZeroArea (Append a
a (Append a
b (Append a
c (Append a
d IndList ((((4 - 1) - 1) - 1) - 1) a
Empty)))) = a
a a -> a -> Bool
forall a. Eq a => a -> a -> Bool
== a
b Bool -> Bool -> Bool
|| a
c a -> a -> Bool
forall a. Eq a => a -> a -> Bool
== a
d

areaSign :: (Eq a, Ord a) => IndList 4 a -> Rational
areaSign :: IndList 4 a -> Rational
areaSign (Append a
a (Append a
b (Append a
c (Append a
d IndList ((((4 - 1) - 1) - 1) - 1) a
Empty)))) = Rational
s1 Rational -> Rational -> Rational
forall a. Num a => a -> a -> a
* Rational
s2
             where
                s1 :: Rational
s1 = a -> a -> Rational
forall a p. (Ord a, Num p) => a -> a -> p
pairSign a
a a
b
                s2 :: Rational
s2 = a -> a -> Rational
forall a p. (Ord a, Num p) => a -> a -> p
pairSign a
c a
d
                pairSign :: a -> a -> p
pairSign a
x a
y = if a
x a -> a -> Bool
forall a. Ord a => a -> a -> Bool
< a
y then p
1 else -p
1

canonicalizeArea :: (Eq a, Ord a) => IndList 4 a -> (IndList 4 a, Rational)
canonicalizeArea :: IndList 4 a -> (IndList 4 a, Rational)
canonicalizeArea (Append a
a (Append a
b (Append a
c (Append a
d IndList ((((4 - 1) - 1) - 1) - 1) a
Empty)))) = (a -> IndList (4 - 1) a -> IndList 4 a
forall a (n :: Nat). a -> IndList (n - 1) a -> IndList n a
Append a
a' (a -> IndList (3 - 1) a -> IndList 3 a
forall a (n :: Nat). a -> IndList (n - 1) a -> IndList n a
Append a
b' (a -> IndList (2 - 1) a -> IndList 2 a
forall a (n :: Nat). a -> IndList (n - 1) a -> IndList n a
Append a
c' (a -> IndList (1 - 1) a -> IndList 1 a
forall a (n :: Nat). a -> IndList (n - 1) a -> IndList n a
Append a
d' IndList (1 - 1) a
forall a. IndList 0 a
Empty))),Rational
s)
        where
            s :: Rational
s = IndList 4 a -> Rational
forall a. (Eq a, Ord a) => IndList 4 a -> Rational
areaSign (a -> IndList (4 - 1) a -> IndList 4 a
forall a (n :: Nat). a -> IndList (n - 1) a -> IndList n a
Append a
a (a -> IndList (3 - 1) a -> IndList 3 a
forall a (n :: Nat). a -> IndList (n - 1) a -> IndList n a
Append a
b (a -> IndList (2 - 1) a -> IndList 2 a
forall a (n :: Nat). a -> IndList (n - 1) a -> IndList n a
Append a
c (a -> IndList (1 - 1) a -> IndList 1 a
forall a (n :: Nat). a -> IndList (n - 1) a -> IndList n a
Append a
d IndList (1 - 1) a
forall a. IndList 0 a
Empty))))
            [[a
a',a
b'],[a
c',a
d']] = [[a]] -> [[a]]
forall a. Ord a => [a] -> [a]
sort ([[a]] -> [[a]]) -> [[a]] -> [[a]]
forall a b. (a -> b) -> a -> b
$ ([a] -> [a]) -> [[a]] -> [[a]]
forall a b. (a -> b) -> [a] -> [b]
map [a] -> [a]
forall a. Ord a => [a] -> [a]
sort [[a
a,a
b],[a
c,a
d]]

-- | The tensor \(I^I_{ab} \) maps between covariant @'Ind9'@ indices and symmetric pairs of covariant @'Ind3'@ indices.
interI2 :: ATens 0 0 1 0 0 2 (SField Rational)
interI2 :: ATens 0 0 1 0 0 2 (SField Rational)
interI2 = [(IndTuple6 0 0 1 0 0 2 Ind20 Ind9 Ind3, SField Rational)]
-> ATens 0 0 1 0 0 2 (SField Rational)
forall k1 k2 k3 v (n1 :: Nat) (n2 :: Nat) (n3 :: Nat) (n4 :: Nat)
       (n5 :: Nat) (n6 :: Nat).
(TIndex k1, TIndex k2, TIndex k3, TAdd v) =>
[(IndTuple6 n1 n2 n3 n4 n5 n6 k1 k2 k3, v)]
-> AbsTensor6 n1 n2 n3 n4 n5 n6 k1 k2 k3 v
fromListT6 ([(IndTuple6 0 0 1 0 0 2 Ind20 Ind9 Ind3, SField Rational)]
 -> ATens 0 0 1 0 0 2 (SField Rational))
-> [(IndTuple6 0 0 1 0 0 2 Ind20 Ind9 Ind3, SField Rational)]
-> ATens 0 0 1 0 0 2 (SField Rational)
forall a b. (a -> b) -> a -> b
$ ((IndTuple6 0 0 1 0 0 2 Ind20 Ind9 Ind3, Rational)
 -> (IndTuple6 0 0 1 0 0 2 Ind20 Ind9 Ind3, SField Rational))
-> [(IndTuple6 0 0 1 0 0 2 Ind20 Ind9 Ind3, Rational)]
-> [(IndTuple6 0 0 1 0 0 2 Ind20 Ind9 Ind3, SField Rational)]
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap ((Rational -> SField Rational)
-> (IndTuple6 0 0 1 0 0 2 Ind20 Ind9 Ind3, Rational)
-> (IndTuple6 0 0 1 0 0 2 Ind20 Ind9 Ind3, SField Rational)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap Rational -> SField Rational
forall a. a -> SField a
SField) ([(IndTuple6 0 0 1 0 0 2 Ind20 Ind9 Ind3, Rational)]
 -> [(IndTuple6 0 0 1 0 0 2 Ind20 Ind9 Ind3, SField Rational)])
-> [(IndTuple6 0 0 1 0 0 2 Ind20 Ind9 Ind3, Rational)]
-> [(IndTuple6 0 0 1 0 0 2 Ind20 Ind9 Ind3, SField Rational)]
forall a b. (a -> b) -> a -> b
$ ((IndTuple6 0 0 1 0 0 2 Ind20 Ind9 Ind3, Rational) -> Bool)
-> [(IndTuple6 0 0 1 0 0 2 Ind20 Ind9 Ind3, Rational)]
-> [(IndTuple6 0 0 1 0 0 2 Ind20 Ind9 Ind3, Rational)]
forall a. (a -> Bool) -> [a] -> [a]
filter (\(IndTuple6 0 0 1 0 0 2 Ind20 Ind9 Ind3
_,Rational
k) -> Rational
k Rational -> Rational -> Bool
forall a. Eq a => a -> a -> Bool
/= Rational
0) ([(IndTuple6 0 0 1 0 0 2 Ind20 Ind9 Ind3, Rational)]
 -> [(IndTuple6 0 0 1 0 0 2 Ind20 Ind9 Ind3, Rational)])
-> [(IndTuple6 0 0 1 0 0 2 Ind20 Ind9 Ind3, Rational)]
-> [(IndTuple6 0 0 1 0 0 2 Ind20 Ind9 Ind3, Rational)]
forall a b. (a -> b) -> a -> b
$ (IndTuple6 0 0 1 0 0 2 Ind20 Ind9 Ind3
 -> (IndTuple6 0 0 1 0 0 2 Ind20 Ind9 Ind3, Rational))
-> [IndTuple6 0 0 1 0 0 2 Ind20 Ind9 Ind3]
-> [(IndTuple6 0 0 1 0 0 2 Ind20 Ind9 Ind3, Rational)]
forall a b. (a -> b) -> [a] -> [b]
map (\IndTuple6 0 0 1 0 0 2 Ind20 Ind9 Ind3
x -> (IndTuple6 0 0 1 0 0 2 Ind20 Ind9 Ind3
x,IndTuple6 0 0 1 0 0 2 Ind20 Ind9 Ind3 -> Rational
forall p a b d e.
Num p =>
(a, b, IndList 1 Ind9, d, e, IndList 2 Ind3) -> p
f IndTuple6 0 0 1 0 0 2 Ind20 Ind9 Ind3
x)) [IndTuple6 0 0 1 0 0 2 Ind20 Ind9 Ind3]
forall a a a a.
[(IndList 0 a, IndList 0 a, IndList 1 Ind9, IndList 0 a,
  IndList 0 a, IndList 2 Ind3)]
inds
        where
            trian2 :: Map (IndList 2 Ind3) (IndList 1 Ind9)
trian2 = Map (IndList 2 Ind3) (IndList 1 Ind9)
trianMap2
            inds :: [(IndList 0 a, IndList 0 a, IndList 1 Ind9, IndList 0 a,
  IndList 0 a, IndList 2 Ind3)]
inds = [ (IndList 0 a
forall a. IndList 0 a
Empty, IndList 0 a
forall a. IndList 0 a
Empty, Ind9 -> IndList 1 Ind9
forall a. a -> IndList 1 a
singletonInd (Ind9 -> IndList 1 Ind9) -> Ind9 -> IndList 1 Ind9
forall a b. (a -> b) -> a -> b
$ Int -> Ind9
Ind9 Int
a, IndList 0 a
forall a. IndList 0 a
Empty, IndList 0 a
forall a. IndList 0 a
Empty, Ind3 -> IndList (2 - 1) Ind3 -> IndList 2 Ind3
forall a (n :: Nat). a -> IndList (n - 1) a -> IndList n a
Append (Int -> Ind3
Ind3 Int
b) (IndList (2 - 1) Ind3 -> IndList 2 Ind3)
-> IndList (2 - 1) Ind3 -> IndList 2 Ind3
forall a b. (a -> b) -> a -> b
$ Ind3 -> IndList 1 Ind3
forall a. a -> IndList 1 a
singletonInd (Ind3 -> IndList 1 Ind3) -> Ind3 -> IndList 1 Ind3
forall a b. (a -> b) -> a -> b
$ Int -> Ind3
Ind3 Int
c) | Int
a <- [Int
0..Int
9], Int
b <- [Int
0..Int
3], Int
c <- [Int
0..Int
3]]
            f :: (a, b, IndList 1 Ind9, d, e, IndList 2 Ind3) -> p
f (a
_, b
_, IndList 1 Ind9
ind1, d
_, e
_, IndList 2 Ind3
ind2)
                | IndList 1 Ind9
ind1 IndList 1 Ind9 -> IndList 1 Ind9 -> Bool
forall a. Eq a => a -> a -> Bool
== Map (IndList 2 Ind3) (IndList 1 Ind9)
-> IndList 2 Ind3 -> IndList 1 Ind9
forall k a. Ord k => Map k a -> k -> a
(M.!) Map (IndList 2 Ind3) (IndList 1 Ind9)
trian2 (IndList 2 Ind3 -> IndList 2 Ind3
forall a (n :: Nat). (Ord a, Eq a) => IndList n a -> IndList n a
sortInd IndList 2 Ind3
ind2) = p
1
                | Bool
otherwise = p
0

-- | The tensor \(J_I^{ab} \) maps between covariant @'Ind9'@ indices and pairs of covariant @'Ind3'@ indices.
interJ2 :: ATens 0 0 0 1 2 0 (SField Rational)
interJ2 :: ATens 0 0 0 1 2 0 (SField Rational)
interJ2 = [(IndTuple6 0 0 0 1 2 0 Ind20 Ind9 Ind3, SField Rational)]
-> ATens 0 0 0 1 2 0 (SField Rational)
forall k1 k2 k3 v (n1 :: Nat) (n2 :: Nat) (n3 :: Nat) (n4 :: Nat)
       (n5 :: Nat) (n6 :: Nat).
(TIndex k1, TIndex k2, TIndex k3, TAdd v) =>
[(IndTuple6 n1 n2 n3 n4 n5 n6 k1 k2 k3, v)]
-> AbsTensor6 n1 n2 n3 n4 n5 n6 k1 k2 k3 v
fromListT6 ([(IndTuple6 0 0 0 1 2 0 Ind20 Ind9 Ind3, SField Rational)]
 -> ATens 0 0 0 1 2 0 (SField Rational))
-> [(IndTuple6 0 0 0 1 2 0 Ind20 Ind9 Ind3, SField Rational)]
-> ATens 0 0 0 1 2 0 (SField Rational)
forall a b. (a -> b) -> a -> b
$ ((IndTuple6 0 0 0 1 2 0 Ind20 Ind9 Ind3, Rational)
 -> (IndTuple6 0 0 0 1 2 0 Ind20 Ind9 Ind3, SField Rational))
-> [(IndTuple6 0 0 0 1 2 0 Ind20 Ind9 Ind3, Rational)]
-> [(IndTuple6 0 0 0 1 2 0 Ind20 Ind9 Ind3, SField Rational)]
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap ((Rational -> SField Rational)
-> (IndTuple6 0 0 0 1 2 0 Ind20 Ind9 Ind3, Rational)
-> (IndTuple6 0 0 0 1 2 0 Ind20 Ind9 Ind3, SField Rational)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap Rational -> SField Rational
forall a. a -> SField a
SField) ([(IndTuple6 0 0 0 1 2 0 Ind20 Ind9 Ind3, Rational)]
 -> [(IndTuple6 0 0 0 1 2 0 Ind20 Ind9 Ind3, SField Rational)])
-> [(IndTuple6 0 0 0 1 2 0 Ind20 Ind9 Ind3, Rational)]
-> [(IndTuple6 0 0 0 1 2 0 Ind20 Ind9 Ind3, SField Rational)]
forall a b. (a -> b) -> a -> b
$ ((IndTuple6 0 0 0 1 2 0 Ind20 Ind9 Ind3, Rational) -> Bool)
-> [(IndTuple6 0 0 0 1 2 0 Ind20 Ind9 Ind3, Rational)]
-> [(IndTuple6 0 0 0 1 2 0 Ind20 Ind9 Ind3, Rational)]
forall a. (a -> Bool) -> [a] -> [a]
filter (\(IndTuple6 0 0 0 1 2 0 Ind20 Ind9 Ind3
_,Rational
k) -> Rational
k Rational -> Rational -> Bool
forall a. Eq a => a -> a -> Bool
/= Rational
0) ([(IndTuple6 0 0 0 1 2 0 Ind20 Ind9 Ind3, Rational)]
 -> [(IndTuple6 0 0 0 1 2 0 Ind20 Ind9 Ind3, Rational)])
-> [(IndTuple6 0 0 0 1 2 0 Ind20 Ind9 Ind3, Rational)]
-> [(IndTuple6 0 0 0 1 2 0 Ind20 Ind9 Ind3, Rational)]
forall a b. (a -> b) -> a -> b
$ (IndTuple6 0 0 0 1 2 0 Ind20 Ind9 Ind3
 -> (IndTuple6 0 0 0 1 2 0 Ind20 Ind9 Ind3, Rational))
-> [IndTuple6 0 0 0 1 2 0 Ind20 Ind9 Ind3]
-> [(IndTuple6 0 0 0 1 2 0 Ind20 Ind9 Ind3, Rational)]
forall a b. (a -> b) -> [a] -> [b]
map (\IndTuple6 0 0 0 1 2 0 Ind20 Ind9 Ind3
x -> (IndTuple6 0 0 0 1 2 0 Ind20 Ind9 Ind3
x,IndTuple6 0 0 0 1 2 0 Ind20 Ind9 Ind3 -> Rational
forall a b c f.
(a, b, c, IndList 1 Ind9, IndList 2 Ind3, f) -> Rational
f IndTuple6 0 0 0 1 2 0 Ind20 Ind9 Ind3
x)) [IndTuple6 0 0 0 1 2 0 Ind20 Ind9 Ind3]
forall a a a a.
[(IndList 0 a, IndList 0 a, IndList 0 a, IndList 1 Ind9,
  IndList 2 Ind3, IndList 0 a)]
inds
        where
            trian2 :: Map (IndList 2 Ind3) (IndList 1 Ind9)
trian2 = Map (IndList 2 Ind3) (IndList 1 Ind9)
trianMap2
            inds :: [(IndList 0 a, IndList 0 a, IndList 0 a, IndList 1 Ind9,
  IndList 2 Ind3, IndList 0 a)]
inds = [ (IndList 0 a
forall a. IndList 0 a
Empty, IndList 0 a
forall a. IndList 0 a
Empty, IndList 0 a
forall a. IndList 0 a
Empty, Ind9 -> IndList 1 Ind9
forall a. a -> IndList 1 a
singletonInd (Ind9 -> IndList 1 Ind9) -> Ind9 -> IndList 1 Ind9
forall a b. (a -> b) -> a -> b
$ Int -> Ind9
Ind9 Int
a, Ind3 -> IndList (2 - 1) Ind3 -> IndList 2 Ind3
forall a (n :: Nat). a -> IndList (n - 1) a -> IndList n a
Append (Int -> Ind3
Ind3 Int
b) (IndList (2 - 1) Ind3 -> IndList 2 Ind3)
-> IndList (2 - 1) Ind3 -> IndList 2 Ind3
forall a b. (a -> b) -> a -> b
$ Ind3 -> IndList 1 Ind3
forall a. a -> IndList 1 a
singletonInd (Ind3 -> IndList 1 Ind3) -> Ind3 -> IndList 1 Ind3
forall a b. (a -> b) -> a -> b
$ Int -> Ind3
Ind3 Int
c, IndList 0 a
forall a. IndList 0 a
Empty) | Int
a <- [Int
0..Int
9], Int
b <- [Int
0..Int
3], Int
c <- [Int
0..Int
3]]
            f :: (a, b, c, IndList 1 Ind9, IndList 2 Ind3, f) -> Rational
f (a
_, b
_, c
_, IndList 1 Ind9
ind1, IndList 2 Ind3
ind2, f
_)
                | IndList 1 Ind9
ind1 IndList 1 Ind9 -> IndList 1 Ind9 -> Bool
forall a. Eq a => a -> a -> Bool
== Map (IndList 2 Ind3) (IndList 1 Ind9)
-> IndList 2 Ind3 -> IndList 1 Ind9
forall k a. Ord k => Map k a -> k -> a
(M.!) Map (IndList 2 Ind3) (IndList 1 Ind9)
trian2 (IndList 2 Ind3 -> IndList 2 Ind3
forall a (n :: Nat). (Ord a, Eq a) => IndList n a -> IndList n a
sortInd IndList 2 Ind3
ind2) = IndList 2 Ind3 -> Rational
forall a. Eq a => IndList 2 a -> Rational
jMult2 IndList 2 Ind3
ind2
                | Bool
otherwise = Rational
0

-- | The tensor \( I^A_{abcd}\) maps between covariant @'Ind20'@ indices and blocks of @4@ of covariant @'Ind3'@ indices.
interIArea :: ATens 1 0 0 0 0 4  (SField Rational)
interIArea :: ATens 1 0 0 0 0 4 (SField Rational)
interIArea = [(IndTuple6 1 0 0 0 0 4 Ind20 Ind9 Ind3, SField Rational)]
-> ATens 1 0 0 0 0 4 (SField Rational)
forall k1 k2 k3 v (n1 :: Nat) (n2 :: Nat) (n3 :: Nat) (n4 :: Nat)
       (n5 :: Nat) (n6 :: Nat).
(TIndex k1, TIndex k2, TIndex k3, TAdd v) =>
[(IndTuple6 n1 n2 n3 n4 n5 n6 k1 k2 k3, v)]
-> AbsTensor6 n1 n2 n3 n4 n5 n6 k1 k2 k3 v
fromListT6 ([(IndTuple6 1 0 0 0 0 4 Ind20 Ind9 Ind3, SField Rational)]
 -> ATens 1 0 0 0 0 4 (SField Rational))
-> [(IndTuple6 1 0 0 0 0 4 Ind20 Ind9 Ind3, SField Rational)]
-> ATens 1 0 0 0 0 4 (SField Rational)
forall a b. (a -> b) -> a -> b
$ ((IndTuple6 1 0 0 0 0 4 Ind20 Ind9 Ind3, Rational)
 -> (IndTuple6 1 0 0 0 0 4 Ind20 Ind9 Ind3, SField Rational))
-> [(IndTuple6 1 0 0 0 0 4 Ind20 Ind9 Ind3, Rational)]
-> [(IndTuple6 1 0 0 0 0 4 Ind20 Ind9 Ind3, SField Rational)]
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap ((Rational -> SField Rational)
-> (IndTuple6 1 0 0 0 0 4 Ind20 Ind9 Ind3, Rational)
-> (IndTuple6 1 0 0 0 0 4 Ind20 Ind9 Ind3, SField Rational)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap Rational -> SField Rational
forall a. a -> SField a
SField) ([(IndTuple6 1 0 0 0 0 4 Ind20 Ind9 Ind3, Rational)]
 -> [(IndTuple6 1 0 0 0 0 4 Ind20 Ind9 Ind3, SField Rational)])
-> [(IndTuple6 1 0 0 0 0 4 Ind20 Ind9 Ind3, Rational)]
-> [(IndTuple6 1 0 0 0 0 4 Ind20 Ind9 Ind3, SField Rational)]
forall a b. (a -> b) -> a -> b
$ ((IndTuple6 1 0 0 0 0 4 Ind20 Ind9 Ind3, Rational) -> Bool)
-> [(IndTuple6 1 0 0 0 0 4 Ind20 Ind9 Ind3, Rational)]
-> [(IndTuple6 1 0 0 0 0 4 Ind20 Ind9 Ind3, Rational)]
forall a. (a -> Bool) -> [a] -> [a]
filter (\(IndTuple6 1 0 0 0 0 4 Ind20 Ind9 Ind3
_,Rational
k) -> Rational
k Rational -> Rational -> Bool
forall a. Eq a => a -> a -> Bool
/= Rational
0) ([(IndTuple6 1 0 0 0 0 4 Ind20 Ind9 Ind3, Rational)]
 -> [(IndTuple6 1 0 0 0 0 4 Ind20 Ind9 Ind3, Rational)])
-> [(IndTuple6 1 0 0 0 0 4 Ind20 Ind9 Ind3, Rational)]
-> [(IndTuple6 1 0 0 0 0 4 Ind20 Ind9 Ind3, Rational)]
forall a b. (a -> b) -> a -> b
$ (IndTuple6 1 0 0 0 0 4 Ind20 Ind9 Ind3
 -> (IndTuple6 1 0 0 0 0 4 Ind20 Ind9 Ind3, Rational))
-> [IndTuple6 1 0 0 0 0 4 Ind20 Ind9 Ind3]
-> [(IndTuple6 1 0 0 0 0 4 Ind20 Ind9 Ind3, Rational)]
forall a b. (a -> b) -> [a] -> [b]
map (\IndTuple6 1 0 0 0 0 4 Ind20 Ind9 Ind3
x -> (IndTuple6 1 0 0 0 0 4 Ind20 Ind9 Ind3
x,IndTuple6 1 0 0 0 0 4 Ind20 Ind9 Ind3 -> Rational
forall b c d e.
(IndList 1 Ind20, b, c, d, e, IndList 4 Ind3) -> Rational
f IndTuple6 1 0 0 0 0 4 Ind20 Ind9 Ind3
x)) [IndTuple6 1 0 0 0 0 4 Ind20 Ind9 Ind3]
forall a a a a.
[(IndList 1 Ind20, IndList 0 a, IndList 0 a, IndList 0 a,
  IndList 0 a, IndList 4 Ind3)]
inds
        where
            trianArea :: Map (IndList 4 Ind3) (IndList 1 Ind20)
trianArea = Map (IndList 4 Ind3) (IndList 1 Ind20)
trianMapArea
            inds :: [(IndList 1 Ind20, IndList 0 a, IndList 0 a, IndList 0 a,
  IndList 0 a, IndList 4 Ind3)]
inds = [ (Ind20 -> IndList 1 Ind20
forall a. a -> IndList 1 a
singletonInd (Int -> Ind20
Ind20 Int
a), IndList 0 a
forall a. IndList 0 a
Empty, IndList 0 a
forall a. IndList 0 a
Empty, IndList 0 a
forall a. IndList 0 a
Empty, IndList 0 a
forall a. IndList 0 a
Empty, Ind3 -> IndList (4 - 1) Ind3 -> IndList 4 Ind3
forall a (n :: Nat). a -> IndList (n - 1) a -> IndList n a
Append (Int -> Ind3
Ind3 Int
b) (IndList (4 - 1) Ind3 -> IndList 4 Ind3)
-> IndList (4 - 1) Ind3 -> IndList 4 Ind3
forall a b. (a -> b) -> a -> b
$ Ind3 -> IndList (3 - 1) Ind3 -> IndList 3 Ind3
forall a (n :: Nat). a -> IndList (n - 1) a -> IndList n a
Append (Int -> Ind3
Ind3 Int
c) (IndList (3 - 1) Ind3 -> IndList 3 Ind3)
-> IndList (3 - 1) Ind3 -> IndList 3 Ind3
forall a b. (a -> b) -> a -> b
$ Ind3 -> IndList (2 - 1) Ind3 -> IndList 2 Ind3
forall a (n :: Nat). a -> IndList (n - 1) a -> IndList n a
Append (Int -> Ind3
Ind3 Int
d) (IndList (2 - 1) Ind3 -> IndList 2 Ind3)
-> IndList (2 - 1) Ind3 -> IndList 2 Ind3
forall a b. (a -> b) -> a -> b
$ Ind3 -> IndList 1 Ind3
forall a. a -> IndList 1 a
singletonInd (Ind3 -> IndList 1 Ind3) -> Ind3 -> IndList 1 Ind3
forall a b. (a -> b) -> a -> b
$ Int -> Ind3
Ind3 Int
e) | Int
a <- [Int
0..Int
20], Int
b <- [Int
0..Int
3], Int
c <- [Int
0..Int
3], Int
d <- [Int
0..Int
3], Int
e <- [Int
0..Int
3], Bool -> Bool
not (Int
b Int -> Int -> Bool
forall a. Eq a => a -> a -> Bool
== Int
c Bool -> Bool -> Bool
|| Int
d Int -> Int -> Bool
forall a. Eq a => a -> a -> Bool
== Int
e)]
            f :: (IndList 1 Ind20, b, c, d, e, IndList 4 Ind3) -> Rational
f (IndList 1 Ind20
ind1, b
_, c
_, d
_, e
_, IndList 4 Ind3
ind2)
                | IndList 1 Ind20
ind1 IndList 1 Ind20 -> IndList 1 Ind20 -> Bool
forall a. Eq a => a -> a -> Bool
== Map (IndList 4 Ind3) (IndList 1 Ind20)
-> IndList 4 Ind3 -> IndList 1 Ind20
forall k a. Ord k => Map k a -> k -> a
(M.!) Map (IndList 4 Ind3) (IndList 1 Ind20)
trianArea IndList 4 Ind3
indArea = Rational
s
                | Bool
otherwise = Rational
0
                    where
                        (IndList 4 Ind3
indArea, Rational
s) = IndList 4 Ind3 -> (IndList 4 Ind3, Rational)
forall a. (Eq a, Ord a) => IndList 4 a -> (IndList 4 a, Rational)
canonicalizeArea IndList 4 Ind3
ind2

-- | The tensor \( J_A^{abcd}\) maps between contravariant @'Ind20'@ indices and blocks of @4@ of contravariant @'Ind3'@ indices.
interJArea :: ATens 0 1 0 0 4 0 (SField Rational)
interJArea :: ATens 0 1 0 0 4 0 (SField Rational)
interJArea = [(IndTuple6 0 1 0 0 4 0 Ind20 Ind9 Ind3, SField Rational)]
-> ATens 0 1 0 0 4 0 (SField Rational)
forall k1 k2 k3 v (n1 :: Nat) (n2 :: Nat) (n3 :: Nat) (n4 :: Nat)
       (n5 :: Nat) (n6 :: Nat).
(TIndex k1, TIndex k2, TIndex k3, TAdd v) =>
[(IndTuple6 n1 n2 n3 n4 n5 n6 k1 k2 k3, v)]
-> AbsTensor6 n1 n2 n3 n4 n5 n6 k1 k2 k3 v
fromListT6 ([(IndTuple6 0 1 0 0 4 0 Ind20 Ind9 Ind3, SField Rational)]
 -> ATens 0 1 0 0 4 0 (SField Rational))
-> [(IndTuple6 0 1 0 0 4 0 Ind20 Ind9 Ind3, SField Rational)]
-> ATens 0 1 0 0 4 0 (SField Rational)
forall a b. (a -> b) -> a -> b
$ ((IndTuple6 0 1 0 0 4 0 Ind20 Ind9 Ind3, Rational)
 -> (IndTuple6 0 1 0 0 4 0 Ind20 Ind9 Ind3, SField Rational))
-> [(IndTuple6 0 1 0 0 4 0 Ind20 Ind9 Ind3, Rational)]
-> [(IndTuple6 0 1 0 0 4 0 Ind20 Ind9 Ind3, SField Rational)]
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap ((Rational -> SField Rational)
-> (IndTuple6 0 1 0 0 4 0 Ind20 Ind9 Ind3, Rational)
-> (IndTuple6 0 1 0 0 4 0 Ind20 Ind9 Ind3, SField Rational)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap Rational -> SField Rational
forall a. a -> SField a
SField) ([(IndTuple6 0 1 0 0 4 0 Ind20 Ind9 Ind3, Rational)]
 -> [(IndTuple6 0 1 0 0 4 0 Ind20 Ind9 Ind3, SField Rational)])
-> [(IndTuple6 0 1 0 0 4 0 Ind20 Ind9 Ind3, Rational)]
-> [(IndTuple6 0 1 0 0 4 0 Ind20 Ind9 Ind3, SField Rational)]
forall a b. (a -> b) -> a -> b
$ ((IndTuple6 0 1 0 0 4 0 Ind20 Ind9 Ind3, Rational) -> Bool)
-> [(IndTuple6 0 1 0 0 4 0 Ind20 Ind9 Ind3, Rational)]
-> [(IndTuple6 0 1 0 0 4 0 Ind20 Ind9 Ind3, Rational)]
forall a. (a -> Bool) -> [a] -> [a]
filter (\(IndTuple6 0 1 0 0 4 0 Ind20 Ind9 Ind3
_,Rational
k) -> Rational
k Rational -> Rational -> Bool
forall a. Eq a => a -> a -> Bool
/= Rational
0) ([(IndTuple6 0 1 0 0 4 0 Ind20 Ind9 Ind3, Rational)]
 -> [(IndTuple6 0 1 0 0 4 0 Ind20 Ind9 Ind3, Rational)])
-> [(IndTuple6 0 1 0 0 4 0 Ind20 Ind9 Ind3, Rational)]
-> [(IndTuple6 0 1 0 0 4 0 Ind20 Ind9 Ind3, Rational)]
forall a b. (a -> b) -> a -> b
$ (IndTuple6 0 1 0 0 4 0 Ind20 Ind9 Ind3
 -> (IndTuple6 0 1 0 0 4 0 Ind20 Ind9 Ind3, Rational))
-> [IndTuple6 0 1 0 0 4 0 Ind20 Ind9 Ind3]
-> [(IndTuple6 0 1 0 0 4 0 Ind20 Ind9 Ind3, Rational)]
forall a b. (a -> b) -> [a] -> [b]
map (\IndTuple6 0 1 0 0 4 0 Ind20 Ind9 Ind3
x -> (IndTuple6 0 1 0 0 4 0 Ind20 Ind9 Ind3
x,IndTuple6 0 1 0 0 4 0 Ind20 Ind9 Ind3 -> Rational
forall a c d f.
(a, IndList 1 Ind20, c, d, IndList 4 Ind3, f) -> Rational
f IndTuple6 0 1 0 0 4 0 Ind20 Ind9 Ind3
x)) [IndTuple6 0 1 0 0 4 0 Ind20 Ind9 Ind3]
forall a a a a.
[(IndList 0 a, IndList 1 Ind20, IndList 0 a, IndList 0 a,
  IndList 4 Ind3, IndList 0 a)]
inds
        where
            trianArea :: Map (IndList 4 Ind3) (IndList 1 Ind20)
trianArea = Map (IndList 4 Ind3) (IndList 1 Ind20)
trianMapArea
            inds :: [(IndList 0 a, IndList 1 Ind20, IndList 0 a, IndList 0 a,
  IndList 4 Ind3, IndList 0 a)]
inds = [  (IndList 0 a
forall a. IndList 0 a
Empty, Ind20 -> IndList 1 Ind20
forall a. a -> IndList 1 a
singletonInd (Ind20 -> IndList 1 Ind20) -> Ind20 -> IndList 1 Ind20
forall a b. (a -> b) -> a -> b
$ Int -> Ind20
Ind20 Int
a, IndList 0 a
forall a. IndList 0 a
Empty, IndList 0 a
forall a. IndList 0 a
Empty, Ind3 -> IndList (4 - 1) Ind3 -> IndList 4 Ind3
forall a (n :: Nat). a -> IndList (n - 1) a -> IndList n a
Append (Int -> Ind3
Ind3 Int
b) (IndList (4 - 1) Ind3 -> IndList 4 Ind3)
-> IndList (4 - 1) Ind3 -> IndList 4 Ind3
forall a b. (a -> b) -> a -> b
$ Ind3 -> IndList (3 - 1) Ind3 -> IndList 3 Ind3
forall a (n :: Nat). a -> IndList (n - 1) a -> IndList n a
Append (Int -> Ind3
Ind3 Int
c) (IndList (3 - 1) Ind3 -> IndList 3 Ind3)
-> IndList (3 - 1) Ind3 -> IndList 3 Ind3
forall a b. (a -> b) -> a -> b
$ Ind3 -> IndList (2 - 1) Ind3 -> IndList 2 Ind3
forall a (n :: Nat). a -> IndList (n - 1) a -> IndList n a
Append (Int -> Ind3
Ind3 Int
d) (IndList (2 - 1) Ind3 -> IndList 2 Ind3)
-> IndList (2 - 1) Ind3 -> IndList 2 Ind3
forall a b. (a -> b) -> a -> b
$ Ind3 -> IndList 1 Ind3
forall a. a -> IndList 1 a
singletonInd (Ind3 -> IndList 1 Ind3) -> Ind3 -> IndList 1 Ind3
forall a b. (a -> b) -> a -> b
$ Int -> Ind3
Ind3 Int
e, IndList 0 a
forall a. IndList 0 a
Empty) | Int
a <- [Int
0..Int
20], Int
b <- [Int
0..Int
3], Int
c <- [Int
0..Int
3], Int
d <- [Int
0..Int
3], Int
e <- [Int
0..Int
3], Bool -> Bool
not (Int
b Int -> Int -> Bool
forall a. Eq a => a -> a -> Bool
== Int
c Bool -> Bool -> Bool
|| Int
d Int -> Int -> Bool
forall a. Eq a => a -> a -> Bool
== Int
e)]
            f :: (a, IndList 1 Ind20, c, d, IndList 4 Ind3, f) -> Rational
f (a
_, IndList 1 Ind20
ind1, c
_, d
_, IndList 4 Ind3
ind2, f
_)
                | IndList 1 Ind20
ind1 IndList 1 Ind20 -> IndList 1 Ind20 -> Bool
forall a. Eq a => a -> a -> Bool
== Map (IndList 4 Ind3) (IndList 1 Ind20)
-> IndList 4 Ind3 -> IndList 1 Ind20
forall k a. Ord k => Map k a -> k -> a
(M.!) Map (IndList 4 Ind3) (IndList 1 Ind20)
trianArea IndList 4 Ind3
indArea = Rational
s Rational -> Rational -> Rational
forall a. Num a => a -> a -> a
* IndList 4 Ind3 -> Rational
forall a. Eq a => IndList 4 a -> Rational
jMultArea IndList 4 Ind3
indArea
                | Bool
otherwise = Rational
0
                    where
                        (IndList 4 Ind3
indArea, Rational
s) = IndList 4 Ind3 -> (IndList 4 Ind3, Rational)
forall a. (Eq a, Ord a) => IndList 4 a -> (IndList 4 a, Rational)
canonicalizeArea IndList 4 Ind3
ind2

-- |  Can be obtained as: \(C^{Am}_{Bn} = -4 \cdot I^A_{nbcd} J_B^{mbcd}  \)
--
-- > interArea = SField (-4 :: Rational) &. contrATens3 (1,1) (contrATens3 (2,2) $ contrATens3 (3,3) $ interIArea &* interJArea
interArea :: ATens 1 1 0 0 1 1 (SField Rational)
interArea :: ATens 1 1 0 0 1 1 (SField Rational)
interArea = Rational -> SField Rational
forall a. a -> SField a
SField (-Rational
4 :: Rational) SField Rational
-> ATens 1 1 0 0 1 1 (SField Rational)
-> Tensor
     1
     Ind20
     (TProd
        (SField Rational)
        (Tensor 1 Ind20 (Tensor2 0 0 Ind9 (STTens 1 1 (SField Rational)))))
forall k s v (n :: Nat).
(TIndex k, Prod s v) =>
s -> Tensor n k v -> Tensor n k (TProd s v)
&. (Int, Int)
-> AbsTensor6
     1 1 0 0 (1 + 1) (1 + 1) Ind20 Ind9 Ind3 (SField Rational)
-> ATens 1 1 0 0 1 1 (SField Rational)
forall k1 k2 k3 v (n1 :: Nat) (n2 :: Nat) (n3 :: Nat) (n4 :: Nat)
       (n5 :: Nat) (n6 :: Nat).
(TIndex k1, TIndex k2, TIndex k3, TAdd v) =>
(Int, Int)
-> AbsTensor6 n1 n2 n3 n4 (n5 + 1) (n6 + 1) k1 k2 k3 v
-> AbsTensor6 n1 n2 n3 n4 n5 n6 k1 k2 k3 v
contrATens3 (Int
1,Int
1) ((Int, Int)
-> AbsTensor6
     1 1 0 0 (2 + 1) (2 + 1) Ind20 Ind9 Ind3 (SField Rational)
-> AbsTensor6 1 1 0 0 2 2 Ind20 Ind9 Ind3 (SField Rational)
forall k1 k2 k3 v (n1 :: Nat) (n2 :: Nat) (n3 :: Nat) (n4 :: Nat)
       (n5 :: Nat) (n6 :: Nat).
(TIndex k1, TIndex k2, TIndex k3, TAdd v) =>
(Int, Int)
-> AbsTensor6 n1 n2 n3 n4 (n5 + 1) (n6 + 1) k1 k2 k3 v
-> AbsTensor6 n1 n2 n3 n4 n5 n6 k1 k2 k3 v
contrATens3 (Int
2,Int
2) (AbsTensor6
   1 1 0 0 (2 + 1) (2 + 1) Ind20 Ind9 Ind3 (SField Rational)
 -> AbsTensor6 1 1 0 0 2 2 Ind20 Ind9 Ind3 (SField Rational))
-> AbsTensor6
     1 1 0 0 (2 + 1) (2 + 1) Ind20 Ind9 Ind3 (SField Rational)
-> AbsTensor6 1 1 0 0 2 2 Ind20 Ind9 Ind3 (SField Rational)
forall a b. (a -> b) -> a -> b
$ (Int, Int)
-> AbsTensor6
     1 1 0 0 (3 + 1) (3 + 1) Ind20 Ind9 Ind3 (SField Rational)
-> AbsTensor6 1 1 0 0 3 3 Ind20 Ind9 Ind3 (SField Rational)
forall k1 k2 k3 v (n1 :: Nat) (n2 :: Nat) (n3 :: Nat) (n4 :: Nat)
       (n5 :: Nat) (n6 :: Nat).
(TIndex k1, TIndex k2, TIndex k3, TAdd v) =>
(Int, Int)
-> AbsTensor6 n1 n2 n3 n4 (n5 + 1) (n6 + 1) k1 k2 k3 v
-> AbsTensor6 n1 n2 n3 n4 n5 n6 k1 k2 k3 v
contrATens3 (Int
3,Int
3) (AbsTensor6
   1 1 0 0 (3 + 1) (3 + 1) Ind20 Ind9 Ind3 (SField Rational)
 -> AbsTensor6 1 1 0 0 3 3 Ind20 Ind9 Ind3 (SField Rational))
-> AbsTensor6
     1 1 0 0 (3 + 1) (3 + 1) Ind20 Ind9 Ind3 (SField Rational)
-> AbsTensor6 1 1 0 0 3 3 Ind20 Ind9 Ind3 (SField Rational)
forall a b. (a -> b) -> a -> b
$ ATens 1 0 0 0 0 4 (SField Rational)
interIArea ATens 1 0 0 0 0 4 (SField Rational)
-> ATens 0 1 0 0 4 0 (SField Rational)
-> TProd
     (ATens 1 0 0 0 0 4 (SField Rational))
     (ATens 0 1 0 0 4 0 (SField Rational))
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')
&* ATens 0 1 0 0 4 0 (SField Rational)
interJArea)

-- | Can be obtained as : \(K^{Im}_{Jn} = -2 \cdot I^I_{nb} J_J^{mb}  \)
--
-- > interMetric = SField (-2 :: Rational) &. contrATens3 (0,0) (interI2 &* interJ2)
interMetric :: ATens 0 0 1 1 1 1 (SField Rational)
interMetric :: ATens 0 0 1 1 1 1 (SField Rational)
interMetric = Rational -> SField Rational
forall a. a -> SField a
SField (-Rational
2 :: Rational) SField Rational
-> ATens 0 0 1 1 1 1 (SField Rational)
-> Tensor
     0
     Ind20
     (TProd
        (SField Rational)
        (Tensor 0 Ind20 (Tensor2 1 1 Ind9 (STTens 1 1 (SField Rational)))))
forall k s v (n :: Nat).
(TIndex k, Prod s v) =>
s -> Tensor n k v -> Tensor n k (TProd s v)
&. (Int, Int)
-> AbsTensor6
     0 0 1 1 (1 + 1) (1 + 1) Ind20 Ind9 Ind3 (SField Rational)
-> ATens 0 0 1 1 1 1 (SField Rational)
forall k1 k2 k3 v (n1 :: Nat) (n2 :: Nat) (n3 :: Nat) (n4 :: Nat)
       (n5 :: Nat) (n6 :: Nat).
(TIndex k1, TIndex k2, TIndex k3, TAdd v) =>
(Int, Int)
-> AbsTensor6 n1 n2 n3 n4 (n5 + 1) (n6 + 1) k1 k2 k3 v
-> AbsTensor6 n1 n2 n3 n4 n5 n6 k1 k2 k3 v
contrATens3 (Int
0,Int
0) (ATens 0 0 1 0 0 2 (SField Rational)
interI2 ATens 0 0 1 0 0 2 (SField Rational)
-> ATens 0 0 0 1 2 0 (SField Rational)
-> TProd
     (ATens 0 0 1 0 0 2 (SField Rational))
     (ATens 0 0 0 1 2 0 (SField Rational))
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')
&* ATens 0 0 0 1 2 0 (SField Rational)
interJ2)

-- | Is given by: \( C^m_{Bn} = C^{Am}_{Bn} N_A \)
--
-- > flatInter = contrATens1 (0,1) $ interArea &* flatArea
flatInter :: ATens 0 1 0 0 1 1 (SField Rational)
flatInter :: ATens 0 1 0 0 1 1 (SField Rational)
flatInter = (Int, Int)
-> AbsTensor2
     (0 + 1)
     (1 + 1)
     Ind20
     (Tensor2 0 0 Ind9 (STTens 1 1 (SField Rational)))
-> ATens 0 1 0 0 1 1 (SField Rational)
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) (AbsTensor2
   (0 + 1)
   (1 + 1)
   Ind20
   (Tensor2 0 0 Ind9 (STTens 1 1 (SField Rational)))
 -> ATens 0 1 0 0 1 1 (SField Rational))
-> AbsTensor2
     (0 + 1)
     (1 + 1)
     Ind20
     (Tensor2 0 0 Ind9 (STTens 1 1 (SField Rational)))
-> ATens 0 1 0 0 1 1 (SField Rational)
forall a b. (a -> b) -> a -> b
$ ATens 1 1 0 0 1 1 (SField Rational)
interArea ATens 1 1 0 0 1 1 (SField Rational)
-> ATens 0 1 0 0 0 0 (SField Rational)
-> TProd
     (ATens 1 1 0 0 1 1 (SField Rational))
     (ATens 0 1 0 0 0 0 (SField Rational))
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')
&* ATens 0 1 0 0 0 0 (SField Rational)
flatArea

-- | Is given by: \( K^m_{Jn} = K^{Im}_{Jn} \eta_I\)
--
-- > flatInterMetric = contrATens2 (0,1) $ interMetric &* etaAbs
flatInterMetric :: ATens 0 0 0 1 1 1 (SField Rational)
flatInterMetric :: ATens 0 0 0 1 1 1 (SField Rational)
flatInterMetric = (Int, Int)
-> AbsTensor4
     0 0 (0 + 1) (1 + 1) Ind20 Ind9 (STTens 1 1 (SField Rational))
-> ATens 0 0 0 1 1 1 (SField Rational)
forall k1 k2 v (n1 :: Nat) (n2 :: Nat) (n3 :: Nat) (n4 :: Nat).
(TIndex k1, TIndex k2, TAdd v) =>
(Int, Int)
-> AbsTensor4 n1 n2 (n3 + 1) (n4 + 1) k1 k2 v
-> AbsTensor4 n1 n2 n3 n4 k1 k2 v
contrATens2 (Int
0,Int
1) (AbsTensor4
   0 0 (0 + 1) (1 + 1) Ind20 Ind9 (STTens 1 1 (SField Rational))
 -> ATens 0 0 0 1 1 1 (SField Rational))
-> AbsTensor4
     0 0 (0 + 1) (1 + 1) Ind20 Ind9 (STTens 1 1 (SField Rational))
-> ATens 0 0 0 1 1 1 (SField Rational)
forall a b. (a -> b) -> a -> b
$ ATens 0 0 1 1 1 1 (SField Rational)
interMetric ATens 0 0 1 1 1 1 (SField Rational)
-> ATens 0 0 0 1 0 0 (SField Rational)
-> TProd
     (ATens 0 0 1 1 1 1 (SField Rational))
     (ATens 0 0 0 1 0 0 (SField Rational))
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')
&* ATens 0 0 0 1 0 0 (SField Rational)
etaAbs

-- | Is given by: \(  C_{An}^{Bm} \delta_p^q - \delta_A^B \delta_p^m \delta_n^q \)
interEqn2 :: ATens 1 1 0 0 2 2 (SField Rational)
interEqn2 :: AbsTensor6 1 1 0 0 2 2 Ind20 Ind9 Ind3 (SField Rational)
interEqn2 = AbsTensor6 1 1 0 0 2 2 Ind20 Ind9 Ind3 (SField Rational)
int1 AbsTensor6 1 1 0 0 2 2 Ind20 Ind9 Ind3 (SField Rational)
-> AbsTensor6 1 1 0 0 2 2 Ind20 Ind9 Ind3 (SField Rational)
-> AbsTensor6 1 1 0 0 2 2 Ind20 Ind9 Ind3 (SField Rational)
forall k v (n :: Nat).
(TIndex k, TAdd v) =>
Tensor n k v -> Tensor n k v -> Tensor n k v
&- AbsTensor6 1 1 0 0 2 2 Ind20 Ind9 Ind3 (SField Rational)
int2
        where
            int1 :: TProd
  (ATens 1 1 0 0 1 1 (SField Rational))
  (ATens 0 0 0 0 1 1 (SField Rational))
int1 = ATens 1 1 0 0 1 1 (SField Rational)
interArea ATens 1 1 0 0 1 1 (SField Rational)
-> ATens 0 0 0 0 1 1 (SField Rational)
-> TProd
     (ATens 1 1 0 0 1 1 (SField Rational))
     (ATens 0 0 0 0 1 1 (SField Rational))
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')
&* ATens 0 0 0 0 1 1 (SField Rational)
delta3A
            int2 :: TProd
  (Tensor
     0
     Ind20
     (Tensor
        0 Ind20 (Tensor2 0 0 Ind9 (Tensor2 2 2 Ind3 (SField Rational)))))
  (ATens 1 1 0 0 0 0 (SField Rational))
int2 = (Int, Int)
-> Tensor
     0
     Ind20
     (Tensor
        0 Ind20 (Tensor2 0 0 Ind9 (Tensor2 2 2 Ind3 (SField Rational))))
-> Tensor
     0
     Ind20
     (Tensor
        0 Ind20 (Tensor2 0 0 Ind9 (Tensor2 2 2 Ind3 (SField Rational))))
forall k1 k2 k3 v (n1 :: Nat) (n2 :: Nat) (n3 :: Nat) (n4 :: Nat)
       (n5 :: Nat) (n6 :: Nat).
(TIndex k1, TIndex k2, TIndex k3, TAdd v) =>
(Int, Int)
-> AbsTensor6 n1 n2 n3 n4 n5 n6 k1 k2 k3 v
-> AbsTensor6 n1 n2 n3 n4 n5 n6 k1 k2 k3 v
tensorTrans6 (Int
0,Int
1) (ATens 0 0 0 0 1 1 (SField Rational)
delta3A ATens 0 0 0 0 1 1 (SField Rational)
-> ATens 0 0 0 0 1 1 (SField Rational)
-> TProd
     (ATens 0 0 0 0 1 1 (SField Rational))
     (ATens 0 0 0 0 1 1 (SField Rational))
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')
&* ATens 0 0 0 0 1 1 (SField Rational)
delta3A) Tensor
  0
  Ind20
  (Tensor
     0 Ind20 (Tensor2 0 0 Ind9 (Tensor2 2 2 Ind3 (SField Rational))))
-> ATens 1 1 0 0 0 0 (SField Rational)
-> TProd
     (Tensor
        0
        Ind20
        (Tensor
           0 Ind20 (Tensor2 0 0 Ind9 (Tensor2 2 2 Ind3 (SField Rational)))))
     (ATens 1 1 0 0 0 0 (SField Rational))
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')
&* ATens 1 1 0 0 0 0 (SField Rational)
delta20

-- | Is given by: \(  K_{In}^{Jm} \delta_p^q - \delta_I^J \delta_p^m \delta_n^q \)
interEqn2Metric :: ATens 0 0 1 1 2 2 (SField Rational)
interEqn2Metric :: ATens 0 0 1 1 2 2 (SField Rational)
interEqn2Metric = ATens 0 0 1 1 2 2 (SField Rational)
int1 ATens 0 0 1 1 2 2 (SField Rational)
-> ATens 0 0 1 1 2 2 (SField Rational)
-> ATens 0 0 1 1 2 2 (SField Rational)
forall k v (n :: Nat).
(TIndex k, TAdd v) =>
Tensor n k v -> Tensor n k v -> Tensor n k v
&- ATens 0 0 1 1 2 2 (SField Rational)
int2
        where
            int1 :: TProd
  (ATens 0 0 1 1 1 1 (SField Rational))
  (ATens 0 0 0 0 1 1 (SField Rational))
int1 = ATens 0 0 1 1 1 1 (SField Rational)
interMetric ATens 0 0 1 1 1 1 (SField Rational)
-> ATens 0 0 0 0 1 1 (SField Rational)
-> TProd
     (ATens 0 0 1 1 1 1 (SField Rational))
     (ATens 0 0 0 0 1 1 (SField Rational))
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')
&* ATens 0 0 0 0 1 1 (SField Rational)
delta3A
            int2 :: TProd
  (Tensor
     0
     Ind20
     (Tensor
        0 Ind20 (Tensor2 0 0 Ind9 (Tensor2 2 2 Ind3 (SField Rational)))))
  (ATens 0 0 1 1 0 0 (SField Rational))
int2 = (Int, Int)
-> Tensor
     0
     Ind20
     (Tensor
        0 Ind20 (Tensor2 0 0 Ind9 (Tensor2 2 2 Ind3 (SField Rational))))
-> Tensor
     0
     Ind20
     (Tensor
        0 Ind20 (Tensor2 0 0 Ind9 (Tensor2 2 2 Ind3 (SField Rational))))
forall k1 k2 k3 v (n1 :: Nat) (n2 :: Nat) (n3 :: Nat) (n4 :: Nat)
       (n5 :: Nat) (n6 :: Nat).
(TIndex k1, TIndex k2, TIndex k3, TAdd v) =>
(Int, Int)
-> AbsTensor6 n1 n2 n3 n4 n5 n6 k1 k2 k3 v
-> AbsTensor6 n1 n2 n3 n4 n5 n6 k1 k2 k3 v
tensorTrans6 (Int
0,Int
1) (ATens 0 0 0 0 1 1 (SField Rational)
delta3A ATens 0 0 0 0 1 1 (SField Rational)
-> ATens 0 0 0 0 1 1 (SField Rational)
-> TProd
     (ATens 0 0 0 0 1 1 (SField Rational))
     (ATens 0 0 0 0 1 1 (SField Rational))
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')
&* ATens 0 0 0 0 1 1 (SField Rational)
delta3A) Tensor
  0
  Ind20
  (Tensor
     0 Ind20 (Tensor2 0 0 Ind9 (Tensor2 2 2 Ind3 (SField Rational))))
-> ATens 0 0 1 1 0 0 (SField Rational)
-> TProd
     (Tensor
        0
        Ind20
        (Tensor
           0 Ind20 (Tensor2 0 0 Ind9 (Tensor2 2 2 Ind3 (SField Rational)))))
     (ATens 0 0 1 1 0 0 (SField Rational))
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')
&* ATens 0 0 1 1 0 0 (SField Rational)
delta9

-- | Is given by: \(  C_{An}^{Bm} \delta_I^J + \delta_A^B K^{Im}_{Jn}\)
interEqn3 :: ATens 1 1 1 1 1 1 (SField Rational)
interEqn3 :: ATens 1 1 1 1 1 1 (SField Rational)
interEqn3 = ATens 1 1 1 1 1 1 (SField Rational)
int1 ATens 1 1 1 1 1 1 (SField Rational)
-> ATens 1 1 1 1 1 1 (SField Rational)
-> ATens 1 1 1 1 1 1 (SField Rational)
forall k v (n :: Nat).
(TIndex k, TAdd v) =>
Tensor n k v -> Tensor n k v -> Tensor n k v
&+ ATens 1 1 1 1 1 1 (SField Rational)
int2
        where
            int1 :: TProd
  (ATens 1 1 0 0 1 1 (SField Rational))
  (ATens 0 0 1 1 0 0 (SField Rational))
int1 = ATens 1 1 0 0 1 1 (SField Rational)
interArea ATens 1 1 0 0 1 1 (SField Rational)
-> ATens 0 0 1 1 0 0 (SField Rational)
-> TProd
     (ATens 1 1 0 0 1 1 (SField Rational))
     (ATens 0 0 1 1 0 0 (SField Rational))
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')
&* ATens 0 0 1 1 0 0 (SField Rational)
delta9
            int2 :: TProd
  (ATens 0 0 1 1 1 1 (SField Rational))
  (ATens 1 1 0 0 0 0 (SField Rational))
int2 = ATens 0 0 1 1 1 1 (SField Rational)
interMetric ATens 0 0 1 1 1 1 (SField Rational)
-> ATens 1 1 0 0 0 0 (SField Rational)
-> TProd
     (ATens 0 0 1 1 1 1 (SField Rational))
     (ATens 1 1 0 0 0 0 (SField Rational))
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')
&* ATens 1 1 0 0 0 0 (SField Rational)
delta20

-- | Is given by: \(  K_{In}^{Jm} \delta_K^L + \delta_I^J K^{Km}_{Ln}\)
interEqn3Metric :: ATens 0 0 2 2 1 1 (SField Rational)
interEqn3Metric :: ATens 0 0 2 2 1 1 (SField Rational)
interEqn3Metric = ATens 0 0 2 2 1 1 (SField Rational)
int1 ATens 0 0 2 2 1 1 (SField Rational)
-> ATens 0 0 2 2 1 1 (SField Rational)
-> ATens 0 0 2 2 1 1 (SField Rational)
forall k v (n :: Nat).
(TIndex k, TAdd v) =>
Tensor n k v -> Tensor n k v -> Tensor n k v
&+ ATens 0 0 2 2 1 1 (SField Rational)
int2
        where
            int1 :: TProd
  (ATens 0 0 1 1 1 1 (SField Rational))
  (ATens 0 0 1 1 0 0 (SField Rational))
int1 = ATens 0 0 1 1 1 1 (SField Rational)
interMetric ATens 0 0 1 1 1 1 (SField Rational)
-> ATens 0 0 1 1 0 0 (SField Rational)
-> TProd
     (ATens 0 0 1 1 1 1 (SField Rational))
     (ATens 0 0 1 1 0 0 (SField Rational))
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')
&* ATens 0 0 1 1 0 0 (SField Rational)
delta9
            int2 :: TProd
  (ATens 0 0 1 1 0 0 (SField Rational))
  (ATens 0 0 1 1 1 1 (SField Rational))
int2 = ATens 0 0 1 1 0 0 (SField Rational)
delta9 ATens 0 0 1 1 0 0 (SField Rational)
-> ATens 0 0 1 1 1 1 (SField Rational)
-> TProd
     (ATens 0 0 1 1 0 0 (SField Rational))
     (ATens 0 0 1 1 1 1 (SField Rational))
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')
&* ATens 0 0 1 1 1 1 (SField Rational)
interMetric

-- | Is given by: \( C_{An}^{B(m\vert} 2 J_I^{\vert p) q} - \delta^B_A J_I ^{pm} \delta_n^q  \)
interEqn4 :: ATens 1 1 0 1 3 1 (SField Rational)
interEqn4 :: ATens 1 1 0 1 3 1 (SField Rational)
interEqn4 = ATens 1 1 0 1 3 1 (SField Rational)
block1 ATens 1 1 0 1 3 1 (SField Rational)
-> ATens 1 1 0 1 3 1 (SField Rational)
-> ATens 1 1 0 1 3 1 (SField Rational)
forall k v (n :: Nat).
(TIndex k, TAdd v) =>
Tensor n k v -> Tensor n k v -> Tensor n k v
&- ATens 1 1 0 1 3 1 (SField Rational)
block2
        where
            block1' :: TProd
  (ATens 0 0 0 1 2 0 (SField Rational))
  (ATens 1 1 0 0 1 1 (SField Rational))
block1' = ATens 0 0 0 1 2 0 (SField Rational)
interJ2 ATens 0 0 0 1 2 0 (SField Rational)
-> ATens 1 1 0 0 1 1 (SField Rational)
-> TProd
     (ATens 0 0 0 1 2 0 (SField Rational))
     (ATens 1 1 0 0 1 1 (SField Rational))
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')
&* ATens 1 1 0 0 1 1 (SField Rational)
interArea
            block1 :: ATens 1 1 0 1 3 1 (SField Rational)
block1 = ATens 1 1 0 1 3 1 (SField Rational)
block1' ATens 1 1 0 1 3 1 (SField Rational)
-> ATens 1 1 0 1 3 1 (SField Rational)
-> ATens 1 1 0 1 3 1 (SField Rational)
forall k v (n :: Nat).
(TIndex k, TAdd v) =>
Tensor n k v -> Tensor n k v -> Tensor n k v
&+ (Int, Int)
-> ATens 1 1 0 1 3 1 (SField Rational)
-> ATens 1 1 0 1 3 1 (SField Rational)
forall k1 k2 k3 v (n1 :: Nat) (n2 :: Nat) (n3 :: Nat) (n4 :: Nat)
       (n5 :: Nat).
(TIndex k1, TIndex k2, TIndex k3, TAdd v) =>
(Int, Int)
-> AbsTensor5 n1 n2 n3 n4 n5 k1 k2 k3 v
-> AbsTensor5 n1 n2 n3 n4 n5 k1 k2 k3 v
tensorTrans5 (Int
1,Int
2) ATens 1 1 0 1 3 1 (SField Rational)
block1'
            block2 :: TProd
  (ATens 1 1 0 0 1 1 (SField Rational))
  (ATens 0 0 0 1 2 0 (SField Rational))
block2 = ATens 1 1 0 0 0 0 (SField Rational)
delta20 ATens 1 1 0 0 0 0 (SField Rational)
-> ATens 0 0 0 0 1 1 (SField Rational)
-> TProd
     (ATens 1 1 0 0 0 0 (SField Rational))
     (ATens 0 0 0 0 1 1 (SField Rational))
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')
&* ATens 0 0 0 0 1 1 (SField Rational)
delta3A ATens 1 1 0 0 1 1 (SField Rational)
-> ATens 0 0 0 1 2 0 (SField Rational)
-> TProd
     (ATens 1 1 0 0 1 1 (SField Rational))
     (ATens 0 0 0 1 2 0 (SField Rational))
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')
&* ATens 0 0 0 1 2 0 (SField Rational)
interJ2

-- | Is given by: \( K_{In}^{J(m\vert} 2 J_L^{\vert p) q} - \delta^I_J J_L ^{pm} \delta_n^q  \)
interEqn4Metric :: ATens 0 0 1 2 3 1 (SField Rational)
interEqn4Metric :: ATens 0 0 1 2 3 1 (SField Rational)
interEqn4Metric = ATens 0 0 1 2 3 1 (SField Rational)
block1 ATens 0 0 1 2 3 1 (SField Rational)
-> ATens 0 0 1 2 3 1 (SField Rational)
-> ATens 0 0 1 2 3 1 (SField Rational)
forall k v (n :: Nat).
(TIndex k, TAdd v) =>
Tensor n k v -> Tensor n k v -> Tensor n k v
&- ATens 0 0 1 2 3 1 (SField Rational)
block2
        where
            block1' :: TProd
  (ATens 0 0 0 1 2 0 (SField Rational))
  (ATens 0 0 1 1 1 1 (SField Rational))
block1' = ATens 0 0 0 1 2 0 (SField Rational)
interJ2 ATens 0 0 0 1 2 0 (SField Rational)
-> ATens 0 0 1 1 1 1 (SField Rational)
-> TProd
     (ATens 0 0 0 1 2 0 (SField Rational))
     (ATens 0 0 1 1 1 1 (SField Rational))
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')
&* ATens 0 0 1 1 1 1 (SField Rational)
interMetric
            block1 :: ATens 0 0 1 2 3 1 (SField Rational)
block1 = ATens 0 0 1 2 3 1 (SField Rational)
block1' ATens 0 0 1 2 3 1 (SField Rational)
-> ATens 0 0 1 2 3 1 (SField Rational)
-> ATens 0 0 1 2 3 1 (SField Rational)
forall k v (n :: Nat).
(TIndex k, TAdd v) =>
Tensor n k v -> Tensor n k v -> Tensor n k v
&+ (Int, Int)
-> ATens 0 0 1 2 3 1 (SField Rational)
-> ATens 0 0 1 2 3 1 (SField Rational)
forall k1 k2 k3 v (n1 :: Nat) (n2 :: Nat) (n3 :: Nat) (n4 :: Nat)
       (n5 :: Nat).
(TIndex k1, TIndex k2, TIndex k3, TAdd v) =>
(Int, Int)
-> AbsTensor5 n1 n2 n3 n4 n5 k1 k2 k3 v
-> AbsTensor5 n1 n2 n3 n4 n5 k1 k2 k3 v
tensorTrans5 (Int
1,Int
2) ATens 0 0 1 2 3 1 (SField Rational)
block1'
            block2 :: TProd
  (Tensor
     0
     Ind20
     (Tensor
        0
        Ind20
        (Tensor
           0
           Ind9
           (Tensor
              1 Ind9 (Tensor 3 Ind3 (Tensor 1 Ind3 (SField Rational)))))))
  (ATens 0 0 1 1 0 0 (SField Rational))
block2 = ATens 0 0 0 0 1 1 (SField Rational)
delta3A ATens 0 0 0 0 1 1 (SField Rational)
-> ATens 0 0 0 1 2 0 (SField Rational)
-> TProd
     (ATens 0 0 0 0 1 1 (SField Rational))
     (ATens 0 0 0 1 2 0 (SField Rational))
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')
&* ATens 0 0 0 1 2 0 (SField Rational)
interJ2 Tensor
  0
  Ind20
  (Tensor
     0
     Ind20
     (Tensor
        0
        Ind9
        (Tensor 1 Ind9 (Tensor 3 Ind3 (Tensor 1 Ind3 (SField Rational))))))
-> ATens 0 0 1 1 0 0 (SField Rational)
-> TProd
     (Tensor
        0
        Ind20
        (Tensor
           0
           Ind20
           (Tensor
              0
              Ind9
              (Tensor
                 1 Ind9 (Tensor 3 Ind3 (Tensor 1 Ind3 (SField Rational)))))))
     (ATens 0 0 1 1 0 0 (SField Rational))
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')
&* ATens 0 0 1 1 0 0 (SField Rational)
delta9

-- | Is given by: \( C_{An}^{B(m\vert} J_I^{\vert p q )} \)
interEqn5 :: ATens 1 1 0 1 3 1 (SField Rational)
interEqn5 :: ATens 1 1 0 1 3 1 (SField Rational)
interEqn5 = [Int]
-> ATens 1 1 0 1 3 1 (SField Rational)
-> ATens 1 1 0 1 3 1 (SField Rational)
forall k1 k2 k3 v (n1 :: Nat) (n2 :: Nat) (n3 :: Nat) (n4 :: Nat)
       (n5 :: Nat).
(TIndex k1, TIndex k2, TIndex k3, TAdd v) =>
[Int]
-> AbsTensor5 n1 n2 n3 n4 n5 k1 k2 k3 v
-> AbsTensor5 n1 n2 n3 n4 n5 k1 k2 k3 v
cyclicSymATens5 [Int
0,Int
1,Int
2] ATens 1 1 0 1 3 1 (SField Rational)
intA1
        where
            intA1 :: TProd
  (ATens 0 0 0 1 2 0 (SField Rational))
  (ATens 1 1 0 0 1 1 (SField Rational))
intA1 = ATens 0 0 0 1 2 0 (SField Rational)
interJ2 ATens 0 0 0 1 2 0 (SField Rational)
-> ATens 1 1 0 0 1 1 (SField Rational)
-> TProd
     (ATens 0 0 0 1 2 0 (SField Rational))
     (ATens 1 1 0 0 1 1 (SField Rational))
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')
&* ATens 1 1 0 0 1 1 (SField Rational)
interArea

--derivative indices are left metric indices right !!

-- | Is given by: \( K_{In}^{J(m\vert} J_L^{\vert p q )} \)
interEqn5Metric :: ATens 0 0 1 2 3 1 (SField Rational)
interEqn5Metric :: ATens 0 0 1 2 3 1 (SField Rational)
interEqn5Metric = [Int]
-> ATens 0 0 1 2 3 1 (SField Rational)
-> ATens 0 0 1 2 3 1 (SField Rational)
forall k1 k2 k3 v (n1 :: Nat) (n2 :: Nat) (n3 :: Nat) (n4 :: Nat)
       (n5 :: Nat).
(TIndex k1, TIndex k2, TIndex k3, TAdd v) =>
[Int]
-> AbsTensor5 n1 n2 n3 n4 n5 k1 k2 k3 v
-> AbsTensor5 n1 n2 n3 n4 n5 k1 k2 k3 v
cyclicSymATens5 [Int
0,Int
1,Int
2] ATens 0 0 1 2 3 1 (SField Rational)
intA1
        where
            intA1 :: TProd
  (ATens 0 0 0 1 2 0 (SField Rational))
  (ATens 0 0 1 1 1 1 (SField Rational))
intA1 = ATens 0 0 0 1 2 0 (SField Rational)
interJ2 ATens 0 0 0 1 2 0 (SField Rational)
-> ATens 0 0 1 1 1 1 (SField Rational)
-> TProd
     (ATens 0 0 0 1 2 0 (SField Rational))
     (ATens 0 0 1 1 1 1 (SField Rational))
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')
&* ATens 0 0 1 1 1 1 (SField Rational)
interMetric


--generic Ansätze up to prolongation order 2

--A
-- |
-- prop> tensorRank6' generic4Ansatz = 21
generic4Ansatz :: ATens 1 0 0 0 0 0 (AnsVar (SField Rational))
generic4Ansatz :: ATens 1 0 0 0 0 0 (AnsVar (SField Rational))
generic4Ansatz = [(IndTuple6 1 0 0 0 0 0 Ind20 Ind9 Ind3, AnsVar (SField Rational))]
-> ATens 1 0 0 0 0 0 (AnsVar (SField Rational))
forall k1 k2 k3 v (n1 :: Nat) (n2 :: Nat) (n3 :: Nat) (n4 :: Nat)
       (n5 :: Nat) (n6 :: Nat).
(TIndex k1, TIndex k2, TIndex k3, TAdd v) =>
[(IndTuple6 n1 n2 n3 n4 n5 n6 k1 k2 k3, v)]
-> AbsTensor6 n1 n2 n3 n4 n5 n6 k1 k2 k3 v
fromListT6 [(IndTuple6 1 0 0 0 0 0 Ind20 Ind9 Ind3, AnsVar (SField Rational))]
forall a a a a a.
[((IndList 1 Ind20, IndList 0 a, IndList 0 a, IndList 0 a,
   IndList 0 a, IndList 0 a),
  AnsVar (SField Rational))]
list
     where
         list :: [((IndList 1 Ind20, IndList 0 a, IndList 0 a, IndList 0 a,
   IndList 0 a, IndList 0 a),
  AnsVar (SField Rational))]
list = [ let varMap :: AnsVar (SField Rational)
varMap = IntMap (SField Rational) -> AnsVar (SField Rational)
forall a. IntMap a -> AnsVar a
AnsVar (IntMap (SField Rational) -> AnsVar (SField Rational))
-> IntMap (SField Rational) -> AnsVar (SField Rational)
forall a b. (a -> b) -> a -> b
$ Int -> SField Rational -> IntMap (SField Rational)
forall a. Int -> a -> IntMap a
I.singleton (Int -> Int
forall p. p -> p
dof Int
a) (SField Rational -> IntMap (SField Rational))
-> SField Rational -> IntMap (SField Rational)
forall a b. (a -> b) -> a -> b
$ Rational -> SField Rational
forall a. a -> SField a
SField Rational
1
                  in ((Ind20 -> IndList 1 Ind20
forall a. a -> IndList 1 a
singletonInd (Int -> Ind20
Ind20 (Int -> Ind20) -> Int -> Ind20
forall a b. (a -> b) -> a -> b
$ Int
aInt -> Int -> Int
forall a. Num a => a -> a -> a
-Int
1), IndList 0 a
forall a. IndList 0 a
Empty, IndList 0 a
forall a. IndList 0 a
Empty, IndList 0 a
forall a. IndList 0 a
Empty, IndList 0 a
forall a. IndList 0 a
Empty, IndList 0 a
forall a. IndList 0 a
Empty), AnsVar (SField Rational)
varMap)
                  | Int
a <- [Int
1..Int
21] ]
         dof :: p -> p
dof p
a = p
a

--Aa
-- |
-- prop> tensorRank6' generic5Ansatz = 21*4
generic5Ansatz :: ATens 1 0 0 0 1 0 (AnsVar (SField Rational))
generic5Ansatz :: ATens 1 0 0 0 1 0 (AnsVar (SField Rational))
generic5Ansatz = [(IndTuple6 1 0 0 0 1 0 Ind20 Ind9 Ind3, AnsVar (SField Rational))]
-> ATens 1 0 0 0 1 0 (AnsVar (SField Rational))
forall k1 k2 k3 v (n1 :: Nat) (n2 :: Nat) (n3 :: Nat) (n4 :: Nat)
       (n5 :: Nat) (n6 :: Nat).
(TIndex k1, TIndex k2, TIndex k3, TAdd v) =>
[(IndTuple6 n1 n2 n3 n4 n5 n6 k1 k2 k3, v)]
-> AbsTensor6 n1 n2 n3 n4 n5 n6 k1 k2 k3 v
fromListT6 [(IndTuple6 1 0 0 0 1 0 Ind20 Ind9 Ind3, AnsVar (SField Rational))]
forall a a a a.
[((IndList 1 Ind20, IndList 0 a, IndList 0 a, IndList 0 a,
   IndList 1 Ind3, IndList 0 a),
  AnsVar (SField Rational))]
list
      where
         list :: [((IndList 1 Ind20, IndList 0 a, IndList 0 a, IndList 0 a,
   IndList 1 Ind3, IndList 0 a),
  AnsVar (SField Rational))]
list = [ let varMap :: AnsVar (SField Rational)
varMap = IntMap (SField Rational) -> AnsVar (SField Rational)
forall a. IntMap a -> AnsVar a
AnsVar (IntMap (SField Rational) -> AnsVar (SField Rational))
-> IntMap (SField Rational) -> AnsVar (SField Rational)
forall a b. (a -> b) -> a -> b
$ Int -> SField Rational -> IntMap (SField Rational)
forall a. Int -> a -> IntMap a
I.singleton (Int -> Int -> Int
forall a. Num a => a -> a -> a
dof Int
a Int
p) (SField Rational -> IntMap (SField Rational))
-> SField Rational -> IntMap (SField Rational)
forall a b. (a -> b) -> a -> b
$ Rational -> SField Rational
forall a. a -> SField a
SField Rational
1
                  in ((Ind20 -> IndList 1 Ind20
forall a. a -> IndList 1 a
singletonInd (Int -> Ind20
Ind20 (Int -> Ind20) -> Int -> Ind20
forall a b. (a -> b) -> a -> b
$ Int
aInt -> Int -> Int
forall a. Num a => a -> a -> a
-Int
1), IndList 0 a
forall a. IndList 0 a
Empty, IndList 0 a
forall a. IndList 0 a
Empty, IndList 0 a
forall a. IndList 0 a
Empty, Ind3 -> IndList 1 Ind3
forall a. a -> IndList 1 a
singletonInd (Int -> Ind3
Ind3 (Int -> Ind3) -> Int -> Ind3
forall a b. (a -> b) -> a -> b
$ Int
pInt -> Int -> Int
forall a. Num a => a -> a -> a
-Int
1 ), IndList 0 a
forall a. IndList 0 a
Empty), AnsVar (SField Rational)
varMap)
                  | Int
a <- [Int
1..Int
21], Int
p <- [Int
1..Int
4] ]
         dof :: a -> a -> a
dof a
a a
p = a
1 a -> a -> a
forall a. Num a => a -> a -> a
+ a
21 a -> a -> a
forall a. Num a => a -> a -> a
+ a
4a -> a -> a
forall a. Num a => a -> a -> a
*(a
aa -> a -> a
forall a. Num a => a -> a -> a
-a
1) a -> a -> a
forall a. Num a => a -> a -> a
+ (a
pa -> a -> a
forall a. Num a => a -> a -> a
-a
1)

--AI
-- |
-- prop> tensorRank6' generic5Ansatz = 21*10
generic6Ansatz :: ATens 1 0 1 0 0 0 (AnsVar (SField Rational))
generic6Ansatz :: ATens 1 0 1 0 0 0 (AnsVar (SField Rational))
generic6Ansatz = [(IndTuple6 1 0 1 0 0 0 Ind20 Ind9 Ind3, AnsVar (SField Rational))]
-> ATens 1 0 1 0 0 0 (AnsVar (SField Rational))
forall k1 k2 k3 v (n1 :: Nat) (n2 :: Nat) (n3 :: Nat) (n4 :: Nat)
       (n5 :: Nat) (n6 :: Nat).
(TIndex k1, TIndex k2, TIndex k3, TAdd v) =>
[(IndTuple6 n1 n2 n3 n4 n5 n6 k1 k2 k3, v)]
-> AbsTensor6 n1 n2 n3 n4 n5 n6 k1 k2 k3 v
fromListT6 [(IndTuple6 1 0 1 0 0 0 Ind20 Ind9 Ind3, AnsVar (SField Rational))]
forall a a a a.
[((IndList 1 Ind20, IndList 0 a, IndList 1 Ind9, IndList 0 a,
   IndList 0 a, IndList 0 a),
  AnsVar (SField Rational))]
list
     where
        list :: [((IndList 1 Ind20, IndList 0 a, IndList 1 Ind9, IndList 0 a,
   IndList 0 a, IndList 0 a),
  AnsVar (SField Rational))]
list = [ let varMap :: AnsVar (SField Rational)
varMap = IntMap (SField Rational) -> AnsVar (SField Rational)
forall a. IntMap a -> AnsVar a
AnsVar (IntMap (SField Rational) -> AnsVar (SField Rational))
-> IntMap (SField Rational) -> AnsVar (SField Rational)
forall a b. (a -> b) -> a -> b
$ Int -> SField Rational -> IntMap (SField Rational)
forall a. Int -> a -> IntMap a
I.singleton (Int -> Int -> Int
forall a. Num a => a -> a -> a
dof Int
a Int
i) (SField Rational -> IntMap (SField Rational))
-> SField Rational -> IntMap (SField Rational)
forall a b. (a -> b) -> a -> b
$ Rational -> SField Rational
forall a. a -> SField a
SField Rational
1
                 in ((Ind20 -> IndList 1 Ind20
forall a. a -> IndList 1 a
singletonInd (Int -> Ind20
Ind20 (Int -> Ind20) -> Int -> Ind20
forall a b. (a -> b) -> a -> b
$ Int
aInt -> Int -> Int
forall a. Num a => a -> a -> a
-Int
1), IndList 0 a
forall a. IndList 0 a
Empty, Ind9 -> IndList 1 Ind9
forall a. a -> IndList 1 a
singletonInd (Int -> Ind9
Ind9 (Int -> Ind9) -> Int -> Ind9
forall a b. (a -> b) -> a -> b
$ Int
iInt -> Int -> Int
forall a. Num a => a -> a -> a
-Int
1), IndList 0 a
forall a. IndList 0 a
Empty, IndList 0 a
forall a. IndList 0 a
Empty, IndList 0 a
forall a. IndList 0 a
Empty), AnsVar (SField Rational)
varMap)
                 | Int
a <- [Int
1..Int
21], Int
i <- [Int
1..Int
10] ]
        dof :: a -> a -> a
dof a
a a
i = a
1 a -> a -> a
forall a. Num a => a -> a -> a
+ a
21 a -> a -> a
forall a. Num a => a -> a -> a
+ a
84 a -> a -> a
forall a. Num a => a -> a -> a
+ a
10a -> a -> a
forall a. Num a => a -> a -> a
*(a
aa -> a -> a
forall a. Num a => a -> a -> a
-a
1) a -> a -> a
forall a. Num a => a -> a -> a
+ (a
ia -> a -> a
forall a. Num a => a -> a -> a
-a
1)
--AB
-- |
-- prop> tensorRank6' generic8Ansatz = 21*22/2
generic8Ansatz :: ATens 2 0 0 0 0 0 (AnsVar (SField Rational))
generic8Ansatz :: ATens 2 0 0 0 0 0 (AnsVar (SField Rational))
generic8Ansatz = [(IndTuple6 2 0 0 0 0 0 Ind20 Ind9 Ind3, AnsVar (SField Rational))]
-> ATens 2 0 0 0 0 0 (AnsVar (SField Rational))
forall k1 k2 k3 v (n1 :: Nat) (n2 :: Nat) (n3 :: Nat) (n4 :: Nat)
       (n5 :: Nat) (n6 :: Nat).
(TIndex k1, TIndex k2, TIndex k3, TAdd v) =>
[(IndTuple6 n1 n2 n3 n4 n5 n6 k1 k2 k3, v)]
-> AbsTensor6 n1 n2 n3 n4 n5 n6 k1 k2 k3 v
fromListT6 [(IndTuple6 2 0 0 0 0 0 Ind20 Ind9 Ind3, AnsVar (SField Rational))]
list
     where
        list :: [(IndTuple6 2 0 0 0 0 0 Ind20 Ind9 Ind3, AnsVar (SField Rational))]
list = [ let varMap :: AnsVar (SField Rational)
varMap = IntMap (SField Rational) -> AnsVar (SField Rational)
forall a. IntMap a -> AnsVar a
AnsVar (IntMap (SField Rational) -> AnsVar (SField Rational))
-> IntMap (SField Rational) -> AnsVar (SField Rational)
forall a b. (a -> b) -> a -> b
$ Int -> SField Rational -> IntMap (SField Rational)
forall a. Int -> a -> IntMap a
I.singleton (Int -> Int -> Int
dof Int
a Int
b) (SField Rational -> IntMap (SField Rational))
-> SField Rational -> IntMap (SField Rational)
forall a b. (a -> b) -> a -> b
$ Rational -> SField Rational
forall a. a -> SField a
SField Rational
1
                 in ((Ind20 -> IndList (2 - 1) Ind20 -> IndList 2 Ind20
forall a (n :: Nat). a -> IndList (n - 1) a -> IndList n a
Append (Int -> Ind20
Ind20 (Int -> Ind20) -> Int -> Ind20
forall a b. (a -> b) -> a -> b
$ Int
aInt -> Int -> Int
forall a. Num a => a -> a -> a
-Int
1) (IndList (2 - 1) Ind20 -> IndList 2 Ind20)
-> IndList (2 - 1) Ind20 -> IndList 2 Ind20
forall a b. (a -> b) -> a -> b
$ Ind20 -> IndList 1 Ind20
forall a. a -> IndList 1 a
singletonInd (Int -> Ind20
Ind20 (Int -> Ind20) -> Int -> Ind20
forall a b. (a -> b) -> a -> b
$ Int
bInt -> Int -> Int
forall a. Num a => a -> a -> a
-Int
1), IndList 0 Ind20
forall a. IndList 0 a
Empty, IndList 0 Ind9
forall a. IndList 0 a
Empty, IndList 0 Ind9
forall a. IndList 0 a
Empty, IndList 0 Ind3
forall a. IndList 0 a
Empty, IndList 0 Ind3
forall a. IndList 0 a
Empty), AnsVar (SField Rational)
varMap)
                 | Int
a <- [Int
1..Int
21], Int
b <- [Int
1..Int
21] ]
        dof :: Int -> Int -> Int
dof Int
a Int
b = let a' :: Int
a' = Int -> Int -> Int
forall a. Ord a => a -> a -> a
min Int
a Int
b
                      b' :: Int
b' = Int -> Int -> Int
forall a. Ord a => a -> a -> a
max Int
a Int
b
                  in Map [Int] Int
trian Map [Int] Int -> [Int] -> Int
forall k a. Ord k => Map k a -> k -> a
M.! [Int
a',Int
b'] Int -> Int -> Int
forall a. Num a => a -> a -> a
+ Int
315
        trian :: Map [Int] Int
trian = [([Int], Int)] -> Map [Int] Int
forall k a. Ord k => [(k, a)] -> Map k a
M.fromList ([([Int], Int)] -> Map [Int] Int)
-> [([Int], Int)] -> Map [Int] Int
forall a b. (a -> b) -> a -> b
$ [[Int]] -> [Int] -> [([Int], Int)]
forall a b. [a] -> [b] -> [(a, b)]
zip [[Int]]
j [Int]
k
                  where
                      j :: [[Int]]
j = [ [Int
a,Int
b] | Int
a <- [Int
1..Int
315], Int
b <- [Int
a..Int
315] ]
                      k :: [Int]
k = [Int
1..]

--ABb
-- |
-- prop> tensorRank6' generic21Ansatz = 21*21*4
generic9Ansatz :: ATens 2 0 0 0 1 0 (AnsVar (SField Rational))
generic9Ansatz :: ATens 2 0 0 0 1 0 (AnsVar (SField Rational))
generic9Ansatz = [(IndTuple6 2 0 0 0 1 0 Ind20 Ind9 Ind3, AnsVar (SField Rational))]
-> ATens 2 0 0 0 1 0 (AnsVar (SField Rational))
forall k1 k2 k3 v (n1 :: Nat) (n2 :: Nat) (n3 :: Nat) (n4 :: Nat)
       (n5 :: Nat) (n6 :: Nat).
(TIndex k1, TIndex k2, TIndex k3, TAdd v) =>
[(IndTuple6 n1 n2 n3 n4 n5 n6 k1 k2 k3, v)]
-> AbsTensor6 n1 n2 n3 n4 n5 n6 k1 k2 k3 v
fromListT6 [(IndTuple6 2 0 0 0 1 0 Ind20 Ind9 Ind3, AnsVar (SField Rational))]
list
    where
        list :: [(IndTuple6 2 0 0 0 1 0 Ind20 Ind9 Ind3, AnsVar (SField Rational))]
list = [ let varMap :: AnsVar (SField Rational)
varMap = IntMap (SField Rational) -> AnsVar (SField Rational)
forall a. IntMap a -> AnsVar a
AnsVar (IntMap (SField Rational) -> AnsVar (SField Rational))
-> IntMap (SField Rational) -> AnsVar (SField Rational)
forall a b. (a -> b) -> a -> b
$ Int -> SField Rational -> IntMap (SField Rational)
forall a. Int -> a -> IntMap a
I.singleton (Int -> Int -> Int -> Int
dof Int
a Int
b Int
p) (SField Rational -> IntMap (SField Rational))
-> SField Rational -> IntMap (SField Rational)
forall a b. (a -> b) -> a -> b
$ Rational -> SField Rational
forall a. a -> SField a
SField Rational
1
                in ((Ind20 -> IndList (2 - 1) Ind20 -> IndList 2 Ind20
forall a (n :: Nat). a -> IndList (n - 1) a -> IndList n a
Append (Int -> Ind20
Ind20 (Int -> Ind20) -> Int -> Ind20
forall a b. (a -> b) -> a -> b
$ Int
aInt -> Int -> Int
forall a. Num a => a -> a -> a
-Int
1) (IndList (2 - 1) Ind20 -> IndList 2 Ind20)
-> IndList (2 - 1) Ind20 -> IndList 2 Ind20
forall a b. (a -> b) -> a -> b
$ Ind20 -> IndList 1 Ind20
forall a. a -> IndList 1 a
singletonInd (Int -> Ind20
Ind20 (Int -> Ind20) -> Int -> Ind20
forall a b. (a -> b) -> a -> b
$ Int
bInt -> Int -> Int
forall a. Num a => a -> a -> a
-Int
1), IndList 0 Ind20
forall a. IndList 0 a
Empty, IndList 0 Ind9
forall a. IndList 0 a
Empty, IndList 0 Ind9
forall a. IndList 0 a
Empty, Ind3 -> IndList 1 Ind3
forall a. a -> IndList 1 a
singletonInd (Int -> Ind3
Ind3 (Int -> Ind3) -> Int -> Ind3
forall a b. (a -> b) -> a -> b
$ Int
pInt -> Int -> Int
forall a. Num a => a -> a -> a
-Int
1), IndList 0 Ind3
forall a. IndList 0 a
Empty), AnsVar (SField Rational)
varMap)
                | Int
a <- [Int
1..Int
21], Int
b <- [Int
1..Int
21], Int
p <- [Int
1..Int
4]]
        dof :: Int -> Int -> Int -> Int
dof Int
a Int
b Int
p = Map [Int] Int
trian Map [Int] Int -> [Int] -> Int
forall k a. Ord k => Map k a -> k -> a
M.! [Int
a,Int
1 Int -> Int -> Int
forall a. Num a => a -> a -> a
+ Int
21 Int -> Int -> Int
forall a. Num a => a -> a -> a
+ Int
4Int -> Int -> Int
forall a. Num a => a -> a -> a
*(Int
bInt -> Int -> Int
forall a. Num a => a -> a -> a
-Int
1) Int -> Int -> Int
forall a. Num a => a -> a -> a
+ (Int
pInt -> Int -> Int
forall a. Num a => a -> a -> a
-Int
1)] Int -> Int -> Int
forall a. Num a => a -> a -> a
+ Int
315
        trian :: Map [Int] Int
trian = [([Int], Int)] -> Map [Int] Int
forall k a. Ord k => [(k, a)] -> Map k a
M.fromList ([([Int], Int)] -> Map [Int] Int)
-> [([Int], Int)] -> Map [Int] Int
forall a b. (a -> b) -> a -> b
$ [[Int]] -> [Int] -> [([Int], Int)]
forall a b. [a] -> [b] -> [(a, b)]
zip [[Int]]
j [Int]
k
                where
                    j :: [[Int]]
j = [ [Int
a,Int
b] | Int
a <- [Int
1..Int
315], Int
b <- [Int
a..Int
315] ]
                    k :: [Int]
k = [Int
1..]

--AaBb
-- |
-- prop> tensorRank6' generic5Ansatz = 84*85/2
generic10_1Ansatz :: ATens 2 0 0 0 2 0 (AnsVar (SField Rational))
generic10_1Ansatz :: ATens 2 0 0 0 2 0 (AnsVar (SField Rational))
generic10_1Ansatz = [(IndTuple6 2 0 0 0 2 0 Ind20 Ind9 Ind3, AnsVar (SField Rational))]
-> ATens 2 0 0 0 2 0 (AnsVar (SField Rational))
forall k1 k2 k3 v (n1 :: Nat) (n2 :: Nat) (n3 :: Nat) (n4 :: Nat)
       (n5 :: Nat) (n6 :: Nat).
(TIndex k1, TIndex k2, TIndex k3, TAdd v) =>
[(IndTuple6 n1 n2 n3 n4 n5 n6 k1 k2 k3, v)]
-> AbsTensor6 n1 n2 n3 n4 n5 n6 k1 k2 k3 v
fromListT6 [(IndTuple6 2 0 0 0 2 0 Ind20 Ind9 Ind3, AnsVar (SField Rational))]
list
    where
        list :: [(IndTuple6 2 0 0 0 2 0 Ind20 Ind9 Ind3, AnsVar (SField Rational))]
list = [ let varMap :: AnsVar (SField Rational)
varMap = IntMap (SField Rational) -> AnsVar (SField Rational)
forall a. IntMap a -> AnsVar a
AnsVar (IntMap (SField Rational) -> AnsVar (SField Rational))
-> IntMap (SField Rational) -> AnsVar (SField Rational)
forall a b. (a -> b) -> a -> b
$ Int -> SField Rational -> IntMap (SField Rational)
forall a. Int -> a -> IntMap a
I.singleton (Int -> Int -> Int -> Int -> Int
dof Int
a Int
b Int
p Int
q) (SField Rational -> IntMap (SField Rational))
-> SField Rational -> IntMap (SField Rational)
forall a b. (a -> b) -> a -> b
$ Rational -> SField Rational
forall a. a -> SField a
SField Rational
1
                in ((Ind20 -> IndList (2 - 1) Ind20 -> IndList 2 Ind20
forall a (n :: Nat). a -> IndList (n - 1) a -> IndList n a
Append (Int -> Ind20
Ind20 (Int -> Ind20) -> Int -> Ind20
forall a b. (a -> b) -> a -> b
$ Int
aInt -> Int -> Int
forall a. Num a => a -> a -> a
-Int
1) (IndList (2 - 1) Ind20 -> IndList 2 Ind20)
-> IndList (2 - 1) Ind20 -> IndList 2 Ind20
forall a b. (a -> b) -> a -> b
$ Ind20 -> IndList 1 Ind20
forall a. a -> IndList 1 a
singletonInd (Int -> Ind20
Ind20 (Int -> Ind20) -> Int -> Ind20
forall a b. (a -> b) -> a -> b
$ Int
bInt -> Int -> Int
forall a. Num a => a -> a -> a
-Int
1), IndList 0 Ind20
forall a. IndList 0 a
Empty, IndList 0 Ind9
forall a. IndList 0 a
Empty, IndList 0 Ind9
forall a. IndList 0 a
Empty, Ind3 -> IndList (2 - 1) Ind3 -> IndList 2 Ind3
forall a (n :: Nat). a -> IndList (n - 1) a -> IndList n a
Append (Int -> Ind3
Ind3 (Int -> Ind3) -> Int -> Ind3
forall a b. (a -> b) -> a -> b
$ Int
pInt -> Int -> Int
forall a. Num a => a -> a -> a
-Int
1) (IndList (2 - 1) Ind3 -> IndList 2 Ind3)
-> IndList (2 - 1) Ind3 -> IndList 2 Ind3
forall a b. (a -> b) -> a -> b
$ Ind3 -> IndList 1 Ind3
forall a. a -> IndList 1 a
singletonInd (Int -> Ind3
Ind3 (Int -> Ind3) -> Int -> Ind3
forall a b. (a -> b) -> a -> b
$ Int
qInt -> Int -> Int
forall a. Num a => a -> a -> a
-Int
1), IndList 0 Ind3
forall a. IndList 0 a
Empty), AnsVar (SField Rational)
varMap)
                | Int
a <- [Int
1..Int
21], Int
b <- [Int
1..Int
21], Int
p <- [Int
1..Int
4], Int
q <- [Int
1..Int
4]]
        dof :: Int -> Int -> Int -> Int -> Int
dof Int
a Int
b Int
p Int
q = let
                a' :: Int
a' = Int -> Int -> Int
forall a. Ord a => a -> a -> a
min (Int
1 Int -> Int -> Int
forall a. Num a => a -> a -> a
+ Int
21 Int -> Int -> Int
forall a. Num a => a -> a -> a
+ Int
4Int -> Int -> Int
forall a. Num a => a -> a -> a
*(Int
aInt -> Int -> Int
forall a. Num a => a -> a -> a
-Int
1) Int -> Int -> Int
forall a. Num a => a -> a -> a
+ (Int
pInt -> Int -> Int
forall a. Num a => a -> a -> a
-Int
1)) (Int
1 Int -> Int -> Int
forall a. Num a => a -> a -> a
+ Int
21 Int -> Int -> Int
forall a. Num a => a -> a -> a
+ Int
4Int -> Int -> Int
forall a. Num a => a -> a -> a
*(Int
bInt -> Int -> Int
forall a. Num a => a -> a -> a
-Int
1) Int -> Int -> Int
forall a. Num a => a -> a -> a
+ (Int
qInt -> Int -> Int
forall a. Num a => a -> a -> a
-Int
1))
                b' :: Int
b' = Int -> Int -> Int
forall a. Ord a => a -> a -> a
max (Int
1 Int -> Int -> Int
forall a. Num a => a -> a -> a
+ Int
21 Int -> Int -> Int
forall a. Num a => a -> a -> a
+ Int
4Int -> Int -> Int
forall a. Num a => a -> a -> a
*(Int
aInt -> Int -> Int
forall a. Num a => a -> a -> a
-Int
1) Int -> Int -> Int
forall a. Num a => a -> a -> a
+ (Int
pInt -> Int -> Int
forall a. Num a => a -> a -> a
-Int
1)) (Int
1 Int -> Int -> Int
forall a. Num a => a -> a -> a
+ Int
21 Int -> Int -> Int
forall a. Num a => a -> a -> a
+ Int
4Int -> Int -> Int
forall a. Num a => a -> a -> a
*(Int
bInt -> Int -> Int
forall a. Num a => a -> a -> a
-Int
1) Int -> Int -> Int
forall a. Num a => a -> a -> a
+ (Int
qInt -> Int -> Int
forall a. Num a => a -> a -> a
-Int
1))
                in Map [Int] Int
trian Map [Int] Int -> [Int] -> Int
forall k a. Ord k => Map k a -> k -> a
M.! [Int
a',Int
b'] Int -> Int -> Int
forall a. Num a => a -> a -> a
+ Int
315
        trian :: Map [Int] Int
trian = [([Int], Int)] -> Map [Int] Int
forall k a. Ord k => [(k, a)] -> Map k a
M.fromList ([([Int], Int)] -> Map [Int] Int)
-> [([Int], Int)] -> Map [Int] Int
forall a b. (a -> b) -> a -> b
$ [[Int]] -> [Int] -> [([Int], Int)]
forall a b. [a] -> [b] -> [(a, b)]
zip [[Int]]
j [Int]
k
                where
                    j :: [[Int]]
j = [ [Int
a,Int
b] | Int
a <- [Int
1..Int
315], Int
b <- [Int
a..Int
315] ]
                    k :: [Int]
k = [Int
1..]

--ABI
-- |
-- prop> tensorRank6' generic5Ansatz = 21*21*10
generic10_2Ansatz :: ATens 2 0 1 0 0 0 (AnsVar (SField Rational))
generic10_2Ansatz :: ATens 2 0 1 0 0 0 (AnsVar (SField Rational))
generic10_2Ansatz = [(IndTuple6 2 0 1 0 0 0 Ind20 Ind9 Ind3, AnsVar (SField Rational))]
-> ATens 2 0 1 0 0 0 (AnsVar (SField Rational))
forall k1 k2 k3 v (n1 :: Nat) (n2 :: Nat) (n3 :: Nat) (n4 :: Nat)
       (n5 :: Nat) (n6 :: Nat).
(TIndex k1, TIndex k2, TIndex k3, TAdd v) =>
[(IndTuple6 n1 n2 n3 n4 n5 n6 k1 k2 k3, v)]
-> AbsTensor6 n1 n2 n3 n4 n5 n6 k1 k2 k3 v
fromListT6 [(IndTuple6 2 0 1 0 0 0 Ind20 Ind9 Ind3, AnsVar (SField Rational))]
list
     where
         list :: [(IndTuple6 2 0 1 0 0 0 Ind20 Ind9 Ind3, AnsVar (SField Rational))]
list = [ let varMap :: AnsVar (SField Rational)
varMap = IntMap (SField Rational) -> AnsVar (SField Rational)
forall a. IntMap a -> AnsVar a
AnsVar (IntMap (SField Rational) -> AnsVar (SField Rational))
-> IntMap (SField Rational) -> AnsVar (SField Rational)
forall a b. (a -> b) -> a -> b
$ Int -> SField Rational -> IntMap (SField Rational)
forall a. Int -> a -> IntMap a
I.singleton (Int -> Int -> Int -> Int
dof Int
a Int
b Int
i) (SField Rational -> IntMap (SField Rational))
-> SField Rational -> IntMap (SField Rational)
forall a b. (a -> b) -> a -> b
$ Rational -> SField Rational
forall a. a -> SField a
SField Rational
1
                 in ((Ind20 -> IndList (2 - 1) Ind20 -> IndList 2 Ind20
forall a (n :: Nat). a -> IndList (n - 1) a -> IndList n a
Append (Int -> Ind20
Ind20 (Int -> Ind20) -> Int -> Ind20
forall a b. (a -> b) -> a -> b
$ Int
aInt -> Int -> Int
forall a. Num a => a -> a -> a
-Int
1) (IndList (2 - 1) Ind20 -> IndList 2 Ind20)
-> IndList (2 - 1) Ind20 -> IndList 2 Ind20
forall a b. (a -> b) -> a -> b
$ Ind20 -> IndList 1 Ind20
forall a. a -> IndList 1 a
singletonInd (Int -> Ind20
Ind20 (Int -> Ind20) -> Int -> Ind20
forall a b. (a -> b) -> a -> b
$ Int
bInt -> Int -> Int
forall a. Num a => a -> a -> a
-Int
1), IndList 0 Ind20
forall a. IndList 0 a
Empty, Ind9 -> IndList 1 Ind9
forall a. a -> IndList 1 a
singletonInd (Int -> Ind9
Ind9 (Int -> Ind9) -> Int -> Ind9
forall a b. (a -> b) -> a -> b
$ Int
i Int -> Int -> Int
forall a. Num a => a -> a -> a
-Int
1), IndList 0 Ind9
forall a. IndList 0 a
Empty, IndList 0 Ind3
forall a. IndList 0 a
Empty, IndList 0 Ind3
forall a. IndList 0 a
Empty), AnsVar (SField Rational)
varMap)
                 | Int
a <- [Int
1..Int
21], Int
b <- [Int
1..Int
21], Int
i <- [Int
1..Int
10]]
         dof :: Int -> Int -> Int -> Int
dof Int
a Int
b Int
i = Map [Int] Int
trian Map [Int] Int -> [Int] -> Int
forall k a. Ord k => Map k a -> k -> a
M.! [Int
a,Int
1 Int -> Int -> Int
forall a. Num a => a -> a -> a
+ Int
105 Int -> Int -> Int
forall a. Num a => a -> a -> a
+ Int
10Int -> Int -> Int
forall a. Num a => a -> a -> a
*(Int
bInt -> Int -> Int
forall a. Num a => a -> a -> a
-Int
1) Int -> Int -> Int
forall a. Num a => a -> a -> a
+ (Int
iInt -> Int -> Int
forall a. Num a => a -> a -> a
-Int
1)] Int -> Int -> Int
forall a. Num a => a -> a -> a
+ Int
315
         trian :: Map [Int] Int
trian = [([Int], Int)] -> Map [Int] Int
forall k a. Ord k => [(k, a)] -> Map k a
M.fromList ([([Int], Int)] -> Map [Int] Int)
-> [([Int], Int)] -> Map [Int] Int
forall a b. (a -> b) -> a -> b
$ [[Int]] -> [Int] -> [([Int], Int)]
forall a b. [a] -> [b] -> [(a, b)]
zip [[Int]]
j [Int]
k
                 where
                     j :: [[Int]]
j = [ [Int
a,Int
b] | Int
a <- [Int
1..Int
315], Int
b <- [Int
a..Int
315] ]
                     k :: [Int]
k = [Int
1..]

--ApBI
-- |
-- prop> tensorRank6' generic5Ansatz = 21*21*10*4
generic11Ansatz :: ATens 2 0 1 0 1 0 (AnsVar (SField Rational))
generic11Ansatz :: ATens 2 0 1 0 1 0 (AnsVar (SField Rational))
generic11Ansatz = [(IndTuple6 2 0 1 0 1 0 Ind20 Ind9 Ind3, AnsVar (SField Rational))]
-> ATens 2 0 1 0 1 0 (AnsVar (SField Rational))
forall k1 k2 k3 v (n1 :: Nat) (n2 :: Nat) (n3 :: Nat) (n4 :: Nat)
       (n5 :: Nat) (n6 :: Nat).
(TIndex k1, TIndex k2, TIndex k3, TAdd v) =>
[(IndTuple6 n1 n2 n3 n4 n5 n6 k1 k2 k3, v)]
-> AbsTensor6 n1 n2 n3 n4 n5 n6 k1 k2 k3 v
fromListT6 [(IndTuple6 2 0 1 0 1 0 Ind20 Ind9 Ind3, AnsVar (SField Rational))]
list
     where
         list :: [(IndTuple6 2 0 1 0 1 0 Ind20 Ind9 Ind3, AnsVar (SField Rational))]
list = [ let varMap :: AnsVar (SField Rational)
varMap = IntMap (SField Rational) -> AnsVar (SField Rational)
forall a. IntMap a -> AnsVar a
AnsVar (IntMap (SField Rational) -> AnsVar (SField Rational))
-> IntMap (SField Rational) -> AnsVar (SField Rational)
forall a b. (a -> b) -> a -> b
$ Int -> SField Rational -> IntMap (SField Rational)
forall a. Int -> a -> IntMap a
I.singleton (Int -> Int -> Int -> Int -> Int
dof Int
a Int
b Int
i Int
p) (SField Rational -> IntMap (SField Rational))
-> SField Rational -> IntMap (SField Rational)
forall a b. (a -> b) -> a -> b
$ Rational -> SField Rational
forall a. a -> SField a
SField Rational
1
                 in ((Ind20 -> IndList (2 - 1) Ind20 -> IndList 2 Ind20
forall a (n :: Nat). a -> IndList (n - 1) a -> IndList n a
Append (Int -> Ind20
Ind20 (Int -> Ind20) -> Int -> Ind20
forall a b. (a -> b) -> a -> b
$ Int
aInt -> Int -> Int
forall a. Num a => a -> a -> a
-Int
1) (IndList (2 - 1) Ind20 -> IndList 2 Ind20)
-> IndList (2 - 1) Ind20 -> IndList 2 Ind20
forall a b. (a -> b) -> a -> b
$ Ind20 -> IndList 1 Ind20
forall a. a -> IndList 1 a
singletonInd (Int -> Ind20
Ind20 (Int -> Ind20) -> Int -> Ind20
forall a b. (a -> b) -> a -> b
$ Int
bInt -> Int -> Int
forall a. Num a => a -> a -> a
-Int
1), IndList 0 Ind20
forall a. IndList 0 a
Empty, Ind9 -> IndList 1 Ind9
forall a. a -> IndList 1 a
singletonInd (Int -> Ind9
Ind9 (Int -> Ind9) -> Int -> Ind9
forall a b. (a -> b) -> a -> b
$ Int
i Int -> Int -> Int
forall a. Num a => a -> a -> a
-Int
1), IndList 0 Ind9
forall a. IndList 0 a
Empty, Ind3 -> IndList 1 Ind3
forall a. a -> IndList 1 a
singletonInd (Int -> Ind3
Ind3 (Int -> Ind3) -> Int -> Ind3
forall a b. (a -> b) -> a -> b
$ Int
pInt -> Int -> Int
forall a. Num a => a -> a -> a
-Int
1), IndList 0 Ind3
forall a. IndList 0 a
Empty), AnsVar (SField Rational)
varMap)
                 | Int
a <- [Int
1..Int
21], Int
b <- [Int
1..Int
21], Int
i <- [Int
1..Int
10], Int
p <- [Int
1..Int
4]]
         dof :: Int -> Int -> Int -> Int -> Int
dof Int
a Int
b Int
i Int
p = Map [Int] Int
trian Map [Int] Int -> [Int] -> Int
forall k a. Ord k => Map k a -> k -> a
M.! [Int
1 Int -> Int -> Int
forall a. Num a => a -> a -> a
+ Int
21 Int -> Int -> Int
forall a. Num a => a -> a -> a
+ Int
4Int -> Int -> Int
forall a. Num a => a -> a -> a
*(Int
aInt -> Int -> Int
forall a. Num a => a -> a -> a
-Int
1) Int -> Int -> Int
forall a. Num a => a -> a -> a
+ (Int
pInt -> Int -> Int
forall a. Num a => a -> a -> a
-Int
1),Int
1 Int -> Int -> Int
forall a. Num a => a -> a -> a
+ Int
105 Int -> Int -> Int
forall a. Num a => a -> a -> a
+ Int
10Int -> Int -> Int
forall a. Num a => a -> a -> a
*(Int
bInt -> Int -> Int
forall a. Num a => a -> a -> a
-Int
1) Int -> Int -> Int
forall a. Num a => a -> a -> a
+ (Int
iInt -> Int -> Int
forall a. Num a => a -> a -> a
-Int
1)] Int -> Int -> Int
forall a. Num a => a -> a -> a
+ Int
315
         trian :: Map [Int] Int
trian = [([Int], Int)] -> Map [Int] Int
forall k a. Ord k => [(k, a)] -> Map k a
M.fromList ([([Int], Int)] -> Map [Int] Int)
-> [([Int], Int)] -> Map [Int] Int
forall a b. (a -> b) -> a -> b
$ [[Int]] -> [Int] -> [([Int], Int)]
forall a b. [a] -> [b] -> [(a, b)]
zip [[Int]]
j [Int]
k
                 where
                     j :: [[Int]]
j = [ [Int
a,Int
b] | Int
a <- [Int
1..Int
315], Int
b <- [Int
a..Int
315] ]
                     k :: [Int]
k = [Int
1..]

--AIBJ
-- |
-- prop> tensorRank6' generic5Ansatz = 210*211/2
generic12_1Ansatz :: ATens 2 0 2 0 0 0 (AnsVar (SField Rational))
generic12_1Ansatz :: ATens 2 0 2 0 0 0 (AnsVar (SField Rational))
generic12_1Ansatz = [(IndTuple6 2 0 2 0 0 0 Ind20 Ind9 Ind3, AnsVar (SField Rational))]
-> ATens 2 0 2 0 0 0 (AnsVar (SField Rational))
forall k1 k2 k3 v (n1 :: Nat) (n2 :: Nat) (n3 :: Nat) (n4 :: Nat)
       (n5 :: Nat) (n6 :: Nat).
(TIndex k1, TIndex k2, TIndex k3, TAdd v) =>
[(IndTuple6 n1 n2 n3 n4 n5 n6 k1 k2 k3, v)]
-> AbsTensor6 n1 n2 n3 n4 n5 n6 k1 k2 k3 v
fromListT6 [(IndTuple6 2 0 2 0 0 0 Ind20 Ind9 Ind3, AnsVar (SField Rational))]
list
    where
        list :: [(IndTuple6 2 0 2 0 0 0 Ind20 Ind9 Ind3, AnsVar (SField Rational))]
list = [ let varMap :: AnsVar (SField Rational)
varMap = IntMap (SField Rational) -> AnsVar (SField Rational)
forall a. IntMap a -> AnsVar a
AnsVar (IntMap (SField Rational) -> AnsVar (SField Rational))
-> IntMap (SField Rational) -> AnsVar (SField Rational)
forall a b. (a -> b) -> a -> b
$ Int -> SField Rational -> IntMap (SField Rational)
forall a. Int -> a -> IntMap a
I.singleton (Int -> Int -> Int -> Int -> Int
dof Int
a Int
b Int
i Int
j) (SField Rational -> IntMap (SField Rational))
-> SField Rational -> IntMap (SField Rational)
forall a b. (a -> b) -> a -> b
$ Rational -> SField Rational
forall a. a -> SField a
SField Rational
1
                in ((Ind20 -> IndList (2 - 1) Ind20 -> IndList 2 Ind20
forall a (n :: Nat). a -> IndList (n - 1) a -> IndList n a
Append (Int -> Ind20
Ind20 (Int -> Ind20) -> Int -> Ind20
forall a b. (a -> b) -> a -> b
$ Int
aInt -> Int -> Int
forall a. Num a => a -> a -> a
-Int
1) (IndList (2 - 1) Ind20 -> IndList 2 Ind20)
-> IndList (2 - 1) Ind20 -> IndList 2 Ind20
forall a b. (a -> b) -> a -> b
$ Ind20 -> IndList 1 Ind20
forall a. a -> IndList 1 a
singletonInd (Int -> Ind20
Ind20 (Int -> Ind20) -> Int -> Ind20
forall a b. (a -> b) -> a -> b
$ Int
bInt -> Int -> Int
forall a. Num a => a -> a -> a
-Int
1), IndList 0 Ind20
forall a. IndList 0 a
Empty, Ind9 -> IndList (2 - 1) Ind9 -> IndList 2 Ind9
forall a (n :: Nat). a -> IndList (n - 1) a -> IndList n a
Append (Int -> Ind9
Ind9 (Int -> Ind9) -> Int -> Ind9
forall a b. (a -> b) -> a -> b
$ Int
iInt -> Int -> Int
forall a. Num a => a -> a -> a
-Int
1) (IndList (2 - 1) Ind9 -> IndList 2 Ind9)
-> IndList (2 - 1) Ind9 -> IndList 2 Ind9
forall a b. (a -> b) -> a -> b
$ Ind9 -> IndList 1 Ind9
forall a. a -> IndList 1 a
singletonInd (Int -> Ind9
Ind9 (Int -> Ind9) -> Int -> Ind9
forall a b. (a -> b) -> a -> b
$ Int
j Int -> Int -> Int
forall a. Num a => a -> a -> a
-Int
1), IndList 0 Ind9
forall a. IndList 0 a
Empty, IndList 0 Ind3
forall a. IndList 0 a
Empty, IndList 0 Ind3
forall a. IndList 0 a
Empty), AnsVar (SField Rational)
varMap)
                | Int
a <- [Int
1..Int
21], Int
b <- [Int
1..Int
21], Int
i <- [Int
1..Int
10], Int
j <- [Int
1..Int
10]]
        dof :: Int -> Int -> Int -> Int -> Int
dof Int
a Int
b Int
i Int
j = let
                a' :: Int
a' =  Int -> Int -> Int
forall a. Ord a => a -> a -> a
min (Int
1 Int -> Int -> Int
forall a. Num a => a -> a -> a
+ Int
105 Int -> Int -> Int
forall a. Num a => a -> a -> a
+ Int
10Int -> Int -> Int
forall a. Num a => a -> a -> a
*(Int
aInt -> Int -> Int
forall a. Num a => a -> a -> a
-Int
1) Int -> Int -> Int
forall a. Num a => a -> a -> a
+ (Int
iInt -> Int -> Int
forall a. Num a => a -> a -> a
-Int
1)) (Int
1 Int -> Int -> Int
forall a. Num a => a -> a -> a
+ Int
105 Int -> Int -> Int
forall a. Num a => a -> a -> a
+ Int
10Int -> Int -> Int
forall a. Num a => a -> a -> a
*(Int
bInt -> Int -> Int
forall a. Num a => a -> a -> a
-Int
1) Int -> Int -> Int
forall a. Num a => a -> a -> a
+ (Int
jInt -> Int -> Int
forall a. Num a => a -> a -> a
-Int
1))
                b' :: Int
b' =  Int -> Int -> Int
forall a. Ord a => a -> a -> a
max (Int
1 Int -> Int -> Int
forall a. Num a => a -> a -> a
+ Int
105 Int -> Int -> Int
forall a. Num a => a -> a -> a
+ Int
10Int -> Int -> Int
forall a. Num a => a -> a -> a
*(Int
aInt -> Int -> Int
forall a. Num a => a -> a -> a
-Int
1) Int -> Int -> Int
forall a. Num a => a -> a -> a
+ (Int
iInt -> Int -> Int
forall a. Num a => a -> a -> a
-Int
1)) (Int
1 Int -> Int -> Int
forall a. Num a => a -> a -> a
+ Int
105 Int -> Int -> Int
forall a. Num a => a -> a -> a
+ Int
10Int -> Int -> Int
forall a. Num a => a -> a -> a
*(Int
bInt -> Int -> Int
forall a. Num a => a -> a -> a
-Int
1) Int -> Int -> Int
forall a. Num a => a -> a -> a
+ (Int
jInt -> Int -> Int
forall a. Num a => a -> a -> a
-Int
1))
                in Map [Int] Int
trian Map [Int] Int -> [Int] -> Int
forall k a. Ord k => Map k a -> k -> a
M.! [Int
a',Int
b'] Int -> Int -> Int
forall a. Num a => a -> a -> a
+ Int
315
        trian :: Map [Int] Int
trian = [([Int], Int)] -> Map [Int] Int
forall k a. Ord k => [(k, a)] -> Map k a
M.fromList ([([Int], Int)] -> Map [Int] Int)
-> [([Int], Int)] -> Map [Int] Int
forall a b. (a -> b) -> a -> b
$ [[Int]] -> [Int] -> [([Int], Int)]
forall a b. [a] -> [b] -> [(a, b)]
zip [[Int]]
j [Int]
k
                where
                    j :: [[Int]]
j = [ [Int
a,Int
b] | Int
a <- [Int
1..Int
315], Int
b <- [Int
a..Int
315] ]
                    k :: [Int]
k = [Int
1..]

-- Random Tensors

randRats :: IO [Rational]
randRats :: IO [Rational]
randRats = do
            TFGen
gen <- IO TFGen
newTFGen
            let randList' :: [Int]
randList' = (Int, Int) -> TFGen -> [Int]
forall a g. (Random a, RandomGen g) => (a, a) -> g -> [a]
randomRs (-Int
10000,Int
10000) TFGen
gen :: [Int]
            let randList :: [Rational]
randList = (Int -> Rational) -> [Int] -> [Rational]
forall a b. (a -> b) -> [a] -> [b]
map Int -> Rational
forall a b. (Integral a, Num b) => a -> b
fromIntegral [Int]
randList'
            [Rational] -> IO [Rational]
forall (m :: * -> *) a. Monad m => a -> m a
return [Rational]
randList

randArea :: IO (ATens 0 1 0 0 0 0 (SField Rational))
randArea :: IO (ATens 0 1 0 0 0 0 (SField Rational))
randArea = do
              [Rational]
randList <- IO [Rational]
randRats
              let inds :: [(IndList 0 a, IndList 1 Ind20, IndList 0 a, IndList 0 a,
  IndList 0 a, IndList 0 a)]
inds = (Int
 -> (IndList 0 a, IndList 1 Ind20, IndList 0 a, IndList 0 a,
     IndList 0 a, IndList 0 a))
-> [Int]
-> [(IndList 0 a, IndList 1 Ind20, IndList 0 a, IndList 0 a,
     IndList 0 a, IndList 0 a)]
forall a b. (a -> b) -> [a] -> [b]
map (\Int
i -> (IndList 0 a
forall a. IndList 0 a
Empty, Ind20 -> IndList 1 Ind20
forall a. a -> IndList 1 a
singletonInd (Ind20 -> IndList 1 Ind20) -> Ind20 -> IndList 1 Ind20
forall a b. (a -> b) -> a -> b
$ Int -> Ind20
Ind20 Int
i, IndList 0 a
forall a. IndList 0 a
Empty, IndList 0 a
forall a. IndList 0 a
Empty, IndList 0 a
forall a. IndList 0 a
Empty, IndList 0 a
forall a. IndList 0 a
Empty)) [Int
0..Int
20]
              ATens 0 1 0 0 0 0 (SField Rational)
-> IO (ATens 0 1 0 0 0 0 (SField Rational))
forall (m :: * -> *) a. Monad m => a -> m a
return (ATens 0 1 0 0 0 0 (SField Rational)
 -> IO (ATens 0 1 0 0 0 0 (SField Rational)))
-> ATens 0 1 0 0 0 0 (SField Rational)
-> IO (ATens 0 1 0 0 0 0 (SField Rational))
forall a b. (a -> b) -> a -> b
$ [(IndTuple6 0 1 0 0 0 0 Ind20 Ind9 Ind3, SField Rational)]
-> ATens 0 1 0 0 0 0 (SField Rational)
forall k1 k2 k3 v (n1 :: Nat) (n2 :: Nat) (n3 :: Nat) (n4 :: Nat)
       (n5 :: Nat) (n6 :: Nat).
(TIndex k1, TIndex k2, TIndex k3, TAdd v) =>
[(IndTuple6 n1 n2 n3 n4 n5 n6 k1 k2 k3, v)]
-> AbsTensor6 n1 n2 n3 n4 n5 n6 k1 k2 k3 v
fromListT6 ([(IndTuple6 0 1 0 0 0 0 Ind20 Ind9 Ind3, SField Rational)]
 -> ATens 0 1 0 0 0 0 (SField Rational))
-> [(IndTuple6 0 1 0 0 0 0 Ind20 Ind9 Ind3, SField Rational)]
-> ATens 0 1 0 0 0 0 (SField Rational)
forall a b. (a -> b) -> a -> b
$ [IndTuple6 0 1 0 0 0 0 Ind20 Ind9 Ind3]
-> [SField Rational]
-> [(IndTuple6 0 1 0 0 0 0 Ind20 Ind9 Ind3, SField Rational)]
forall a b. [a] -> [b] -> [(a, b)]
zip [IndTuple6 0 1 0 0 0 0 Ind20 Ind9 Ind3]
forall a a a a a.
[(IndList 0 a, IndList 1 Ind20, IndList 0 a, IndList 0 a,
  IndList 0 a, IndList 0 a)]
inds ([SField Rational]
 -> [(IndTuple6 0 1 0 0 0 0 Ind20 Ind9 Ind3, SField Rational)])
-> [SField Rational]
-> [(IndTuple6 0 1 0 0 0 0 Ind20 Ind9 Ind3, SField Rational)]
forall a b. (a -> b) -> a -> b
$ (Rational -> SField Rational) -> [Rational] -> [SField Rational]
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap Rational -> SField Rational
forall a. a -> SField a
SField [Rational]
randList

randAxon :: IO (ATens 0 1 0 0 0 0 (SField Rational))
randAxon :: IO (ATens 0 1 0 0 0 0 (SField Rational))
randAxon = do
              [Rational]
randList <- IO [Rational]
randRats
              let inds :: [(IndList 0 a, IndList 1 Ind20, IndList 0 a, IndList 0 a,
  IndList 0 a, IndList 0 a)]
inds = (Int
 -> (IndList 0 a, IndList 1 Ind20, IndList 0 a, IndList 0 a,
     IndList 0 a, IndList 0 a))
-> [Int]
-> [(IndList 0 a, IndList 1 Ind20, IndList 0 a, IndList 0 a,
     IndList 0 a, IndList 0 a)]
forall a b. (a -> b) -> [a] -> [b]
map (\Int
i -> (IndList 0 a
forall a. IndList 0 a
Empty, Ind20 -> IndList 1 Ind20
forall a. a -> IndList 1 a
singletonInd (Ind20 -> IndList 1 Ind20) -> Ind20 -> IndList 1 Ind20
forall a b. (a -> b) -> a -> b
$ Int -> Ind20
Ind20 Int
i, IndList 0 a
forall a. IndList 0 a
Empty, IndList 0 a
forall a. IndList 0 a
Empty, IndList 0 a
forall a. IndList 0 a
Empty, IndList 0 a
forall a. IndList 0 a
Empty)) [Int
5,Int
9,Int
12]
              let randInd :: SField Rational
randInd = Rational -> SField Rational
forall a. a -> SField a
SField (Rational -> SField Rational) -> Rational -> SField Rational
forall a b. (a -> b) -> a -> b
$ [Rational] -> Rational
forall a. [a] -> a
head [Rational]
randList
              let assocs :: [(IndTuple6 0 1 0 0 0 0 Ind20 Ind9 Ind3, SField Rational)]
assocs = [IndTuple6 0 1 0 0 0 0 Ind20 Ind9 Ind3]
-> [SField Rational]
-> [(IndTuple6 0 1 0 0 0 0 Ind20 Ind9 Ind3, SField Rational)]
forall a b. [a] -> [b] -> [(a, b)]
zip [IndTuple6 0 1 0 0 0 0 Ind20 Ind9 Ind3]
forall a a a a a.
[(IndList 0 a, IndList 1 Ind20, IndList 0 a, IndList 0 a,
  IndList 0 a, IndList 0 a)]
inds [-SField Rational
randInd, SField Rational
randInd, -SField Rational
randInd]
              let tens :: ATens 0 1 0 0 0 0 (SField Rational)
tens = [(IndTuple6 0 1 0 0 0 0 Ind20 Ind9 Ind3, SField Rational)]
-> ATens 0 1 0 0 0 0 (SField Rational)
forall k1 k2 k3 v (n1 :: Nat) (n2 :: Nat) (n3 :: Nat) (n4 :: Nat)
       (n5 :: Nat) (n6 :: Nat).
(TIndex k1, TIndex k2, TIndex k3, TAdd v) =>
[(IndTuple6 n1 n2 n3 n4 n5 n6 k1 k2 k3, v)]
-> AbsTensor6 n1 n2 n3 n4 n5 n6 k1 k2 k3 v
fromListT6 [(IndTuple6 0 1 0 0 0 0 Ind20 Ind9 Ind3, SField Rational)]
assocs
              ATens 0 1 0 0 0 0 (SField Rational)
-> IO (ATens 0 1 0 0 0 0 (SField Rational))
forall (m :: * -> *) a. Monad m => a -> m a
return ATens 0 1 0 0 0 0 (SField Rational)
tens

randFlatArea :: IO (ATens 0 1 0 0 0 0 (SField Rational))
randFlatArea :: IO (ATens 0 1 0 0 0 0 (SField Rational))
randFlatArea = do
                  [Rational]
randList <- IO [Rational]
randRats
                  let assocs :: [(IndTuple6 0 1 0 0 0 0 Ind20 Ind9 Ind3, SField Rational)]
assocs = ((Int, Rational)
 -> (IndTuple6 0 1 0 0 0 0 Ind20 Ind9 Ind3, SField Rational))
-> [(Int, Rational)]
-> [(IndTuple6 0 1 0 0 0 0 Ind20 Ind9 Ind3, SField Rational)]
forall a b. (a -> b) -> [a] -> [b]
map (\(Int
i,Rational
v) -> ( (IndList 0 Ind20
forall a. IndList 0 a
Empty, Ind20 -> IndList 1 Ind20
forall a. a -> IndList 1 a
singletonInd (Ind20 -> IndList 1 Ind20) -> Ind20 -> IndList 1 Ind20
forall a b. (a -> b) -> a -> b
$ Int -> Ind20
Ind20 Int
i, IndList 0 Ind9
forall a. IndList 0 a
Empty, IndList 0 Ind9
forall a. IndList 0 a
Empty, IndList 0 Ind3
forall a. IndList 0 a
Empty, IndList 0 Ind3
forall a. IndList 0 a
Empty), Rational -> SField Rational
forall a. a -> SField a
SField Rational
v))
                         [(Int
0, -Rational
1 Rational -> Rational -> Rational
forall a. Num a => a -> a -> a
* [Rational] -> Rational
forall a. [a] -> a
head [Rational]
randList),(Int
5, [Rational]
randList [Rational] -> Int -> Rational
forall a. [a] -> Int -> a
!! Int
3),(Int
6, -Rational
1 Rational -> Rational -> Rational
forall a. Num a => a -> a -> a
* [Rational]
randList [Rational] -> Int -> Rational
forall a. [a] -> Int -> a
!! Int
1),(Int
9, -Rational
1 Rational -> Rational -> Rational
forall a. Num a => a -> a -> a
* [Rational]
randList [Rational] -> Int -> Rational
forall a. [a] -> Int -> a
!! Int
4),(Int
11, -Rational
1 Rational -> Rational -> Rational
forall a. Num a => a -> a -> a
* [Rational]
randList [Rational] -> Int -> Rational
forall a. [a] -> Int -> a
!! Int
2),(Int
12, [Rational]
randList [Rational] -> Int -> Rational
forall a. [a] -> Int -> a
!! Int
5),(Int
15, [Rational] -> Rational
forall a. [a] -> a
head [Rational]
randList),(Int
18, [Rational]
randList [Rational] -> Int -> Rational
forall a. [a] -> Int -> a
!! Int
1),(Int
20, [Rational]
randList [Rational] -> Int -> Rational
forall a. [a] -> Int -> a
!! Int
2)]
                  let tens :: ATens 0 1 0 0 0 0 (SField Rational)
tens = [(IndTuple6 0 1 0 0 0 0 Ind20 Ind9 Ind3, SField Rational)]
-> ATens 0 1 0 0 0 0 (SField Rational)
forall k1 k2 k3 v (n1 :: Nat) (n2 :: Nat) (n3 :: Nat) (n4 :: Nat)
       (n5 :: Nat) (n6 :: Nat).
(TIndex k1, TIndex k2, TIndex k3, TAdd v) =>
[(IndTuple6 n1 n2 n3 n4 n5 n6 k1 k2 k3, v)]
-> AbsTensor6 n1 n2 n3 n4 n5 n6 k1 k2 k3 v
fromListT6 [(IndTuple6 0 1 0 0 0 0 Ind20 Ind9 Ind3, SField Rational)]
assocs
                  ATens 0 1 0 0 0 0 (SField Rational)
-> IO (ATens 0 1 0 0 0 0 (SField Rational))
forall (m :: * -> *) a. Monad m => a -> m a
return ATens 0 1 0 0 0 0 (SField Rational)
tens


randAreaDerivative1 :: IO (ATens 0 1 0 0 0 1 (SField Rational))
randAreaDerivative1 :: IO (ATens 0 1 0 0 0 1 (SField Rational))
randAreaDerivative1 = do
                         [Rational]
randList <- IO [Rational]
randRats
                         let inds :: [(IndList 0 a, IndList 1 Ind20, IndList 0 a, IndList 0 a,
  IndList 0 a, IndList 1 Ind3)]
inds = [ Int
-> Int
-> (IndList 0 a, IndList 1 Ind20, IndList 0 a, IndList 0 a,
    IndList 0 a, IndList 1 Ind3)
forall a a a a.
Int
-> Int
-> (IndList 0 a, IndList 1 Ind20, IndList 0 a, IndList 0 a,
    IndList 0 a, IndList 1 Ind3)
f Int
a Int
p | Int
a <- [Int
0..Int
20], Int
p <- [Int
0..Int
3]]
                         ATens 0 1 0 0 0 1 (SField Rational)
-> IO (ATens 0 1 0 0 0 1 (SField Rational))
forall (m :: * -> *) a. Monad m => a -> m a
return (ATens 0 1 0 0 0 1 (SField Rational)
 -> IO (ATens 0 1 0 0 0 1 (SField Rational)))
-> ATens 0 1 0 0 0 1 (SField Rational)
-> IO (ATens 0 1 0 0 0 1 (SField Rational))
forall a b. (a -> b) -> a -> b
$ [(IndTuple6 0 1 0 0 0 1 Ind20 Ind9 Ind3, SField Rational)]
-> ATens 0 1 0 0 0 1 (SField Rational)
forall k1 k2 k3 v (n1 :: Nat) (n2 :: Nat) (n3 :: Nat) (n4 :: Nat)
       (n5 :: Nat) (n6 :: Nat).
(TIndex k1, TIndex k2, TIndex k3, TAdd v) =>
[(IndTuple6 n1 n2 n3 n4 n5 n6 k1 k2 k3, v)]
-> AbsTensor6 n1 n2 n3 n4 n5 n6 k1 k2 k3 v
fromListT6 ([(IndTuple6 0 1 0 0 0 1 Ind20 Ind9 Ind3, SField Rational)]
 -> ATens 0 1 0 0 0 1 (SField Rational))
-> [(IndTuple6 0 1 0 0 0 1 Ind20 Ind9 Ind3, SField Rational)]
-> ATens 0 1 0 0 0 1 (SField Rational)
forall a b. (a -> b) -> a -> b
$ [IndTuple6 0 1 0 0 0 1 Ind20 Ind9 Ind3]
-> [SField Rational]
-> [(IndTuple6 0 1 0 0 0 1 Ind20 Ind9 Ind3, SField Rational)]
forall a b. [a] -> [b] -> [(a, b)]
zip [IndTuple6 0 1 0 0 0 1 Ind20 Ind9 Ind3]
forall a a a a.
[(IndList 0 a, IndList 1 Ind20, IndList 0 a, IndList 0 a,
  IndList 0 a, IndList 1 Ind3)]
inds ([SField Rational]
 -> [(IndTuple6 0 1 0 0 0 1 Ind20 Ind9 Ind3, SField Rational)])
-> [SField Rational]
-> [(IndTuple6 0 1 0 0 0 1 Ind20 Ind9 Ind3, SField Rational)]
forall a b. (a -> b) -> a -> b
$ (Rational -> SField Rational) -> [Rational] -> [SField Rational]
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap Rational -> SField Rational
forall a. a -> SField a
SField [Rational]
randList
                 where f :: Int
-> Int
-> (IndList 0 a, IndList 1 Ind20, IndList 0 a, IndList 0 a,
    IndList 0 a, IndList 1 Ind3)
f Int
a Int
p = (IndList 0 a
forall a. IndList 0 a
Empty, Ind20 -> IndList 1 Ind20
forall a. a -> IndList 1 a
singletonInd (Ind20 -> IndList 1 Ind20) -> Ind20 -> IndList 1 Ind20
forall a b. (a -> b) -> a -> b
$ Int -> Ind20
Ind20 Int
a, IndList 0 a
forall a. IndList 0 a
Empty, IndList 0 a
forall a. IndList 0 a
Empty, IndList 0 a
forall a. IndList 0 a
Empty, Ind3 -> IndList 1 Ind3
forall a. a -> IndList 1 a
singletonInd (Ind3 -> IndList 1 Ind3) -> Ind3 -> IndList 1 Ind3
forall a b. (a -> b) -> a -> b
$ Int -> Ind3
Ind3 Int
p)


randAreaDerivative2 :: IO (ATens 0 1 0 1 0 0 (SField Rational))
randAreaDerivative2 :: IO (ATens 0 1 0 1 0 0 (SField Rational))
randAreaDerivative2 = do
                         [Rational]
randList <- IO [Rational]
randRats
                         let inds :: [(IndList 0 a, IndList 1 Ind20, IndList 0 a, IndList 1 Ind9,
  IndList 0 a, IndList 0 a)]
inds = [ Int
-> Int
-> (IndList 0 a, IndList 1 Ind20, IndList 0 a, IndList 1 Ind9,
    IndList 0 a, IndList 0 a)
forall a a a a.
Int
-> Int
-> (IndList 0 a, IndList 1 Ind20, IndList 0 a, IndList 1 Ind9,
    IndList 0 a, IndList 0 a)
f Int
a Int
i | Int
a <- [Int
0..Int
20], Int
i <- [Int
0..Int
9]]
                         ATens 0 1 0 1 0 0 (SField Rational)
-> IO (ATens 0 1 0 1 0 0 (SField Rational))
forall (m :: * -> *) a. Monad m => a -> m a
return (ATens 0 1 0 1 0 0 (SField Rational)
 -> IO (ATens 0 1 0 1 0 0 (SField Rational)))
-> ATens 0 1 0 1 0 0 (SField Rational)
-> IO (ATens 0 1 0 1 0 0 (SField Rational))
forall a b. (a -> b) -> a -> b
$ [(IndTuple6 0 1 0 1 0 0 Ind20 Ind9 Ind3, SField Rational)]
-> ATens 0 1 0 1 0 0 (SField Rational)
forall k1 k2 k3 v (n1 :: Nat) (n2 :: Nat) (n3 :: Nat) (n4 :: Nat)
       (n5 :: Nat) (n6 :: Nat).
(TIndex k1, TIndex k2, TIndex k3, TAdd v) =>
[(IndTuple6 n1 n2 n3 n4 n5 n6 k1 k2 k3, v)]
-> AbsTensor6 n1 n2 n3 n4 n5 n6 k1 k2 k3 v
fromListT6 ([(IndTuple6 0 1 0 1 0 0 Ind20 Ind9 Ind3, SField Rational)]
 -> ATens 0 1 0 1 0 0 (SField Rational))
-> [(IndTuple6 0 1 0 1 0 0 Ind20 Ind9 Ind3, SField Rational)]
-> ATens 0 1 0 1 0 0 (SField Rational)
forall a b. (a -> b) -> a -> b
$ [IndTuple6 0 1 0 1 0 0 Ind20 Ind9 Ind3]
-> [SField Rational]
-> [(IndTuple6 0 1 0 1 0 0 Ind20 Ind9 Ind3, SField Rational)]
forall a b. [a] -> [b] -> [(a, b)]
zip [IndTuple6 0 1 0 1 0 0 Ind20 Ind9 Ind3]
forall a a a a.
[(IndList 0 a, IndList 1 Ind20, IndList 0 a, IndList 1 Ind9,
  IndList 0 a, IndList 0 a)]
inds ([SField Rational]
 -> [(IndTuple6 0 1 0 1 0 0 Ind20 Ind9 Ind3, SField Rational)])
-> [SField Rational]
-> [(IndTuple6 0 1 0 1 0 0 Ind20 Ind9 Ind3, SField Rational)]
forall a b. (a -> b) -> a -> b
$ (Rational -> SField Rational) -> [Rational] -> [SField Rational]
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap Rational -> SField Rational
forall a. a -> SField a
SField [Rational]
randList
                 where f :: Int
-> Int
-> (IndList 0 a, IndList 1 Ind20, IndList 0 a, IndList 1 Ind9,
    IndList 0 a, IndList 0 a)
f Int
a Int
i = (IndList 0 a
forall a. IndList 0 a
Empty, Ind20 -> IndList 1 Ind20
forall a. a -> IndList 1 a
singletonInd (Ind20 -> IndList 1 Ind20) -> Ind20 -> IndList 1 Ind20
forall a b. (a -> b) -> a -> b
$ Int -> Ind20
Ind20 Int
a, IndList 0 a
forall a. IndList 0 a
Empty, Ind9 -> IndList 1 Ind9
forall a. a -> IndList 1 a
singletonInd (Ind9 -> IndList 1 Ind9) -> Ind9 -> IndList 1 Ind9
forall a b. (a -> b) -> a -> b
$ Int -> Ind9
Ind9 Int
i, IndList 0 a
forall a. IndList 0 a
Empty, IndList 0 a
forall a. IndList 0 a
Empty)


randMetric :: IO (ATens 0 0 0 1 0 0 (SField Rational))
randMetric :: IO (ATens 0 0 0 1 0 0 (SField Rational))
randMetric = do
                [Rational]
randList <- IO [Rational]
randRats
                let inds :: [(IndList 0 a, IndList 0 a, IndList 0 a, IndList 1 Ind9,
  IndList 0 a, IndList 0 a)]
inds = (Int
 -> (IndList 0 a, IndList 0 a, IndList 0 a, IndList 1 Ind9,
     IndList 0 a, IndList 0 a))
-> [Int]
-> [(IndList 0 a, IndList 0 a, IndList 0 a, IndList 1 Ind9,
     IndList 0 a, IndList 0 a)]
forall a b. (a -> b) -> [a] -> [b]
map (\Int
i -> (IndList 0 a
forall a. IndList 0 a
Empty, IndList 0 a
forall a. IndList 0 a
Empty, IndList 0 a
forall a. IndList 0 a
Empty, Ind9 -> IndList 1 Ind9
forall a. a -> IndList 1 a
singletonInd (Ind9 -> IndList 1 Ind9) -> Ind9 -> IndList 1 Ind9
forall a b. (a -> b) -> a -> b
$ Int -> Ind9
Ind9 Int
i, IndList 0 a
forall a. IndList 0 a
Empty, IndList 0 a
forall a. IndList 0 a
Empty)) [Int
0..Int
20]
                ATens 0 0 0 1 0 0 (SField Rational)
-> IO (ATens 0 0 0 1 0 0 (SField Rational))
forall (m :: * -> *) a. Monad m => a -> m a
return (ATens 0 0 0 1 0 0 (SField Rational)
 -> IO (ATens 0 0 0 1 0 0 (SField Rational)))
-> ATens 0 0 0 1 0 0 (SField Rational)
-> IO (ATens 0 0 0 1 0 0 (SField Rational))
forall a b. (a -> b) -> a -> b
$ [(IndTuple6 0 0 0 1 0 0 Ind20 Ind9 Ind3, SField Rational)]
-> ATens 0 0 0 1 0 0 (SField Rational)
forall k1 k2 k3 v (n1 :: Nat) (n2 :: Nat) (n3 :: Nat) (n4 :: Nat)
       (n5 :: Nat) (n6 :: Nat).
(TIndex k1, TIndex k2, TIndex k3, TAdd v) =>
[(IndTuple6 n1 n2 n3 n4 n5 n6 k1 k2 k3, v)]
-> AbsTensor6 n1 n2 n3 n4 n5 n6 k1 k2 k3 v
fromListT6 ([(IndTuple6 0 0 0 1 0 0 Ind20 Ind9 Ind3, SField Rational)]
 -> ATens 0 0 0 1 0 0 (SField Rational))
-> [(IndTuple6 0 0 0 1 0 0 Ind20 Ind9 Ind3, SField Rational)]
-> ATens 0 0 0 1 0 0 (SField Rational)
forall a b. (a -> b) -> a -> b
$ [IndTuple6 0 0 0 1 0 0 Ind20 Ind9 Ind3]
-> [SField Rational]
-> [(IndTuple6 0 0 0 1 0 0 Ind20 Ind9 Ind3, SField Rational)]
forall a b. [a] -> [b] -> [(a, b)]
zip [IndTuple6 0 0 0 1 0 0 Ind20 Ind9 Ind3]
forall a a a a a.
[(IndList 0 a, IndList 0 a, IndList 0 a, IndList 1 Ind9,
  IndList 0 a, IndList 0 a)]
inds ([SField Rational]
 -> [(IndTuple6 0 0 0 1 0 0 Ind20 Ind9 Ind3, SField Rational)])
-> [SField Rational]
-> [(IndTuple6 0 0 0 1 0 0 Ind20 Ind9 Ind3, SField Rational)]
forall a b. (a -> b) -> a -> b
$ (Rational -> SField Rational) -> [Rational] -> [SField Rational]
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap Rational -> SField Rational
forall a. a -> SField a
SField [Rational]
randList