Skip to content

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
@d-torrance d-torrance deleted the matrix-constant branch November 25, 2024 01:07
d-torrance added a commit to d-torrance/M2 that referenced this pull request Mar 5, 2025
* 0-atomic-ops-mac-os-x (now using C standard library atomics)
* 0-bugs/ggsmith.m2 (there's now a LocalRings package)
* 0-completion-for-packages (this has been the case for some time)
* 0-delete-error-message ("delete" is now a method)
* 0-doc (fixed at some point -- bug no longer present)
* 0-export-strings ("export" has been accepting only string since 2014)
* 0-factory ("libcfmem" is old -- we can link against factory w/o problems)
* 0-factory-depends (refers to nonexistent file)
* 0-merge-1.5 (merged in 2013! see 5088768)
* 0-ubuntu-dpkg-triggers (distributions/deb package is deprecated)
* 0-update-gpl-license-version (mentioned in LICENSING-NOTES)
* 0-Verbosity (duplicate of Macaulay2#273)
* 0.1-error-message (now get a "no method found" error)
* 0.1-xemacs (xemacs is essentially dead)
* 0.5-debian-script (distributions/deb package is deprecated)
* 0.5-fix-M2-exec-location (fixed by Macaulay2#2163)
* 0.5-package-finding-programs (fixed when "findProgram" was added)
* 0.5-ubuntu-repository (M2 has been in Debian/Ubuntu since 2020)
* 0.7-selectPairs (selectPairs implemented in Macaulay2#3305)
* 1-apropos (can use regex, e.g., apropos "(?i)sort")
* 1-code-and-hooks (implemented in Macaulay2#3118)
* 1-constant-to-RR (promote works since Macaulay2#3457, toRR is compiled so wontfix)
* 1-debian-changelog-file (distributions/deb package is deprecated)
* 1-deb-signatures (distributions/deb package is deprecated)
* 1-factory-bug (bug not present using factory from singular 4.3.2)
* 1-GPL (we added GPL 3 some time ago)
* 1-include-applications (this has been the behavior for some time)
* 1-Kronecker (added in 2010 -- see d1cb81c)
* 1-nextPrime (added in 2016 -- see 992b43f)
* 1-recursion-in-printing (no more recursion error -- now "no method found")

[ci skip]
d-torrance added a commit to d-torrance/M2 that referenced this pull request Mar 5, 2025
* 0-atomic-ops-mac-os-x (now using C standard library atomics)
* 0-bugs/ggsmith.m2 (there's now a LocalRings package)
* 0-completion-for-packages (this has been the case for some time)
* 0-delete-error-message ("delete" is now a method)
* 0-doc (fixed at some point -- bug no longer present)
* 0-export-strings ("export" has been accepting only string since 2014)
* 0-factory ("libcfmem" is old -- we can link against factory w/o problems)
* 0-factory-depends (refers to nonexistent file)
* 0-merge-1.5 (merged in 2013! see 5088768)
* 0-ubuntu-dpkg-triggers (distributions/deb package is deprecated)
* 0-update-gpl-license-version (mentioned in LICENSING-NOTES)
* 0-Verbosity (duplicate of Macaulay2#273)
* 0.1-error-message (now get a "no method found" error)
* 0.1-xemacs (xemacs is essentially dead)
* 0.5-debian-script (distributions/deb package is deprecated)
* 0.5-fix-M2-exec-location (fixed by Macaulay2#2163)
* 0.5-package-finding-programs (fixed when "findProgram" was added)
* 0.5-ubuntu-repository (M2 has been in Debian/Ubuntu since 2020)
* 0.7-selectPairs (selectPairs implemented in Macaulay2#3305)
* 1-apropos (can use regex, e.g., apropos "(?i)sort")
* 1-code-and-hooks (implemented in Macaulay2#3118)
* 1-constant-to-RR (promote works since Macaulay2#3457, toRR is compiled so wontfix)
* 1-debian-changelog-file (distributions/deb package is deprecated)
* 1-deb-signatures (distributions/deb package is deprecated)
* 1-factory-bug (bug not present using factory from singular 4.3.2)
* 1-fflas (FFLAS-FFPACK added in 2011 -- see e50558b)
* 1-fpLLL (fpLLL added in 2013 -- see 2447204)
* 1-GPL (we added GPL 3 some time ago)
* 1-include-applications (this has been the behavior for some time)
* 1-Kronecker (added in 2010 -- see d1cb81c)
* 1-nextPrime (added in 2016 -- see 992b43f)
* 1-recursion-in-printing (no more recursion error -- now "no method found")

[ci skip]
d-torrance added a commit to d-torrance/M2 that referenced this pull request Mar 12, 2025
* 0-atomic-ops-mac-os-x (now using C standard library atomics)
* 0-bugs/ggsmith.m2 (there's now a LocalRings package)
* 0-completion-for-packages (this has been the case for some time)
* 0-delete-error-message ("delete" is now a method)
* 0-doc (fixed at some point -- bug no longer present)
* 0-export-strings ("export" has been accepting only string since 2014)
* 0-factory ("libcfmem" is old -- we can link against factory w/o problems)
* 0-factory-depends (refers to nonexistent file)
* 0-merge-1.5 (merged in 2013! see 5088768)
* 0-ubuntu-dpkg-triggers (distributions/deb package is deprecated)
* 0-update-gpl-license-version (mentioned in LICENSING-NOTES)
* 0-Verbosity (duplicate of Macaulay2#273)
* 0.1-error-message (now get a "no method found" error)
* 0.1-xemacs (xemacs is essentially dead)
* 0.5-debian-script (distributions/deb package is deprecated)
* 0.5-fix-M2-exec-location (fixed by Macaulay2#2163)
* 0.5-package-finding-programs (fixed when "findProgram" was added)
* 0.5-ubuntu-repository (M2 has been in Debian/Ubuntu since 2020)
* 0.7-selectPairs (selectPairs implemented in Macaulay2#3305)
* 1-apropos (can use regex, e.g., apropos "(?i)sort")
* 1-code-and-hooks (implemented in Macaulay2#3118)
* 1-constant-to-RR (promote works since Macaulay2#3457, toRR is compiled so wontfix)
* 1-debian-changelog-file (distributions/deb package is deprecated)
* 1-deb-signatures (distributions/deb package is deprecated)
* 1-factory-bug (bug not present using factory from singular 4.3.2)
* 1-fflas (FFLAS-FFPACK added in 2011 -- see e50558b)
* 1-fpLLL (fpLLL added in 2013 -- see 2447204)
* 1-GPL (we added GPL 3 some time ago)
* 1-include-applications (this has been the behavior for some time)
* 1-Kronecker (added in 2010 -- see d1cb81c)
* 1-nextPrime (added in 2016 -- see 992b43f)
* 1-recursion-in-printing (no more recursion error -- now "no method found")
* 2-freeaddrinfo (fixed in 2009 -- see a107aeb)

[ci skip]
d-torrance added a commit to d-torrance/M2 that referenced this pull request Mar 20, 2025
* 0-atomic-ops-mac-os-x (now using C standard library atomics)
* 0-bugs/ggsmith.m2 (there's now a LocalRings package)
* 0-completion-for-packages (this has been the case for some time)
* 0-delete-error-message ("delete" is now a method)
* 0-doc (fixed at some point -- bug no longer present)
* 0-export-strings ("export" has been accepting only string since 2014)
* 0-factory ("libcfmem" is old -- we can link against factory w/o problems)
* 0-factory-depends (refers to nonexistent file)
* 0-getPackage-and-DOS (getPackage was removed)
* 0-gmp-as-mpir (we no longer link against MPIR)
* 0-hash-task (tasks now use nextHash)
* 0-merge-1.5 (merged in 2013! see 5088768)
* 0-ubuntu-dpkg-triggers (distributions/deb package is deprecated)
* 0-update-gpl-license-version (mentioned in LICENSING-NOTES)
* 0-Verbosity (duplicate of Macaulay2#273)
* 0.1-error-message (now get a "no method found" error)
* 0.1-xemacs (xemacs is essentially dead)
* 0.5-debian-script (distributions/deb package is deprecated)
* 0.5-fix-M2-exec-location (fixed by Macaulay2#2163)
* 0.5-package-finding-programs (fixed when "findProgram" was added)
* 0.5-ubuntu-repository (M2 has been in Debian/Ubuntu since 2020)
* 0.7-selectPairs (selectPairs implemented in Macaulay2#3305)
* 1-apropos (can use regex, e.g., apropos "(?i)sort")
* 1-code-and-hooks (implemented in Macaulay2#3118)
* 1-constant-to-RR (promote works since Macaulay2#3457, toRR is compiled so wontfix)
* 1-debian-changelog-file (distributions/deb package is deprecated)
* 1-deb-signatures (distributions/deb package is deprecated)
* 1-factory-bug (bug not present using factory from singular 4.3.2)
* 1-fflas (FFLAS-FFPACK added in 2011 -- see e50558b)
* 1-fpLLL (fpLLL added in 2013 -- see 2447204)
* 1-getPackage (getPackage was removed)
* 1-GPL (we added GPL 3 some time ago)
* 1-include-applications (this has been the behavior for some time)
* 1-Kronecker (added in 2010 -- see d1cb81c)
* 1-nextPrime (added in 2016 -- see 992b43f)
* 1-recursion-in-printing (no more recursion error -- now "no method found")
* 2-freeaddrinfo (fixed in 2009 -- see a107aeb)

[ci skip]
d-torrance added a commit that referenced this pull request Nov 7, 2025
* 0-atomic-ops-mac-os-x (now using C standard library atomics)
* 0-bugs/ggsmith.m2 (there's now a LocalRings package)
* 0-completion-for-packages (this has been the case for some time)
* 0-delete-error-message ("delete" is now a method)
* 0-doc (fixed at some point -- bug no longer present)
* 0-export-strings ("export" has been accepting only string since 2014)
* 0-factory ("libcfmem" is old -- we can link against factory w/o problems)
* 0-factory-depends (refers to nonexistent file)
* 0-getPackage-and-DOS (getPackage was removed)
* 0-gmp-as-mpir (we no longer link against MPIR)
* 0-hash-task (tasks now use nextHash)
* 0-merge-1.5 (merged in 2013! see 5088768)
* 0-ubuntu-dpkg-triggers (distributions/deb package is deprecated)
* 0-update-gpl-license-version (mentioned in LICENSING-NOTES)
* 0-Verbosity (duplicate of #273)
* 0.1-error-message (now get a "no method found" error)
* 0.1-xemacs (xemacs is essentially dead)
* 0.5-debian-script (distributions/deb package is deprecated)
* 0.5-fix-M2-exec-location (fixed by #2163)
* 0.5-package-finding-programs (fixed when "findProgram" was added)
* 0.5-ubuntu-repository (M2 has been in Debian/Ubuntu since 2020)
* 0.7-selectPairs (selectPairs implemented in #3305)
* 1-apropos (can use regex, e.g., apropos "(?i)sort")
* 1-code-and-hooks (implemented in #3118)
* 1-constant-to-RR (promote works since #3457, toRR is compiled so wontfix)
* 1-debian-changelog-file (distributions/deb package is deprecated)
* 1-deb-signatures (distributions/deb package is deprecated)
* 1-factory-bug (bug not present using factory from singular 4.3.2)
* 1-fflas (FFLAS-FFPACK added in 2011 -- see e50558b)
* 1-fpLLL (fpLLL added in 2013 -- see 2447204)
* 1-getPackage (getPackage was removed)
* 1-GPL (we added GPL 3 some time ago)
* 1-include-applications (this has been the behavior for some time)
* 1-Kronecker (added in 2010 -- see d1cb81c)
* 1-nextPrime (added in 2016 -- see 992b43f)
* 1-recursion-in-printing (no more recursion error -- now "no method found")
* 2-freeaddrinfo (fixed in 2009 -- see a107aeb)

[ci skip]
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