sagemath / sage

Main repository of SageMath
https://www.sagemath.org
Other
1.33k stars 453 forks source link

conversion of nested polynomial rings to Macaulay2 #28574

Closed mwageringel closed 4 years ago

mwageringel commented 4 years ago

This ticket implements conversion to and from Macaulay2 of polynomial rings over arbitrary base rings – nested polynomial rings in particular – as well as their elements.

This ticket also implements _macaulay2_() for polydicts. This is used in elements of nested polynomial rings, for example.

It also fixes an issue where constant polynomials are accidentally converted to elements of the base ring in Macaulay2, not to elements of the polynomial ring.

We add a special case in the conversion of Galois fields, since in Macaulay2 it is more natural to define finite fields as ZZ/p rather than GF p. This has a positive effect on performance, and simplifies the construction of Macaulay2 polynomial rings.

Depends on #28566 Depends on #28571 Depends on #28572 Depends on #28074

CC: @saliola @dimpase @antonleykin

Component: interfaces: optional

Keywords: macaulay2, IMA Coding Sprint

Author: Markus Wageringel

Branch/Commit: ac2ff35

Reviewer: Franco Saliola, Dima Pasechnik

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

mwageringel commented 4 years ago

Branch: u/gh-mwageringel/28574

mwageringel commented 4 years ago

Commit: 49d5c0b

mwageringel commented 4 years ago

Dependencies: #28571, #28074

mwageringel commented 4 years ago

New commits:

5709e6128074: refactor caching of Macaulay2 polynomial rings
c2d89a0Merge tag '9.0.beta0'
2823dc0pass macaulay2 as argument to _macaulay2_init_()
af595de28574: construct Macaulay2 polynomial rings over arbitrary base rings
e85472028574: fix conversion of polynomials to M2
49d5c0b28574: convert elements of nested polynomial rings from M2 to sage
mwageringel commented 4 years ago

Author: Markus Wageringel

mwageringel commented 4 years ago

Description changed:

--- 
+++ 
@@ -1 +1,7 @@
+This ticket implements conversion to and from Macaulay2 of polynomial rings over arbitrary base rings – nested polynomial rings in particular – as well as their elements.

+This ticket also implements `_macaulay2_()` for polydicts. This is used in elements of nested polynomial rings, for example.
+
+It also fixes an issue where constant polynomials are accidentally converted to elements of the base ring in Macaulay2, not to elements of the polynomial ring.
+
+We add a special case in the conversion of Galois fields, since in Macaulay2 it is more natural to define finite fields as `ZZ/p` rather than `GF p`. This has a positive effect on performance, and simplifies the construction of Macaulay2 polynomial rings.
saliola commented 4 years ago

Changed branch from u/gh-mwageringel/28574 to public/interfaces/m2/28574

saliola commented 4 years ago

Changed commit from 49d5c0b to 23b2bf4

fchapoton commented 4 years ago
comment:4

reviewer name missing

mwageringel commented 4 years ago

Reviewer: Franco Saliola

mwageringel commented 4 years ago
comment:5

Thanks.

saliola commented 4 years ago

Work Issues: Fix merge conflicts with #28566

saliola commented 4 years ago

Changed dependencies from #28571, #28074 to #28566, #28571, #28074

7ed8c4ca-6d56-4ae9-953a-41e42b4ed313 commented 4 years ago

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

03d146028566: implement _matrix_() in Macaulay2 interface
5308c9028566: implement conversion of vectors in Macaulay2 interface
602f6eb28566: preserve variable name in Macaulay2 Galois fields
ce24186simplify some doctests
21025bd28566: use ring-preserving constructor for Macaulay2 matrix/vector
0c1e001Merge remote-tracking branch 'origin/public/interfaces/m2/28566' into public/interfaces/m2/28574
72abe24finish merging
7ed8c4ca-6d56-4ae9-953a-41e42b4ed313 commented 4 years ago

Changed commit from 23b2bf4 to 72abe24

7ed8c4ca-6d56-4ae9-953a-41e42b4ed313 commented 4 years ago

Changed commit from 72abe24 to a312b15

7ed8c4ca-6d56-4ae9-953a-41e42b4ed313 commented 4 years ago

Branch pushed to git repo; I updated commit sha1. Last 10 new commits:

ec1773edisable caching of M2 conversion of polynomials in quotient rings (change _macaulay2_init_ to _macaulay2_)
25afa2fsimplify doctest
19d999528572: remove unnecessary doctests
0d90888f4 and mgb opts for M2 gb computations
59b3215add documentation and minor fixes
1ad24c3pass F4 and MGB to M2 as strings
7038ba228567: run Macaulay2 f4 and mgb doctests over a finite field
00c028f28567: add missing optional doctest flag
15d35e3Merge remote-tracking branch 'origin/public/interfaces/m2/f4etc' into public/interfaces/m2/m2_quotient_rings
a312b15Merge branch 'public/interfaces/m2/m2_quotient_rings' into public/interfaces/m2/28574
saliola commented 4 years ago

Changed dependencies from #28566, #28571, #28074 to #28566, #28571, #28572, #28074

saliola commented 4 years ago

Changed work issues from Fix merge conflicts with #28566 to none

saliola commented 4 years ago
comment:10

In order to make this ticket merge cleanly with some of the other M2 tickets summarized at #28573, I set dependencies and merged the appropriate branches. Provided the dependencies are respected, everything should merge cleanly now.

saliola commented 4 years ago
comment:11

I am happy with this ticket. Markus, if you accept the proposed merging, then you can set this to positive review.

mwageringel commented 4 years ago

Work Issues: rebase on #28572

7ed8c4ca-6d56-4ae9-953a-41e42b4ed313 commented 4 years ago

Branch pushed to git repo; I updated commit sha1. This was a forced push. Last 10 new commits:

61ca2dbconversion of quotient rings to macaulay2 & improvements to conversion of ideals
84702b428572: fix conversion of quotient rings from Macaulay2 to Sage
4db4a3cmark m2 doctests as optional
80b99b9add _macaulay2_init_ method to QuotientRingElement
c185cffcorrect inaccuracy in doctest description
ca619b8properly handle conversion of quotient ring elements & inherit variable names when converting from M2 quotient rings
3a0e906disable caching of M2 conversion of polynomials in quotient rings (change _macaulay2_init_ to _macaulay2_)
117ab9fsimplify doctest
3f4f6f528572: remove unnecessary doctests
ac2ff3528574: Merge #28572 into 'public/interfaces/m2/28574'
7ed8c4ca-6d56-4ae9-953a-41e42b4ed313 commented 4 years ago

Changed commit from a312b15 to ac2ff35

mwageringel commented 4 years ago
comment:14

I have replaced the last merge commit by a new merge with #28572 and still all tests pass on my end.

Franco, please review the merging, though maybe wait for the next beta to see if it merges cleanly.

mwageringel commented 4 years ago

Changed work issues from rebase on #28572 to none

dimpase commented 4 years ago

Changed reviewer from Franco Saliola to Franco Saliola, Dima Pasechnik

dimpase commented 4 years ago
comment:15

seems to be merging just fine (with 9.0.beta4)

vbraun commented 4 years ago

Changed branch from public/interfaces/m2/28574 to ac2ff35