Skip to content

fix ConvertToMatrixRep, fix some Matrix calls#6396

Merged
fingolfin merged 4 commits into
gap-system:masterfrom
ThomasBreuer:TB_Matrix_trap
May 13, 2026
Merged

fix ConvertToMatrixRep, fix some Matrix calls#6396
fingolfin merged 4 commits into
gap-system:masterfrom
ThomasBreuer:TB_Matrix_trap

Conversation

@ThomasBreuer
Copy link
Copy Markdown
Contributor

Address the problem from #6389, for the moment without introducing BaseDomain for matrix groups.
I regard this pull request as an alternative to #6395.

As stated in #6389, calling Matrix( elm, Grep ) is possible only if Grep is a proper matrix object; if Grep is a list of lists then it may have a too small BaseDomain. Thus the Matrix calls introduced in #6232 have to be replaced by calls where the ConstructingFilter and the BaseDomain are given as arguments.

@ThomasBreuer ThomasBreuer requested a review from fingolfin May 12, 2026 10:41
@ThomasBreuer ThomasBreuer added kind: bug Issues describing general bugs, and PRs fixing them kind: bug: unexpected error Issues describing bugs in which computation unexpectedly encounters an error, and PRs fixing them regression A bug that only occurs in the branch, not in a release release notes: not needed PRs introducing changes that are wholly irrelevant to the release notes labels May 12, 2026
@fingolfin
Copy link
Copy Markdown
Member

Unfortunately this PR does not fix gap-packages/recog#472

@ThomasBreuer
Copy link
Copy Markdown
Contributor Author

Unfortunately this PR does not fix gap-packages/recog#472

This is interesting. I will have a look at it.

Comment thread lib/oprt.gi
For a matrix or matrix object,
it is safe to call `BaseDomain` if `HasBaseDomain` is set.

For matrices in `Is8BitMatrixRep`, it may happen that
`BaseDomain` for the matrix and some of its rows differ.
Thus try to avoid computing `BaseDomain`.
Up to now, we ran into an error if some rows of the matrix
were already compressed w.r.t. an unwanted `q`.
@ThomasBreuer
Copy link
Copy Markdown
Contributor Author

With the current version of this pull request, tst/testall.g from Recog's master branch runs without errors.

@ThomasBreuer ThomasBreuer requested a review from fingolfin May 13, 2026 07:53
Comment thread lib/oprt.gi Outdated
else
R:= f;
fi;
#TODO: Here `BaseDomain( G )` should be used.
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.

Suggested change
#TODO: Here `BaseDomain( G )` should be used.
#TODO: Here `BaseDomain( G )` should be used, once it is implemented

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

o.k.

Comment thread lib/oprt.gi

# try to find a vector that has nonzero coefficients for all b
binv:= Inverse( ImmutableMatrix( f, Matrix( b, Grep ) ) );
binv:= Inverse( ImmutableMatrix( f, Matrix( filt, R, b ) ) );
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.

Is this change still necessary, @ThomasBreuer ?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Matrix( b, Grep ) may have the wrong BaseDomain since we have no control about BaseDomain( Grep ).
The dubious situations are when Grep is a list of lists, and as we have learned recently, the behaviour of Is8BitMatrixRep in this respect can be surprising.


# ConvertToMatrixRepNC
gap> ConvertToMatrixRepNC([], 3);
gap> ConvertToMatrixRepNC([], 3); # What is this test supposed to show?
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.

It was probably just added for "test coverage", and to perhaps to ensure there is no crash. Anyway, I think it would be acceptable to also remove it.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

The result 3 is irritating, since the first argument is in fact not in a compressed representation afterwards.

Copy link
Copy Markdown
Member

@fingolfin fingolfin left a comment

Choose a reason for hiding this comment

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

Looks good to me. Perhaps the title should be adjusted?

@ThomasBreuer ThomasBreuer changed the title fix some Matrix calls fix ConvertToMatrixRep, fix some Matrix calls May 13, 2026
@fingolfin fingolfin merged commit ddf184c into gap-system:master May 13, 2026
28 of 30 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

kind: bug: unexpected error Issues describing bugs in which computation unexpectedly encounters an error, and PRs fixing them kind: bug Issues describing general bugs, and PRs fixing them regression A bug that only occurs in the branch, not in a release release notes: not needed PRs introducing changes that are wholly irrelevant to the release notes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants