Skip to content

RCWA package changes how free magma elements are printed (including group ring elements) #2020

@fingolfin

Description

@fingolfin

@cdwensley reported the following: With no packages loaded, one gets this:

gap> R := GroupRing( GF(2), Group( (1,2,3) ) );;
gap> z := Zero(R);
<zero> of ...

But if the RCWA package by @Stefan-Kohl is loaded, one gets this instead:

gap> R := GroupRing( GF(2), Group( (1,2,3) ) );;
gap> z := Zero(R);
0

The problem is caused by this method in RCWA, file lib/rcwamap.gi:3165:

InstallMethod( ViewObj,
              "for elements of group rings of rcwa groups (RCWA)",
              ReturnTrue, [ IsElementOfFreeMagmaRing ], 100,
 function ( elm )
...

The description string suggests this is "for elements of group rings of rcwa groups (RCWA)", but the type selector applies to arbitrary group rings, thus causing the breakage.

Actually, the function tries to restrict itself, via this check:

    l       := CoefficientsAndMagmaElements(elm);
    grpelms := l{[1,3..Length(l)-1]};
    coeffs  := l{[2,4..Length(l)]};
    if not ForAll(grpelms,IsRcwaMapping) then TryNextMethod(); fi;

But this fails for the zero element, because for that l is empty.

One fix therefore would be to simply change RCWA to also print <zero> of ..., like the library.

Alternatively, one could always perform the check on the one element, like so:

if not IsRcwaMapping(CoefficientsAndMagmaElements(One(elm))[1]) then
  TryNextMethod();
fi;

Metadata

Metadata

Assignees

Labels

kind: bugIssues describing general bugs, and PRs fixing themtopic: packagesissues or PRs related to package handling, or specific to a package (for packages w/o issue tracker)

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions