[GAP Forum] [GAP Support] suggestion for additional core operations on polynomials and lists
Laurent Bartholdi
laurent.bartholdi at gmail.com
Wed May 30 20:10:23 BST 2012
Dear Jacob:
All of the methods could appear, but I don't think it's a good idea to
install them as core GAP functions in that form, for efficiency
reasons. E.g., extracting a coefficient from a polynomial should be a
O(1) operation, but it's O(degree) in your implementation, and I don't
think it can ever be made better using the current GAP underlying
format. We shouldn't encourage programmers to use asymptotically
inefficient methods. Library methods should either perform high-level
operations on the polynomial (which then means "not looking at
coefficients individually"), or should be coded using an ext-rep of
the polynomial.
Similarly, "Flatten" may be useful for end users, but it is almost
certainly a mistake to use it inside library code, since it's
essentially the same as "Concatenation", except that non-lists are
allowed. In a library, one usually knows whether one has lists or
non-lists, so one can use "Concatenation" directly.
> if IsList(entry) then
> Append( result, entry );
> else
> Append( result, [entry] );
Here, this should be simply "Add(result,entry)".
> fi;
--
Prof. Dr. Laurent Bartholdi \ laurent.bartholdi<at>gmail<dot>com
G.-A. Universität zu Göttingen \ Phone: +49 551 39 7826
Bunsenstraße 3-5 \ Secr: +49 551 39 7752
D-37073 Göttingen, Germany \ Fax: +49 551 39 22674
More information about the Forum
mailing list