Skip to content

Add Embedding and Projection for direct sums of rings - #6702

Merged
fingolfin merged 7 commits into
masterfrom
embed2
Oct 15, 2026
Merged

fingolfin merged 7 commits into
masterfrom
embed2

Conversation

@cdwensley

@cdwensley cdwensley commented Oct 8, 2026 •

Copy link
Copy Markdown
Contributor

These small additions were originally in PR #6618 but, as advised, have been moved to a separate PR.
Having added Embedding and Projection for direct sums of algebras, it seemed sensible to provide the same for rings since DirectSum sets up an info record with empty info.embeddings and info.projections.

The first method for DirectSumOp in ringsc.gi initialises info.first as [1], but the second method (which gets called in the example used here) uses [0]. (That was why [0] was used in the methods for algebras.) To fix this inconsistency, the first method has been changed to [0]. Whether this method is used anywhere, and whether some test now fails, remains to be seen!

@codecov

codecov Bot commented Oct 8, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 93.33333% with 3 lines in your changes missing coverage. Please review.
✅ Project coverage is 79.65%. Comparing base (678f3a8) to head (7531248).
⚠️ Report is 45 commits behind head on master.

Files with missing lines Patch % Lines
lib/ringsc.gi 93.18% 3 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #6702      +/-   ##
==========================================
+ Coverage   79.36%   79.65%   +0.28%     
==========================================
  Files         683      684       +1     
  Lines      295286   295641     +355     
  Branches     8646     8655       +9     
==========================================
+ Hits       234366   235485    +1119     
+ Misses      59106    58329     -777     
- Partials     1814     1827      +13     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@fingolfin fingolfin 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.

Thanks for splitting this off. The inline comments have the details on the code; two general points here.

Tests. This PR has no test file, only the two manual examples, and both use whole small rings, where everything works. Please add tst/testinstall/ring-dsum.tst (or a similar name) which also covers a sum of subrings, a sum of three rings, and a check like ForAll( R, x -> ( x ^ Embedding( D, i ) ) ^ Projection( D, i ) = x ). As in #6618, let Test( file, rec( rewriteToFile := file ) ) write the expected output, so that the line breaks are right.

Your question about first. Changing the generic method from [1] to [0] breaks nothing: no code in GAP itself, and none in the packages I have installed, reads DirectSumInfo or its first component, and all checks here pass. Making the two methods agree is good. It does not make the new methods work for such sums, though; see the inline comment on the Embedding method.

AI disclosure: I used Claude Code (Opus 5.5) to review this PR. It built the branch, ran the examples quoted in the comments, and drafted the comments.

Comment thread lib/ringsc.gi Outdated
Comment thread lib/ringsc.gi Outdated
Comment thread lib/ringsc.gi Outdated
Comment thread lib/ringsc.gi
Comment thread lib/ringsc.gd Outdated
Comment thread lib/ringsc.gd Outdated
@cdwensley

Copy link
Copy Markdown
Contributor Author

Note: the direct sum of three rings A,B,C gives info.rings = [A,B,C] and not [(A(+)B),C] as with algebras.

@fingolfin fingolfin added release notes: use title For PRs: the title of this PR is suitable for direct use in the release notes kind: enhancement Label for issues suggesting enhancements; and for pull requests implementing enhancements topic: library labels Oct 13, 2026
@fingolfin fingolfin changed the title Embeddings/Projections for direct sums of rings Add Embedding and Projection for direct sums of rings Oct 13, 2026

@fingolfin fingolfin 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.

This is looking pretty good now. We could merge it, but perhaps you'd be inclined to add the subring test (I made a "change suggestion" you could apply with a click). Also some other very minor nits (not important)

Comment thread tst/testinstall/ring-dsum.tst
Comment thread lib/ringsc.gi Outdated
Comment thread lib/ringsc.gi Outdated
Comment thread lib/ringsc.gi Outdated
cdwensley and others added 4 commits October 14, 2026 18:47
Co-authored-by: Max Horn <max@quendi.de>
Co-authored-by: Max Horn <max@quendi.de>
Co-authored-by: Max Horn <max@quendi.de>
Co-authored-by: Max Horn <max@quendi.de>
@cdwensley

Copy link
Copy Markdown
Contributor Author

The extended test file runs well for me. Sorry about the "#A's - should have noticed that. All looks good now.

@fingolfin
fingolfin merged commit ec8870c into master Oct 15, 2026
34 checks passed
@fingolfin
fingolfin deleted the embed2 branch October 15, 2026 07:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

kind: enhancement Label for issues suggesting enhancements; and for pull requests implementing enhancements release notes: use title For PRs: the title of this PR is suitable for direct use in the release notes topic: library

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants