fix: index betti_numbers by ascending cohomological degree - #35
Merged
Conversation
For non-palindromic Poincaré polynomials, which occur for quivers with oriented cycles, the coefficients were listed by descending degree and the padding to length 2 dim + 1 used Float64 zeros; a monomial Poincaré polynomial crashed outright. Includes a regression test.
This was referenced Jul 14, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
betti_numbers(M)misbehaves whenever the Poincaré polynomial is not palindromic, which happens for quivers with oriented cycles (the moduli space is smooth but not projective, so Poincaré duality does not force symmetry). Three distinct defects:Singular.coefficients(P)returns coefficients leading-term-first, and the old code interleaved them with zeros in that order. For a non-palindromicPthis lists the Betti numbers by descending cohomological degree, sobetti[i]is notb_{2(i-1)}.Float64output. The zero-padding to length2 dim + 1usedzeros(...), whose default eltype isFloat64, promoting the wholeVector{Int}toVector{Float64}(e.g.[1.0, 0.0, ...]). This padding branch only fires whendeg P < 2 dim, which never happens in the palindromic examples the package usually runs on.P. WhenPis a single term (e.g. the round-trip quiver1 ⇄ 2withd = (1,1), whose moduli space isA^1withP = L),coeff[1:(end-1)]is empty andreduce(vcat, ...)throws.Fix
Build a
zeros(Int, 2 dim + 1)vector and place each coefficient at its true degree viazip(Singular.coefficients(P), Singular.exponent_vectors(P))(the same idiom already used inChow.jl). This is integer-valued, ascending-degree-indexed, and correct for a monomial or any gapped polynomial.Test
Adds a "Betti numbers" testset: the round-trip quiver (
A^1, expects[0, 0, 1]as aVector{Int}, which the old code failed on all three counts) plus the palindromic 6-fold as a no-regression guard. The existing doctests are palindromic and remain valid.