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

Bug in MatrixEntries #164

Closed
wilfwilson opened this issue Apr 22, 2016 · 2 comments
Closed

Bug in MatrixEntries #164

wilfwilson opened this issue Apr 22, 2016 · 2 comments
Assignees
Labels
bug Label for issues or PR which report or fix bugs

Comments

@wilfwilson
Copy link
Collaborator

MatrixEntries returns the set of elements contained in the matrix of a Rees (0-)matrix semigroup.

This is not documented, and so the expected behaviour is not specified.

Currently MatrixEntries returns Union(Matrix(R){Columns(R)}{Rows(R)});. The function Union returns a sorted list, however it is not always possible to compare certain elements with 0 (which may be a matrix entry), leading to an error:

gap> S := Semigroup(SymmetricInverseMonoid(2));;
gap> id := Identity(S);;
gap> R := ReesZeroMatrixSemigroup(S, [[id], [0]]);;
gap> MatrixEntries(R);
Error, no method found! For debugging hints type ?Recovery from NoMethodFound
Error, no 1st choice method found for `<' on 2 arguments at /Users/Wilf/GAP/lib/methsel2.g:241 called from
Set( Concatenation( tounite )
 ) at /Users/Wilf/GAP/lib/coll.gi:2788 called from
Union( Matrix( x ){Columns( x )}{Rows( x )}
 ) at /Users/Wilf/GAP/pkg/semigroups/gap/semigroups/semirms.gi:340

This bug is present in stable-2.7 and unstable-3.0.

I will submit a pull request to fix this problem in each branch, by calling Unique instead of Union to remove duplicates without sorting. Another option would be to always place 0 first (if present) and then sort the remaining entries (which should all be comparable, as they come from the same semigroup) and append them to the end of [0].

@wilfwilson wilfwilson self-assigned this Apr 22, 2016
@wilfwilson wilfwilson added the bug Label for issues or PR which report or fix bugs label Apr 22, 2016
wilfwilson added a commit to wilfwilson/Semigroups that referenced this issue Apr 22, 2016
MatrixEntries fails for some Rees 0-matrix semigroups whose
matrices contain 0, since MatrixEntries removes duplicates and
sorts using Union, however 0 is not comparable with all
semigroup elements.

This issue is resolved by using Unique to remove duplicates,
but not sorting the list of matrix entries.

Resolves: semigroups#164
wilfwilson added a commit to wilfwilson/Semigroups that referenced this issue Apr 22, 2016
MatrixEntries fails for some Rees 0-matrix semigroups whose
matrices contain 0, since MatrixEntries removes duplicates and
sorts using Union, however 0 is not comparable with all
semigroup elements.

This issue is resolved by using Unique to remove duplicates,
but not sorting the list of matrix entries.

Resolves: semigroups#164
@james-d-mitchell
Copy link
Collaborator

james-d-mitchell commented Apr 28, 2016

@wilfwilson I think the last thing you suggest sounds like the best idea. Sort the non-zero entries, then append them to [0]. Can you please amend the PRs to do this?

wilfwilson added a commit to wilfwilson/Semigroups that referenced this issue Apr 28, 2016
MatrixEntries fails for some Rees 0-matrix semigroups whose
matrices contain 0, since MatrixEntries removes duplicates and
sorts using Union, however 0 is not comparable with all
semigroup elements.

This issue is resolved by using Unique to remove duplicates,
putting 0 (if present) at the start of the list, and then sorting
the remaining elements (which are all from the same
semigroup, and are hence sortable).

Resolves: semigroups#164
wilfwilson added a commit to wilfwilson/Semigroups that referenced this issue Apr 28, 2016
MatrixEntries fails for some Rees 0-matrix semigroups whose
matrices contain 0, since MatrixEntries removes duplicates and
sorts using Union, however 0 is not comparable with all
semigroup elements.

This issue is resolved by using Unique to remove duplicates,
putting 0 (if present) at the start of the list, and then sorting
the remaining elements (which are all from the same
semigroup, and are hence sortable).

Resolves: semigroups#164
@wilfwilson
Copy link
Collaborator Author

@james-d-mitchell I've amended the PRs as requested.

wilfwilson added a commit to wilfwilson/Semigroups that referenced this issue May 1, 2016
MatrixEntries fails for some Rees 0-matrix semigroups whose
matrices contain 0, since MatrixEntries removes duplicates and
sorts using Union, however 0 is not comparable with all
semigroup elements.

This issue is resolved by using Unique to remove duplicates,
putting 0 (if present) at the start of the list, and then sorting
the remaining elements (which are all from the same
semigroup, and are hence sortable).

Resolves: semigroups#164
wilfwilson added a commit to wilfwilson/Semigroups that referenced this issue May 1, 2016
MatrixEntries fails for some Rees 0-matrix semigroups whose
matrices contain 0, since MatrixEntries removes duplicates and
sorts using Union, however 0 is not comparable with all
semigroup elements.

This issue is resolved by using Unique to remove duplicates,
putting 0 (if present) at the start of the list, and then sorting
the remaining elements (which are all from the same
semigroup, and are hence sortable).

Resolves: semigroups#164
wilfwilson added a commit to wilfwilson/Semigroups that referenced this issue May 1, 2016
MatrixEntries fails for some Rees 0-matrix semigroups whose
matrices contain 0, since MatrixEntries removes duplicates and
sorts using Union, however 0 is not comparable with all
semigroup elements.

This issue is resolved by using Unique to remove duplicates,
putting 0 (if present) at the start of the list, and then sorting
the remaining elements (which are all from the same
semigroup, and are hence sortable).

Resolves: semigroups#164
wilfwilson added a commit to wilfwilson/Semigroups that referenced this issue May 1, 2016
MatrixEntries fails for some Rees 0-matrix semigroups whose
matrices contain 0, since MatrixEntries removes duplicates and
sorts using Union, however 0 is not comparable with all
semigroup elements.

This issue is resolved by using Unique to remove duplicates,
putting 0 (if present) at the start of the list, and then sorting
the remaining elements (which are all from the same
semigroup, and are hence sortable).

Resolves: semigroups#164
wilfwilson added a commit to wilfwilson/Semigroups that referenced this issue May 1, 2016
MatrixEntries fails for some Rees 0-matrix semigroups whose
matrices contain 0, since MatrixEntries removes duplicates and
sorts using Union, however 0 is not comparable with all
semigroup elements.

This issue is resolved by using Unique to remove duplicates,
putting 0 (if present) at the start of the list, and then sorting
the remaining elements (which are all from the same
semigroup, and are hence sortable).

Resolves: semigroups#164
wilfwilson added a commit to wilfwilson/Semigroups that referenced this issue May 5, 2016
MatrixEntries fails for some Rees 0-matrix semigroups whose
matrices contain 0, since MatrixEntries removes duplicates and
sorts using Union, however 0 is not comparable with all
semigroup elements.

This issue is resolved by using Unique to remove duplicates,
putting 0 (if present) at the start of the list, and then sorting
the remaining elements (which are all from the same
semigroup, and are hence sortable).

Resolves: semigroups#164
wilfwilson added a commit to wilfwilson/Semigroups that referenced this issue May 5, 2016
MatrixEntries fails for some Rees 0-matrix semigroups whose
matrices contain 0, since MatrixEntries removes duplicates and
sorts using Union, however 0 is not comparable with all
semigroup elements.

This issue is resolved by using Unique to remove duplicates,
putting 0 (if present) at the start of the list, and then sorting
the remaining elements (which are all from the same
semigroup, and are hence sortable).

Resolves: semigroups#164
wilfwilson added a commit to wilfwilson/Semigroups that referenced this issue May 5, 2016
MatrixEntries fails for some Rees 0-matrix semigroups whose
matrices contain 0, since MatrixEntries removes duplicates and
sorts using Union, however 0 is not comparable with all
semigroup elements.

This issue is resolved by using Unique to remove duplicates,
putting 0 (if present) at the start of the list, and then sorting
the remaining elements (which are all from the same
semigroup, and are hence sortable).

Resolves: semigroups#164
wilfwilson added a commit to wilfwilson/Semigroups that referenced this issue May 5, 2016
MatrixEntries fails for some Rees 0-matrix semigroups whose
matrices contain 0, since MatrixEntries removes duplicates and
sorts using Union, however 0 is not comparable with all
semigroup elements.

This issue is resolved by using Unique to remove duplicates,
putting 0 (if present) at the start of the list, and then sorting
the remaining elements (which are all from the same
semigroup, and are hence sortable).

Resolves: semigroups#164
wilfwilson added a commit to wilfwilson/Semigroups that referenced this issue May 5, 2016
MatrixEntries fails for some Rees 0-matrix semigroups whose
matrices contain 0, since MatrixEntries removes duplicates and
sorts using Union, however 0 is not comparable with all
semigroup elements.

This issue is resolved by using Unique to remove duplicates,
putting 0 (if present) at the start of the list, and then sorting
the remaining elements (which are all from the same
semigroup, and are hence sortable).

Resolves: semigroups#164
james-d-mitchell added a commit that referenced this issue May 5, 2016
james-d-mitchell added a commit that referenced this issue May 5, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Label for issues or PR which report or fix bugs
Projects
None yet
Development

No branches or pull requests

2 participants