On Tuesday, August 19, 2014 9:05:15 PM UTC+2, Simon King wrote: > > Hi Jean-Pierre, > > On 2014-08-19, Jean-Pierre Flori <jpf...@gmail.com <javascript:>> wrote: > > Though (non-prime) finite fields with the same order and defining > > polynomial are considered equal, I'd say the hashes should be different. > > Absolutely no way. If they are considered equal, then the hashes must be > the same. > You mean that it should be this way (for parents, or elements, or any class whether from cython or python)? I assume this is for parents.
> > It may, however, be a possibility to make them compare unequal, but with > coercion maps in both directions. > > > So, let's add the string of the implementation of the finite field into > > it's hash (which is cached by the way). > > Does that seem sensible? > > No. > > Ok. > > Or should I modify the finite field code so that these hashes are equal > > whatever the implementation is? > > Then we'd need coercion between all of the implementations (which is not > > currently the case but should be done anyway), but that would surely > yield > > a non-negligible speed penalty, > > Why should that be the case? Once a coercion is established, it will be > looked up from cache, which by the way uses a special kind of dictionary > that compares parents by identity, not equality. > > I mean actually applying the coercion might be expensive. That's why I'd like that when building a polynomial ring over a finite field using a given implementation it uses the same implementation to "represent" its coefficients. > > and you'll never know what the > > implementation of the base ring of the polynomial ring will be as it > will > > depend on the order finite fields and their polynomial rings are > created. > > So what? If possible, avoid making your code depend on types. > > > Or should we modify the caching system of the polynomial rings not to > use > > hashes but ids? > > This might indeed be a possibility. As mentioned above, the coercion > system uses such caches. > > Let F1, F2 be two different implementation of "the same" finite field. > Currently, F1[x] and F2[x] are identical objects, which may indeed > constitute a problem. Apart from making the cache use comparison by > identity, there is the possibility to be explicit about the > implementation of the polynomial ring (or do you still want to use the > default > implementation for the polynomial rings if there are different > implementations > of the base ringst?). Then your cache problem would vanish, since the > implementation is part of the cache key (the PolynomialRing constructor > has an "implementation" optional argument). > > Best regards, > Simon > > > -- 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.