Skip to content

Commit

Permalink
adding number_of_monomials function
Browse files Browse the repository at this point in the history
  • Loading branch information
blociss committed Jun 25, 2024
1 parent d6838d3 commit e60eefc
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/GromovWitten.jl
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ export substitute
export sum_of_coeff
export sum_of_divisor_powers
export vector_to_monomial

export number_of_monomials
include("graph.jl")
include("coeftermV.jl")
include("coefterm.jl")
Expand Down
11 changes: 11 additions & 0 deletions src/quasimodular.jl
Original file line number Diff line number Diff line change
@@ -1,3 +1,14 @@
function number_of_monomials(w, d)
dp = zeros(Int, d + 1)
dp[1] = 1
for weight in w
for j in weight:d
dp[j+1] += dp[j-weight+1]
end
end

return dp[d+1]
end

#=function filter_term(pols::Union{QQMPolyRingElem, Int64}, variables::Vector{QQMPolyRingElem}, power::Vector{Int64})
T = parent(variables[1])
Expand Down
3 changes: 3 additions & 0 deletions test/quasimod.jl
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
@testset "quasimod.jl" begin
w = [2, 4, 6]
d = 12
@test number_of_monomials(w, d) == 7
import Nemo: QQFieldElem
S, (E2, E4, E6) = polynomial_ring(QQ, ["E2", "E4", "E6"])
R, q = polynomial_ring(QQ, ["q"])
Expand Down

0 comments on commit e60eefc

Please sign in to comment.