Hello everyone, (see end for questions only) I am currently writing a sampling of functions as c++ mini library I want to be able to use in sage. The target is a (preferable fast) implementation of mulders-storjohann to compute the weak-popov-form of a matrix over a polynomial ring over a finite (extension) field.
So far I made: - a prototype in sage that seems to work - an implementation in c++ using templates the interface looks like this: Matrix& WeakPopovFormDomain<Ring>::weak_popov_form_inp<Matrix>(Matrix& A) and I tested it using a custom matrix class (because the class only needet to support .coldim() .rowdim() and [][] operation) and NTL::ZZ_pEX, which seems to work as well. After this I added a .pxd file containing: cdef extern from "hiwi/algorithms/weak-popov-form.h" namespace "hiwi_ms::WeakPopovFormDomain<NTL::ZZ_pEX>": Matrix_generic_dense& weak_popov_form_inp(Matrix_generic_dense& A) (and I added a corresponding .pyx with a wrapped function call because it was in one of the cython examples.) (withi "hiwi" being a temporary module and namespace name since I am contracted as a so called hiwi to do this) Unfortunately I found it really hard to find out what kind of object would be used and how to use them. A simplistic sage example of what I want to do would be: F.<a> = GF(2^8,'a') PF.<x> = F[] type(PF.random_element()) <type 'sage.rings.polynomial.polynomial_zz_pex.Polynomial_ZZ_pEX'> A= matrix([[PF.random.element()]],ring=PF) type(A) <type 'sage.matrix.matrix_generic_dense.Matrix_generic_dense'> two of the things I tried are: from sage.matrix.matrix_generic_dense cimport Matrix_generic_dense cdef extern from "NTL/ZZ_pEX.h" namespace "NTL": cdef cppclass ZZ_pEX "NTL::ZZ_pEX" Unfortunately it seems I cant use Matrix_generic_dense like this ("Reference base type cannot be a Python object") and I'am not sure I can use ZZ_pEX like this, but it stopped throwing errors when I used a forward declaration instead of a from sage. ... .polynomial_zz_pex cimport Polynomial_ZZ_pEX The code in the sage/src/sage/ modules wasn't helpful either (it is not designed to learn from it, and I only work with cython a little for a month now), naming and structure was inspired by LinBox, because it was used in a similar fashion. *My questions therefore are:How do I find the correct objects to be used, how do I import them correctly and most importantly:How can I correctly use them as parameters for my functions?* I probably missed something important, please let me know. Regards David -- 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.