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

Comparison in the Gap interface raises an error #5962

Closed
simon-king-jena opened this issue May 2, 2009 · 11 comments
Closed

Comparison in the Gap interface raises an error #5962

simon-king-jena opened this issue May 2, 2009 · 11 comments

Comments

@simon-king-jena
Copy link
Member

On sage.math with sage-3.4.1, one has

sage: gap('DihedralGroup(8)')==gap('DihedralGroup(8)')
---------------------------------------------------------------------------
RuntimeError                              Traceback (most recent call last)
...
RuntimeError: Gap produced error output
Error, no 1st choice method found for `LT' on 2 arguments

   executing $sage1 < $sage2;

The problem seems to be that Gap is unable to compare:

sage: gap('DihedralGroup(8)=DihedralGroup(8)')
false

Perhaps it would make sense to try and implement a __cmp__ method that is more sophisticated than what is done in Gap?

At least it should be made sure that the __cmp__ method of the Gap interface does not raise an error.

CC: @wdjoyner

Component: interfaces

Keywords: gap comparison

Author: Simon King

Reviewer: David Joyner

Merged: sage-4.7.alpha3

Issue created by migration from https://trac.sagemath.org/ticket/5962

@simon-king-jena
Copy link
Member Author

Author: Simon King

@simon-king-jena
Copy link
Member Author

comment:1

I see no way for a really satisfying solution, as long as GAP can not even compare two objects whose definitions are identical.

However, the errors being raised by GAP when comparing elements are now caught in a try-except clause. We have, as doc tests:

sage: gap('DihedralGroup(8)')==gap('DihedralGroup(8)')
False    # sorry, this is what GAP claims.
sage: gap('SymmetricGroup(8)')<gap('AlternatingGroup(8)')
True
sage: gap('SymmetricGroup(8)')>gap('AlternatingGroup(8)')
False
sage: gap('SymmetricGroup(8)')==gap('SymmetricGroup(8)')
True

All but the first of these examples worked before. But the first resulted in an error, which is now fixed.

@simon-king-jena
Copy link
Member Author

comment:2

I just found that this ticket needs review since 8 months. Fortunately the patch still works fine. So, any volunteer?

@wdjoyner
Copy link

wdjoyner commented Mar 8, 2011

comment:3

Replying to @simon-king-jena:

I just found that this ticket needs review since 8 months.
Fortunately the patch still works fine. So, any volunteer?

I have spring break coming up and can try to review it then if no one beats me to it.

@wdjoyner
Copy link

comment:4

This patch applies to 4.7.a1 and passes sage -testall. The patch does as claimed (adding some try-except statements) and contains the proper additional examples in the docstrings. Positive review from me.

Thanks Simon!

@jdemeyer
Copy link

Reviewer: David Joyner

@jdemeyer
Copy link

comment:5

Please change the commit message (using hg qrefresh -e) such that the ticket number appears on the first line.

@simon-king-jena
Copy link
Member Author

Attachment: trac_5962_GAP__cmp__.patch.gz

Avoid an error being raised when comparing GAP elements. Add doctest.

@simon-king-jena
Copy link
Member Author

comment:6

Replying to @jdemeyer:

Please change the commit message (using hg qrefresh -e) such that the ticket number appears on the first line.

Done.

@jdemeyer
Copy link

comment:7

Replying to @simon-king-jena:

Done.

Thanks!

@jdemeyer
Copy link

Merged: sage-4.7.alpha3

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants