Skip to content

Support libgap conversion for general and relative number fields - #42435

Merged
vbraun merged 3 commits into
sagemath:developfrom
cxzhong:libgap_number_field
Oct 28, 2026
Merged

vbraun merged 3 commits into
sagemath:developfrom
cxzhong:libgap_number_field

Conversation

@cxzhong

@cxzhong cxzhong commented Jun 27, 2026

Copy link
Copy Markdown
Contributor

📚 Description

Extend libgap(...) conversion beyond cyclotomic fields so that matrix
groups (and Coxeter groups) over number fields can use the GAP backend.

  • NumberFieldElement._libgap_ converts both absolute and relative fields
    via the GAP algebraic-extension tower. Relative elements use the relative
    power-basis coordinates (self.list()), which match GAP's generator even
    when it is not an absolute primitive element of the field.
  • NumberField_generic._libgap_ builds relative fields as towers of GAP
    algebraic extensions, and is now cached.
  • The reverse conversion is centralized in _convert_from_gap_string, which
    strips GAP's ! constant markers and interprets cyclotomic E(n) in the
    field tower rather than in the universal cyclotomic field.

This is split out from #42383 (CoxeterGroup default base ring), which depends
on this conversion support but is reviewed separately.

📝 Checklist

  • The title is concise and informative.
  • I have linked a relevant issue or PR.
  • I have created tests covering the changes.
  • I have updated the documentation accordingly.

@github-actions

github-actions Bot commented Jun 27, 2026 •

Copy link
Copy Markdown

Documentation preview for this PR (built with commit 43b327b; changes) is ready! 🎉
This preview will update shortly after each push to this PR.

@dimpase
dimpase force-pushed the libgap_number_field branch from ae7342c to 65e8774 Compare October 3, 2026 01:50
@cxzhong
cxzhong force-pushed the libgap_number_field branch from 65e8774 to 8cedc4a Compare October 5, 2026 15:03
@dimpase
dimpase force-pushed the libgap_number_field branch from 8cedc4a to d68c929 Compare October 20, 2026 16:14
Extend libgap(...) conversion beyond cyclotomic fields so matrix groups
(and Coxeter groups) over number fields use the GAP backend.

- NumberFieldElement._libgap_ converts absolute and relative fields via
  the GAP algebraic-extension tower. Relative elements use the relative
  power-basis coordinates (self.list()), which match GAP's generator even
  when it is not an absolute primitive element of the field.
- NumberField_generic._libgap_ builds relative fields as towers of GAP
  algebraic extensions, and is now cached.
- The reverse conversion is centralized in _convert_from_gap_string,
  which strips GAP's '!' constant markers and interprets cyclotomic
  'E(n)' in the field tower rather than the universal cyclotomic field.
@dimpase
dimpase force-pushed the libgap_number_field branch from d68c929 to 43b327b Compare October 24, 2026 06:46
@dimpase

dimpase commented Oct 24, 2026

Copy link
Copy Markdown
Member

@codex review

(an experiment)

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 24, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-24T06:56:05.632180Z 43b327b Manual request
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Bravo.

Reviewed commit: 43b327baee

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@dimpase dimpase left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

ok.

vbraun pushed a commit to vbraun/sage that referenced this pull request Oct 27, 2026
Release Manager
sagemathgh-42435: Support libgap conversion for general and relative number fields
    
### 📚 Description

Extend `libgap(...)` conversion beyond cyclotomic fields so that matrix
groups (and Coxeter groups) over number fields can use the GAP backend.

- `NumberFieldElement._libgap_` converts both absolute and relative
fields
  via the GAP algebraic-extension tower. Relative elements use the
relative
  power-basis coordinates (`self.list()`), which match GAP's generator
even
  when it is not an absolute primitive element of the field.
- `NumberField_generic._libgap_` builds relative fields as towers of GAP
  algebraic extensions, and is now cached.
- The reverse conversion is centralized in `_convert_from_gap_string`,
which
  strips GAP's `!` constant markers and interprets cyclotomic `E(n)` in
the
  field tower rather than in the universal cyclotomic field.

This is split out from sagemath#42383 (CoxeterGroup default base ring), which
depends
on this conversion support but is reviewed separately.

### 📝 Checklist

- [x] The title is concise and informative.
- [x] I have linked a relevant issue or PR.
- [ ] I have created tests covering the changes.
- [ ] I have updated the documentation accordingly.
    
URL: sagemath#42435
Reported by: Chenxin Zhong
Reviewer(s): Dima Pasechnik, Frédéric Chapoton
@cxzhong

cxzhong commented Oct 27, 2026

Copy link
Copy Markdown
Contributor Author

@codex review

(an experiment)

Great

@vbraun
vbraun merged commit 4a1f623 into sagemath:develop Oct 28, 2026
24 of 25 checks passed
@cxzhong
cxzhong deleted the libgap_number_field branch October 30, 2026 10:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants