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

more choices of algorithms for Coxeter Smith form of posets #27430

Closed
fchapoton opened this issue Mar 6, 2019 · 24 comments
Closed

more choices of algorithms for Coxeter Smith form of posets #27430

fchapoton opened this issue Mar 6, 2019 · 24 comments

Comments

@fchapoton
Copy link
Contributor

This allows to compare the speed of all those.

Component: combinatorics

Author: Frédéric Chapoton

Branch/Commit: aa07710

Reviewer: Travis Scrimshaw, Martin Rubey

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

@fchapoton fchapoton added this to the sage-8.7 milestone Mar 6, 2019
@fchapoton
Copy link
Contributor Author

Branch: u/chapoton/27430

@fchapoton
Copy link
Contributor Author

Commit: 96b8150

@fchapoton
Copy link
Contributor Author

New commits:

96b8150more algorithm for coxeter_smith_form in posets

@tscrim
Copy link
Collaborator

tscrim commented Mar 6, 2019

comment:2

I think it would be better to have the comments about the (anecdotal) relative speed of the algorithms in the docstring rather than the code. That way it is easier for the (common) user to see it. Otherwise LGTM.

@sagetrac-git
Copy link
Mannequin

sagetrac-git mannequin commented Mar 6, 2019

Changed commit from 96b8150 to 5dcd3cd

@sagetrac-git
Copy link
Mannequin

sagetrac-git mannequin commented Mar 6, 2019

Branch pushed to git repo; I updated commit sha1. New commits:

5dcd3cdtrac 27430 some details

@fchapoton
Copy link
Contributor Author

comment:4

thx, done

@mantepse
Copy link
Collaborator

mantepse commented Mar 6, 2019

comment:5

I cannot try the ticket right now, but I'm afraid that the FriCAS code will leak variables. Could you try

sage: _ = P.coxeter_smith_form(algorithm='fricas')
sage: fricas.eval("Z")
sage: fricas.eval("x")

If it does, I can prepare a non-leaking statement. Roughly, it will be

(fricas([x]*n).diagonalMatrix() - fricas(c0)).smith().diagonal().sage()

@mantepse
Copy link
Collaborator

mantepse commented Mar 6, 2019

comment:6

A more fundamental question: why not provide the algorithm keyword for matrices in general?

I admit, that I do not know how the matrix design currently works, but possibly sage.matrix.matrix2.smith_form is the right place?

@fchapoton
Copy link
Contributor Author

comment:7

Well. Indeed. That would go into "matrices with entries in QQ[x]' namely "matrix_polynomial_dense.pyx". Maybe for another ticket, unless you volunteer to do it ?

Now compiling Fricas to check the leak.

@fchapoton
Copy link
Contributor Author

comment:8

Answer:

sage: p=posets.PentagonPoset()
sage: sage: _ = p.coxeter_smith_form(algorithm='fricas')
....: sage: fricas.eval("Z")
....: sage: fricas.eval("x")
....: 
'\n   Integer\n'
'\n   x\n'

Does this mean that there is a leak?

@mantepse
Copy link
Collaborator

mantepse commented Mar 6, 2019

comment:9

Replying to @fchapoton:

Answer:

sage: p=posets.PentagonPoset()
sage: sage: _ = p.coxeter_smith_form(algorithm='fricas')
....: sage: fricas.eval("Z")
....: sage: fricas.eval("x")
....: 
'\n   Integer\n'
'\n   x\n'

Does this mean that there is a leak?

Yes, after p.coxeter_smith_form(algorithm='fricas'), the name Z has value Integer in FriCAS. By contrast, x still returns x, which is good.

So, for example, executing after that

sage: var("Z")
sage: fricas(Z^2+1)

will raise a strange error.

@fchapoton
Copy link
Contributor Author

comment:10

Ok. Then please try to provide a working better alternative. There is no urgency.

@fchapoton
Copy link
Contributor Author

comment:11

I tried the obvious modification for Fricas, as you suggested, and it failed.

@mantepse
Copy link
Collaborator

mantepse commented Mar 8, 2019

comment:12

Could you post the code? I can look at it tonight (probably after 19:00)

@fchapoton
Copy link
Contributor Author

comment:13

I have made a branch public/ticket/27430 with the tentative. I would say that the matrix type is not recognized correctly, so that the method smith does not apply.

@mantepse
Copy link
Collaborator

mantepse commented Mar 9, 2019

Changed branch from u/chapoton/27430 to u/mantepse/27430

@fchapoton
Copy link
Contributor Author

Changed commit from 5dcd3cd to aa07710

@fchapoton
Copy link
Contributor Author

comment:15

Is this a working branch or what ?

Nota bene: If you do not make a comment, I do not see the change of branch.


New commits:

6a548d9tentative code for friacs algorithm in posets
aa07710tweak fricas code so variables don't leak

@mantepse
Copy link
Collaborator

comment:16

Dear Frederic !

sorry, I didn't know that you wouldn't see it. Yes, this should work with FriCAS.

@fchapoton
Copy link
Contributor Author

comment:17

ok, the fricas code works and looks good to me. Travis, do you agree that this is ready to go?

@tscrim
Copy link
Collaborator

tscrim commented Mar 11, 2019

Reviewer: Travis Scrimshaw, Martin Rubey

@tscrim
Copy link
Collaborator

tscrim commented Mar 11, 2019

comment:18

Yep, LGTM. Thanks.

@vbraun
Copy link
Member

vbraun commented Mar 13, 2019

Changed branch from u/mantepse/27430 to aa07710

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