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

Optimize computations by working with MPolyRingElem instead of UPoly where possible #250

Open
fingolfin opened this issue Jan 27, 2025 · 1 comment

Comments

@fingolfin
Copy link
Member

We already discussed this before, just to make sure it is not forgotten:

When possible we should consider unpacking all UPoly into MPolyRingElem then working with those, then only wrapping the result back into UPoly. That should avoid redundant allocations and also in some cases ensure we use optimized algorithms.

Caveat: we need to make sure the unwrapped polynomials all have the same parent. There is no nice helper for this right now, but there should be... in the meantime we can write something like this (untested, may need tweaking, but gives the right idea):

function unwrap(a)
   R = parent(a)
   s = data(a)
   if nvars(parent(s)) != nvars(R)
      s = upgrade(R, s)
   end
   return s
end
@SoongNoonien
Copy link
Member

I've opened an issue over at AbstractAlgebra about this unwrapping: Nemocas/AbstractAlgebra.jl#1969

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

No branches or pull requests

2 participants