Le 17/06/2014 00:01, Julian Rüth a écrit :
* Bruno Grenet <bruno.gre...@gmail.com> [2014-06-16 23:41:31 +0200]:
First, I looked for these "_roots_univariate_polynomial" functions but they
do not seem to be defined anywhere ("grep -rl _roots_univariate_polynomial
SAGE_ROOT/src/sage/" only gives rings/polynomial/polynomial_element.c and
rings/polynomial/polynomial_element.pyx). In other words, it does not seem
that this functionality is ever used.
You are right. It is not used yet. Afaik _roots_univariate_polynomial
was introduced together with _factor_univariate_polynomial (which is
used in a few places.) It probably helps if you have a look at factor
(in sage/rings/polynomial/polynomial_element.pyx) and
_factor_univariate_polynomial (e.g. in sage/rings/qqbar.py).
The relation of roots and _roots_univariate_polynomial is essentially
the same.
In your case you would add a method _roots_univariate_polynomial to
sage.rings.integer_ring.IntegerRing_class.
I have the following problem using this strategy of a _roots_univariate_polynomial method. The new algorithm I add only deals with a very specific case, namely integer roots of integer sparse polynomials. In the method _roots_univariate_polynomial of the IntegerRing_class, what I'd like to do is in some sense to test whether ring=self (that is we want integer roots) and whether the polynomial is sparse, and if it is not the case to call back the roots method. Of course, this would create an endless loop... The other solution is to copy-paste the code of the roots method corresponding to an integer input polynomial into the new IntegerRing_class._roots_univariate_polynomial method. Is this second solution acceptable? My concern is that duplicate code does not seem a very nice idea ;-).

Bruno



julian

Le 14/06/2014 16:06, leif a écrit :
Julian Rüth wrote:
Bruno Grenet <bruno.gre...@gmail.com> [2014-06-12 13:47:59 +0200]:
- The algorithm I implemented uses some auxiliary functions that are
not of
real interest outside the algorithm. How should I do to avoid this
functions
be available for the users?
If you turn these auxiliary functions into methods of the ring Z, you
can hide them by adding a single (or double but many people dislike
this) underscore to the method name. If they are only used by your
method to compute roots, you could probably name these methods
_roots_from_factorization_method_name().
... or make them local to that method, if it's unlikely that they'll be
used by other methods in the future.


-leif

--
You received this message because you are subscribed to the Google Groups 
"sage-devel" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-devel+unsubscr...@googlegroups.com.
To post to this group, send email to sage-devel@googlegroups.com.
Visit this group at http://groups.google.com/group/sage-devel.
For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups 
"sage-devel" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-devel+unsubscr...@googlegroups.com.
To post to this group, send email to sage-devel@googlegroups.com.
Visit this group at http://groups.google.com/group/sage-devel.
For more options, visit https://groups.google.com/d/optout.

Reply via email to