Skip to content

Conversation

@antonydellavecchia
Copy link
Collaborator

Extend betti_numbers function to accept optional parameter for the Field

@antonydellavecchia antonydellavecchia added topic: combinatorics release notes: use title For PRs: the title of this PR is suitable for direct use in the release notes labels Dec 2, 2025
function betti_numbers(F::Field, K::SimplicialComplex)
b = Int[]
q = characteristic(F)
L = iszero(q) ? QQ : fpField(UInt(q))
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This line makes the whole function type unstable, and thus inefficient.
Why do you even construct a new field here, and not just use F instead in the matrix constructions below?

Copy link
Collaborator Author

@antonydellavecchia antonydellavecchia Dec 2, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

GF(2) is slower than fpField(UInt(2))

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I just a change inputs to expects the characteristic instead.
maybe then I make it a keyword arg?

@lgoettgens lgoettgens changed the title Betti numbers over a given field betti_numbers(::SimplicialComplex) over a given field Dec 2, 2025
Copy link
Collaborator

@HechtiDerLachs HechtiDerLachs left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe it would be worthwhile to add
betti_numbers(R::Ring, S::SimplicialComplex) = betti_numbers(characteristic(R), S) ?
And betti_number([p::Int], S::SimplicialComplex, i::Int) to return only a single Betti number?

Another question I had: The function returns a list of integers. Is it clear that the first entry always stands for the 0-th Betti number, the second for the first, etc.? If yes, everything is fine. But otherwise, one could think of returning a dictionary?

Sorry for the delayed review, btw. The request slipped me through. Feel free to ping me through other channels if this happens again.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

release notes: use title For PRs: the title of this PR is suitable for direct use in the release notes topic: combinatorics

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants