Git Product home page Git Product logo

Comments (4)

nthiery avatar nthiery commented on September 14, 2024

from mitm-sage.

florian-rabe avatar florian-rabe commented on September 14, 2024

@nthiery I think you misunderstood the question about the canonical function to build a polynomial.

I need a function f such that f(R, d) returns a polynomial in polynomial ring R with coefficient dictionary d.

from mitm-sage.

nthiery avatar nthiery commented on September 14, 2024

Sorry if I have not made my point clear. Up to curyfication, R is that function:

def f(R, d):
     return R(d)

from mitm-sage.

florian-rabe avatar florian-rabe commented on September 14, 2024

I've added the code as envisioned, but there are still some issues.

Nicolas recommends hooking directly into the pickling.
He expects the unpickling-based work flow will not work for nested objects.

The necessary code would be

from sage.rings.polynomial.multi_polynomial_ring_base import MPolynomialRing_base
from sage.rings.polynomial.polynomial_ring import PolynomialRing_general
from sage.rings.polynomial.polynomial_element import Polynomial

def pickle_polynomial(p):
   return lambda R,d: R(d), (p.parent(), p.dict())
copyreg.pickle(Polynomial, pickle_polynomial)
def pickle_polynomial_ring(p):
   return lambda br,vn: PolynomialRing(br,vn), (p.base_ring(), p.varnames())
copyreg.pickle(MPolynomialRing_base, pickle_polynomial_ring)

We should also double-check what common base class Sage polynomials have. I received different results at two different times.

from mitm-sage.

Related Issues (2)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.