I'm working on porting the matrix groups in Sage to libGAP currently. Its 
not finished yet, but real soon (TM) you'll be able to convert matrices 
between sage and GAP:

sage: M_s = random_matrix(GF(5), 3)
sage: M_s
[2 0 1]
[3 3 4]
[1 1 1]
sage: type(M_s)
sage.matrix.matrix_modn_dense_float.Matrix_modn_dense_float

sage: M_g = libgap.matrix(M_s)
sage: M_g
[ [ Z(5), 0*Z(5), Z(5)^0 ], [ Z(5)^3, Z(5)^3, Z(5)^2 ], [ Z(5)^0, Z(5)^0, 
Z(5)^0 ] ]
sage: type(M_g)
sage.libs.gap.element.GapElement_List

sage: MatrixGroup([M_s])
Matrix group over Finite Field of size 5 with 1 generators (
[2 0 1]
[3 3 4]
[1 1 1]
)
sage: _.cardinality()
124


On Thursday, February 28, 2013 2:45:28 AM UTC-10, Jesús Torrado wrote:
>
> Dear all,
>
> I have implemented a finite matrix group as explained in "
> http://www.sagemath.org/doc/reference/sage/groups/libgap_wrapper.html";, 
> starting from some matrix generators, i.e. in the example 
> "libgap.Group(generators)" instead of "libgap.CyclicGroup(3)". Everything 
> works fine: I call an element and get its matrix representation printed. 
> However, I can not get the element easily as a Matrix instance, what I want 
> to do to take its Smith normal form. The only way I have found to work so 
> far is, being ``element`` an instance of the Element class,
>
>      sage: Matrix(self.base_ring(), self.gap().sage())
>
> which works, but something tells me there is an easier way. Is there?
>
> Second, how do I cast a gap integer into a safe integer? For example, the 
> following fails:
>
>     sage: a =libgap.DimensionOfMatrixGroup(group)
>     sage: print a
>     >>> 2 
>     sage: ZZ(a)
>     >>>   [...] TypeError: unable to coerce <type 
> 'sage.libs.gap.element.GapElement_Integer'> to an integer
>
> Is there a proper way, or a workaround?
>
> Anyway, I think libgap is one of the best contributions to sage possible. 
> Thanks so much, Volker!
>
> Cheers,
> Jesús Torrado
>

-- 
You received this message because you are subscribed to the Google Groups 
"sage-support" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/sage-support?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to