-
Notifications
You must be signed in to change notification settings - Fork 297
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
Refactor polynomials and finsupp #1864
Comments
All of these changes seem like good ideas to me. With regards to computation speed, I'm usually not in favour of sacrificing ease of proof for faster computation. There's no such thing as the fastest implementation of polynomials over an arbitrary ring, and preserving computability often requires |
Just to expand on something which probably most people already know about computation speed: as Chris says, there's no right decision for an implementation if "you want speed". I've used (unverified) computer algebra systems in the past for manipulating large matrices, and even though they might pretend there is one constructor for a matrix, there have been flags which the user can set when constructing a matrix; e.g. flag= |
@kbuzzard Updated main description. |
There's just been some brief discussion on Zulip. I think the consensus there is:
|
Still, defining a wrapper type |
Then I'd rename |
I'm working on this now. I've added
It mostly seems to work, so I'll PR soon. |
@urkud, it's possible that the "refactor" parts of this issue are now done. (I think we decided not to switch to Shall we close this and make separate ones for:
|
Drawbacks of the current implementation:
(P * Q) A = P A * Q A
ifP, Q
are polynomials, andA
is a matrix. At least, not indata/polynomial
.finsupp
pretends to be a function, actually it is a monoid algebra.For
f g : α →?? β
with anything in place of??
I'd expectf * g
to be the pointwise multiplication.∑ e^{λ_k t} P_k(t)
.Proposed changes
Mathematically visible
finsupp
on top ofdfinsupp
.has_mul
onfinsupp
to the pointwise multiplication.monoid_algebra R M := finsupp M R
with multiplication from the oldfinsupp
.aeval
for non-commutative algebras (e.g., endomorphisms of a vector space).eval₂
or redefine it in terms ofaeval
with an ad-hocof_hom
algebra
structure .Improving computation
It might make sense to turnfinsupp
ormonoid_algebra
into a structure that takes some optional arguments (and propositions stating that they are equal to default implementations), and uses them to speed up computation. Currently I don't know what arguments would make sense.Another approach is to haveBased on comments below, those who want fast computation should write a custom structure that works fast for their use case, and define aring_equiv
betweenmonoid_algebra R (multiplicative nat)
and this structure.The text was updated successfully, but these errors were encountered: