-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathLuke.jl
More file actions
75 lines (58 loc) · 3.21 KB
/
Copy pathLuke.jl
File metadata and controls
75 lines (58 loc) · 3.21 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
import Decapodes
using StructEquality
@struct_hash_equal struct TypedApplication
fn::Function
sorts::Vector{Sort}
end
const TA = TypedApplication
function Base.show(io::IOBuffer, ta::TA)
print(io, Expr(:call, ta.fn, ta.sorts...))
end
function precompute_matrices(sd, hodge)::Dict{TypedApplication, Any}
Dict{TypedApplication, Any}(
# Regular Hodge Stars
TA(★, Sort[PrimalForm(0)]) => Decapodes.dec_mat_hodge(0, sd, hodge),
TA(★, Sort[PrimalForm(1)]) => Decapodes.dec_mat_hodge(1, sd, hodge),
TA(★, Sort[PrimalForm(2)]) => Decapodes.dec_mat_hodge(2, sd, hodge),
# Inverse Hodge Stars
TA(★, Sort[DualForm(0)]) => Decapodes.dec_mat_inverse_hodge(1, sd, hodge), # why is this 1???
TA(★, Sort[DualForm(1)]) => Decapodes.dec_pair_inv_hodge(Val{1}, sd, hodge), # Special since Geo is a solver
TA(★, Sort[DualForm(2)]) => Decapodes.dec_mat_inverse_hodge(0, sd, hodge),
# Differentials
TA(d, Sort[PrimalForm(0)]) => Decapodes.dec_mat_differential(0, sd),
TA(d, Sort[PrimalForm(1)]) => Decapodes.dec_mat_differential(1, sd),
# Dual Differentials
TA(d, Sort[DualForm(0)]) => Decapodes.dec_mat_dual_differential(0, sd),
TA(d, Sort[DualForm(1)]) => Decapodes.dec_mat_dual_differential(1, sd),
# Wedge Products
TA(∧, Sort[PrimalForm(0), PrimalForm(1)]) => Decapodes.dec_pair_wedge_product(Tuple{0,1}, sd),
TA(∧, Sort[PrimalForm(1), PrimalForm(0)]) => Decapodes.dec_pair_wedge_product(Tuple{1,0}, sd),
TA(∧, Sort[PrimalForm(0), PrimalForm(2)]) => Decapodes.dec_pair_wedge_product(Tuple{0,2}, sd),
TA(∧, Sort[PrimalForm(2), PrimalForm(0)]) => Decapodes.dec_pair_wedge_product(Tuple{2,0}, sd),
TA(∧, Sort[PrimalForm(1), PrimalForm(1)]) => Decapodes.dec_pair_wedge_product(Tuple{1,1}, sd),
# Primal-Dual Wedge Products
TA(∧, Sort[PrimalForm(1), DualForm(1)]) => Decapodes.dec_wedge_product_pd(Tuple{1,1}, sd),
TA(∧, Sort[PrimalForm(0), DualForm(1)]) => Decapodes.dec_wedge_product_pd(Tuple{0,1}, sd),
TA(∧, Sort[PrimalForm(1), DualForm(1)]) => Decapodes.dec_wedge_product_dp(Tuple{1,1}, sd),
TA(∧, Sort[PrimalForm(1), DualForm(0)]) => Decapodes.dec_wedge_product_dp(Tuple{1,0}, sd),
# Dual-Dual Wedge Products
# TA(∧, Sort[DualForm(1), DualForm(1)]) => Decapodes.dec_wedge_product_dd(Tuple{1,1}, sd),
TA(∧, Sort[DualForm(1), DualForm(0)]) => Decapodes.dec_wedge_product_dd(Tuple{1,0}, sd),
TA(∧, Sort[DualForm(0), DualForm(1)]) => Decapodes.dec_wedge_product_dd(Tuple{0,1}, sd),
# # Dual-Dual Interior Products
# :ι₁₁ => interior_product_dd(Tuple{1,1}, sd)
# :ι₁₂ => interior_product_dd(Tuple{1,2}, sd)
# # Dual-Dual Lie Derivatives
# :ℒ₁ => ℒ_dd(Tuple{1,1}, sd)
# # Dual Laplacians
# :Δᵈ₀ => Δᵈ(Val{0},sd)
# :Δᵈ₁ => Δᵈ(Val{1},sd)
# # Musical Isomorphisms
# :♯ => Decapodes.dec_♯_p(sd)
# :♯ᵈ => Decapodes.dec_♯_d(sd)
# :♭ => Decapodes.dec_♭(sd)
# # Averaging Operator
# :avg₀₁ => Decapodes.dec_avg₀₁(sd)
# :neg => x -> -1 .* x
)
end