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

Membership to numerical semigroups #72

Open
pedritomelenas opened this issue Aug 4, 2022 · 3 comments
Open

Membership to numerical semigroups #72

pedritomelenas opened this issue Aug 4, 2022 · 3 comments

Comments

@pedritomelenas
Copy link
Contributor

The basic (HasGenerators) implementation should be improved, but also in the case the Apéry set is known, it does not use the implementation for HasAperyList.

gap> s:=NumericalSemigroup([ 4, 180738, 234949, 253363 ]);;
gap> a:=AperyList(s);;
gap> x:=373067;;
gap> x in s;
Error, recursion depth trap (5000) in
  belongs( x - gen[1], gen ) at /home/FQM343/pedro/lib/gap-4.11.1/pkg/numericalsgps/gap/basics.gi:690 called from 
belongs( x - gen[1], gen ) at /home/FQM343/pedro/lib/gap-4.11.1/pkg/numericalsgps/gap/basics.gi:690 called from
belongs( x - gen[1], gen ) at /home/FQM343/pedro/lib/gap-4.11.1/pkg/numericalsgps/gap/basics.gi:690 called from
belongs( x - gen[1], gen ) at /home/FQM343/pedro/lib/gap-4.11.1/pkg/numericalsgps/gap/basics.gi:690 called from
belongs( x - gen[1], gen ) at /home/FQM343/pedro/lib/gap-4.11.1/pkg/numericalsgps/gap/basics.gi:690 called from
belongs( x - gen[1], gen ) at /home/FQM343/pedro/lib/gap-4.11.1/pkg/numericalsgps/gap/basics.gi:690 called from
...  at *stdin*:42
you may 'return;'

However, it uses the implementation of HasSmallElements

gap> sm:=SmallElements(s);;
gap> x in s;
true

This is an example produced from an issue reported by @coneill-math .

pedritomelenas added a commit that referenced this issue Aug 4, 2022
@pedritomelenas
Copy link
Contributor Author

Commit 6b3c4fb solves the issue of not using HasAperyList method, though the HasGenerators methods still needs to be polished.

gap> s:=NumericalSemigroup([ 4, 180738, 234949, 253363 ]);;
gap> x:=373067;;
gap> a:=AperyList(s);;
gap> x in s;
true

pedritomelenas added a commit that referenced this issue Aug 5, 2022
@pedritomelenas
Copy link
Contributor Author

It seems that 84204b7 solves the problem. However, I would like to see if performance has changed.

@pedritomelenas
Copy link
Contributor Author

We are loosing performance

gap> s:=RandomNumericalSemigroup(20,10000);;
gap> gen:=MinimalGenerators(s);
[ 216, 2024, 2507, 4755, 5310, 5398, 5613, 8308, 9496, 9685 ]
gap> belongs(1000000,gen);time;
true
41
gap> bel(1000000,gen);time;    
true
101

But we avoid things like

gap> s:=NumericalSemigroup([ 4, 180738, 234949, 253363 ]);;
gap> gen:=MinimalGenerators(s);
[ 4, 180738, 234949, 253363 ]
gap> x:=373067;;
gap> SetRecursionTrapInterval(30000);;
gap> belongs(x,gen);time;
Violación de segmento (`core' generado)

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

1 participant