Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add GAP_IsMatrix #4531

Merged
merged 2 commits into from
Jun 5, 2021
Merged

Conversation

ThomasBreuer
Copy link
Contributor

and added/corrected some comments concerning functions about GAP_IsMatrix*

and added/corrected some comments concerning functions about `GAP_IsMatrix*`
Copy link
Contributor

@wucas wucas left a comment

Choose a reason for hiding this comment

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

I cannot really say whether everything is correct (for that I lack knowledge of the C part of GAP) but the comments and code look good to me. Is this related to #4518 ?

src/libgap-api.c Outdated
// Returns 1 if <obj> is a GAP matrix, 0 if not.
int GAP_IsMatrix(Obj obj)
{
return obj && DoFilter(IsMatrixFilt, obj) == True;
Copy link
Member

Choose a reason for hiding this comment

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

IsMatrix is not a plain filter, but rather an and-filter, so calling DoFilter is wrong and the cause for the crash in the CI tests.

Suggested change
return obj && DoFilter(IsMatrixFilt, obj) == True;
return obj && CALL_1ARGS(IsMatrixFilt, obj) == True;

I suggest we change GAP_IsMatrixOrMatrixObj and GAP_IsMatrixObj similarly -- while DoFilter works for them right now, it's a bit risky, as any change to their definition would accidentally break this code.

... and make `GAP_IsMatrixOrMatrixObj`, `GAP_IsMatrixObj` future proof:
directly calling `DoFilter` is risky and will break as soon as the
"filter" we are passing in is not a true filter, but e.g. an and-filter
(such as `IsMatrix`)
@fingolfin fingolfin merged commit a6c45d3 into gap-system:master Jun 5, 2021
@ThomasBreuer ThomasBreuer deleted the TB_libgap_IsMatrix branch June 9, 2021 12:29
@wilfwilson wilfwilson added the topic: libgap things related to libgap label Jun 10, 2021
@fingolfin fingolfin added the release notes: use title For PRs: the title of this PR is suitable for direct use in the release notes label Aug 17, 2022
@fingolfin fingolfin changed the title added GAP_IsMatrix to src/libgap-api.* Add GAP_IsMatrix Aug 17, 2022
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: libgap things related to libgap
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants