AbstractAlgebra.jl icon indicating copy to clipboard operation
AbstractAlgebra.jl copied to clipboard

unify iterators for univariate and multivariates and provide an automatic zipper

Open tthsqe12 opened this issue 3 years ago • 4 comments

zipper of coefficients and exponent_vectors

tthsqe12 avatar Oct 07 '22 13:10 tthsqe12

@thofma what about coefficients_and_exponent_vectors for zip(coefficients(), exponent_vectors())?

tthsqe12 avatar Oct 07 '22 14:10 tthsqe12

We need one name for both (univariate and multivariate) cases, so maybe coefficients_and_exponents.

On the other hand, I had a quick chat with @fieker and maybe we want coefficients to return zip in both (univariate and multivariate) cases and only the non-zero coefficients. Then we would need another name for just the coefficients. The reason is that coefficients alone is really useless in the multivariate case, so we could use this precious name for something useful.

Anyway, don't implement anything yet.

thofma avatar Oct 07 '22 14:10 thofma

Note: I am seeing lots of code like this for univariates:

   p = some univariate poly
   v = collect(coefficients(p))
   # assume that v is a dense array of coefficients

Hence, the iterators for univariates should not skip zero terms and should start at x^0.

tthsqe12 avatar Nov 08 '22 17:11 tthsqe12

@thofma what about exponent_vectors on univariate polynomials? In oscar, we don't have exponent_vectors, just exponents. exponent_vectors(poly) should obviously have eltype Vector{Int}. But if exponents ever comes to AA, exponents(poly) should have eltype Int?

tthsqe12 avatar Nov 14 '22 16:11 tthsqe12