Dear all,
I am trying to hook LinBox into sage more tightly, and LinBox makes extensive use of templates, amongst other kinds of nastiness.
LinBox has classes for various mathematical domains, and a lot functions are templated by the domain on which they operate. I am typically facing:
template<Matrix>
void determinant(Matrix::Field::Element &result, const Matrix &A);
^^^^^^^^^^^^^^^^^^^^^^
The Matrix class describes either a sparse or dense matrix, over the integers/rationals/modulo-p-implemented-as-floats, etc.
The problem is that I don't know how to refer to the nested classes of the template class. If I write the following cython declaration:
cdef extern from "linbox/solutions/det.h" namespace "LinBox":
cdef void determinant[Matrix] (Matrix.Field.Element &result, const Matrix &A)
I get an error: "Matrix is not a cimported module".
The only workaround I have found so far is to give up on genericity and write :
cdef extern from "linbox/solutions/det.h" namespace "LinBox":
cdef void determinant(TheFieldIWant &result, const TheMatrixIWant &A)
cdef void determinant(TheOtherFieldIWant &result, const TheOtherMatrixIWant &A)
...
Some advice would be much appreciated! :-)
Best regards,
--
Charles Bouillaguet