Skip to content

Commit 72ae82d

Browse files
committed
force conversion back from big
1 parent 5a84adc commit 72ae82d

2 files changed

Lines changed: 9 additions & 4 deletions

File tree

Project.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
name = "ElementaryPDESolutions"
22
uuid = "88a69b33-da0f-4502-8c8c-d680cf4d883b"
33
authors = ["Thomas G. Anderson", "Luiz M. Faria"]
4-
version = "0.3.0"
4+
version = "0.3.1"
55

66
[deps]
77
LinearAlgebra = "37e2e46d-f89d-539d-b4ee-838fcccc9c8e"

src/ElementaryPDESolutions.jl

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,10 @@ struct Polynomial{N, T}
3939
order2coeff::Dict{NTuple{N, Int}, T}
4040
end
4141

42+
function order2coeff(p::Polynomial{N, T}) where {N, T}
43+
return p.order2coeff
44+
end
45+
4246
# empty constructor
4347
Polynomial{N, T}() where {N, T} = Polynomial{N, T}(Dict{NTuple{N, Int}, T}())
4448

@@ -509,6 +513,7 @@ function solve_laplace(Q::Polynomial{N, T}) where {N, T}
509513
@assert is_homogeneous(Q) "source term `Q` must be a homogeneous polynomial"
510514
n = degree(Q)
511515
γ = (k, p) -> 2 * (k + 1) * (2k + 2p + N) # γₖᵖ
516+
# Note: convert to big for the intermediate computations, then back to T at the end
512517
cₖ = big(1) // γ(0, n) # c₀
513518
P = cₖ * multiply_by_r(deepcopy(Q), 2)
514519
ΔᵏQ = deepcopy(Q)
@@ -519,7 +524,7 @@ function solve_laplace(Q::Polynomial{N, T}) where {N, T}
519524
ΔP = cₖ * (multiply_by_r(ΔᵏQ, 2k + 2))
520525
P = P + ΔP
521526
end
522-
return P
527+
return convert_coefs(P, T)
523528
end
524529

525530
"""
@@ -558,7 +563,7 @@ function solve_anisotropic_laplace(A::AbstractMatrix{T}, Q::Polynomial{N, T}) wh
558563
ΔP = cₖ * (multiply_by_anisotropic_r(A, ΔᵏQ, 2k + 2))
559564
P = P + ΔP
560565
end
561-
return P
566+
return convert_coefs(P, T)
562567
end
563568

564569
"""
@@ -628,7 +633,7 @@ function solve_anisotropic_advect(β::AbstractVector, Q::Polynomial{N, T}) where
628633
betagradellq = sum(β[i] * gradient(betagradellq)[i] for i in 1:N)
629634
P = P + cₗ * multiply_by_anisotropic_β_r(β, betagradellq, l + 1)
630635
end
631-
return (1 / β2) * P
636+
return (1 / β2) * convert_coefs(P, T)
632637
end
633638

634639
"""

0 commit comments

Comments
 (0)