วันเสาร์ที่ 8 กรกฎาคม พ.ศ. 2560

[sage-devel] Re: A bug in element display/matrix conversion when using special linear group over a finite field

Might also be more prudent to use GF(ring.characteristic(), ring.modulus()) within GAP to make sure both fields are 'on the same page' modulus-wise.

On Saturday, July 8, 2017 at 9:30:09 PM UTC+3, Itay Bookstein wrote:
Seems like the nature of this issue is general to the explicit 'ring' argument to the sage conversion function.
The bug happens whenever GAP reduces an element to a smaller subfield.
You'd expect this to work:
libgap.eval('Z(2^4)^2 + Z(2^4)^1 + Z(2^4)^0').sage(ring=GF(2^4))
But it throws the exact same error because GAP returned a subfield element:
sage: libgap.eval('Z(2^4)^2 + Z(2^4)^1 + Z(2^4)^0')
Z(2^2)^2
A correct fix would involve only the GapElement_FiniteField.sage method as far as I can tell.
I'm considering patching this myself locally in the meantime seeing as there's no progress on the issue so far.

I'm thinking the size check should be modified to verify that log_p(gap_field_size) divides log_p(ring_size), and the multiplicative_generator()'s exponent should be modified accordingly (i.e. multiplied by (p^n - 1) / (p^m - 1)).
Either that, or instead of using DefaultField (which gives the smallest field containing the element), GF(ring.cardinality()) could be used and the discrete logarithm calculated accordingly.
What do you think?
Could submit it afterwards for review, just want to make sure I'm in the right direction/not missing anything.

On Wednesday, June 7, 2017 at 1:19:45 AM UTC+3, Dima Pasechnik wrote:
This is a bug, for sure (also present in Sage 8.0.beta9)



On Tuesday, June 6, 2017 at 10:17:16 PM UTC+1, Itay Bookstein wrote:
Using Sage 7.6 on Ubuntu 16.04.
S = GF(2^4, 'a')
a = S.gen()

G = SL(2, S)

g1 = G([a**2, a**3 + a**2 + a, a + 1, 0])
g2 = G([a, 0, 0, a**3 + 1])

# prints True True
print g1 in G, g2 in G

# Throws a ValueError
print g1 * g2

Here's the exception:
---------------------------------------------------------------------------  ValueError                                Traceback (most recent call last)  <ipython-input-6-edd79a6f0ddd> in <module>()  ----> 1 print g1 * g2    /usr/local/sagemath/src/sage/structure/sage_object.pyx in sage.structure.sage_object.SageObject.__repr__ (/usr/local/sagemath/src/build/cythonized/sage/structure/sage_object.c:2694)()      190             return str(type(self))      191         else:  --> 192             result = repr_func()      193             if isinstance(result, unicode):      194                 # Py3 compatibility: allow _repr_ to return unicode    /usr/local/sagemath/src/sage/groups/matrix_gps/group_element.pyx in sage.groups.matrix_gps.group_element.MatrixGroupElement_gap._repr_ (/usr/local/sagemath/src/build/cythonized/sage/groups/matrix_gps/group_element.c:6695)()      490             '[1 1]\n[0 1]'      491         """  --> 492         return str(self.matrix())      493       494     def _latex_(self):    /usr/local/sagemath/src/sage/misc/cachefunc.pyx in sage.misc.cachefunc.CachedMethodCallerNoArgs.__call__ (/usr/local/sagemath/src/build/cythonized/sage/misc/cachefunc.c:13453)()     2399         if self.cache is None:     2400             f = self.f  -> 2401             self.cache = f(self._instance)     2402         return self.cache     2403     /usr/local/sagemath/src/sage/groups/matrix_gps/group_element.pyx in sage.groups.matrix_gps.group_element.MatrixGroupElement_gap.matrix (/usr/local/sagemath/src/build/cythonized/sage/groups/matrix_gps/group_element.c:7755)()      585         MS = self.parent().matrix_space()      586         ring = MS.base_ring()  --> 587         m = MS([x.sage(ring=ring) for x in entries])      588         m.set_immutable()      589         return m    /usr/local/sagemath/src/sage/libs/gap/element.pyx in sage.libs.gap.element.GapElement_FiniteField.sage (/usr/local/sagemath/src/build/cythonized/sage/libs/gap/element.c:12693)()     1384             field = self.DefaultField()     1385             if field.Size().sage() != ring.cardinality():  -> 1386                 raise ValueError('the given finite field has incompatible size')     1387             root = self.DefaultField().PrimitiveRoot()     1388             exp = self.LogFFE(root)    ValueError: the given finite field has incompatible size

Has anyone else encountered this?

--
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+unsubscribe@googlegroups.com.
To post to this group, send email to sage-devel@googlegroups.com.
Visit this group at https://groups.google.com/group/sage-devel.
For more options, visit https://groups.google.com/d/optout.

ไม่มีความคิดเห็น:

แสดงความคิดเห็น