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

Add ring and promote methods for Constant objects #3457

Merged
merged 1 commit into from
Sep 6, 2024

Conversation

d-torrance
Copy link
Member

Add support for creating matrices with Constant entries. Also add a unit test.

Before

i1 : matrix {{ii}}
stdio:1:6:(3): error: common ring not found

After

i1 : matrix {{ii}}

o1 = | ii |

                1         1
o1 : Matrix CC    <-- CC
              53        53

Closes: #3456

@pzinn
Copy link
Contributor

pzinn commented Sep 5, 2024

looking good. it still misses some cases, though maybe we're reaching the limit of the promote system, cf #3184:

i1 : f=map(CC[x],CC[y,z],{x,ii})
stdio:1:5:(3): error: no method found for applying promote to:
     argument 1 :  ii (of class Constant)
     argument 2 :  CC  [x]
                     53

Add support for creating matrices with Constant entries.  Also add a
unit test.
@d-torrance
Copy link
Member Author

That case was straightforward enough. I added promote(Constant, RingElement), so now your example works:

i1 : map(CC[x],CC[y,z],{x,ii})

o1 = map (CC  [x], CC  [y..z], {x, ii})
            53       53

o1 : RingMap CC  [x] <-- CC  [y..z]
               53          53

@d-torrance d-torrance merged commit 954e44c into Macaulay2:development Sep 6, 2024
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants