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

improve conversions between Macaulay2 and Sage #28566

Closed
mwageringel opened this issue Oct 6, 2019 · 13 comments
Closed

improve conversions between Macaulay2 and Sage #28566

mwageringel opened this issue Oct 6, 2019 · 13 comments

Comments

@mwageringel
Copy link

This ticket implements and improves conversions between Macaulay2 and Sage:

• vectors/free module elements

• matrices: The function InterfaceElement._matrix_() is implemented to allow for this syntax:

sage: A = macaulay2('matrix {{1,2},{3,4}}')
sage: matrix(QQ, A)
[1 2]
[3 4]

This ticket also fixes an issue where the elements are not promoted to the correct ring:

sage: R.<x,y> = QQ[]
sage: m = macaulay2(matrix(R, [[1, 2], [3, 4]]))
sage: m.ring()  # should be R
ZZ

• finite fields: An issue is fixed where the generator names are not preserved:

sage: K = GF(49, 'b')
sage: K.gens(), macaulay2(K).gens()  # should be the same
((b,), {a})

CC: @saliola @dimpase @antonleykin

Component: interfaces: optional

Keywords: macaulay2, IMA Coding Sprint

Author: Markus Wageringel

Branch/Commit: 21025bd

Reviewer: Franco Saliola

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

@mwageringel
Copy link
Author

New commits:

03d146028566: implement _matrix_() in Macaulay2 interface
5308c9028566: implement conversion of vectors in Macaulay2 interface
602f6eb28566: preserve variable name in Macaulay2 Galois fields

@mwageringel
Copy link
Author

Author: Markus Wageringel

@mwageringel
Copy link
Author

Commit: 602f6eb

@mwageringel
Copy link
Author

Branch: public/interfaces/m2/28566

@mwageringel
Copy link
Author

Changed keywords from macaulay2 to macaulay2, IMA Coding Sprint

@sagetrac-git
Copy link
Mannequin

sagetrac-git mannequin commented Oct 6, 2019

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

ce24186simplify some doctests

@sagetrac-git
Copy link
Mannequin

sagetrac-git mannequin commented Oct 6, 2019

Changed commit from 602f6eb to ce24186

@saliola
Copy link

saliola commented Oct 6, 2019

comment:4

I reviewed all the changes up to this point (​602f6eb) and have only a couple of minor suggestions for the presentation of doctests (see ce24186).

After discussions, it seems that instead of using promote in M2, one should use the matrix(R,v) constructor in M2; see matrix(R,v) documentation for M2.

This also applies to constructing vectors: first construct a matrix in M2 over the correct base ring and then apply the vector command vector(Matrix).

@sagetrac-git
Copy link
Mannequin

sagetrac-git mannequin commented Oct 7, 2019

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

21025bd28566: use ring-preserving constructor for Macaulay2 matrix/vector

@sagetrac-git
Copy link
Mannequin

sagetrac-git mannequin commented Oct 7, 2019

Changed commit from ce24186 to 21025bd

@mwageringel
Copy link
Author

comment:6

Replying to @saliola:

After discussions, it seems that instead of using promote in M2, one should use the matrix(R,v) constructor in M2; see matrix(R,v) documentation for M2.

This also applies to constructing vectors: first construct a matrix in M2 over the correct base ring and then apply the vector command vector(Matrix).

Thanks, I have changed it.

@saliola
Copy link

saliola commented Oct 10, 2019

Reviewer: Franco Saliola

@vbraun
Copy link
Member

vbraun commented Oct 12, 2019

Changed branch from public/interfaces/m2/28566 to 21025bd

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

3 participants