[sage-devel] Re: How to "template" cdef classes

2014-05-14 Thread Simon King
Hi Robert, On 2014-05-14, Robert Bradshaw wrote: > Another option is to do code generation, e.g. with one of the (many) > Python templating libraries out there. You mean some program will write Cython code for me, Cython will write C code for me, and gcc will do the rest? Has this approach been

Re: [sage-devel] Re: How to "template" cdef classes

2014-05-14 Thread Robert Bradshaw
Another option is to do code generation, e.g. with one of the (many) Python templating libraries out there. On Wed, May 14, 2014 at 8:59 AM, Simon King wrote: > Hi Martin, > > On 2014-05-14, Martin Albrecht wrote: >> We've done some templating before when Cython didn't speak C++ so well and/or >

[sage-devel] Re: How to "template" cdef classes

2014-05-14 Thread Simon King
Hi Martin, On 2014-05-14, Martin Albrecht wrote: > We've done some templating before when Cython didn't speak C++ so well and/or > when C code was involved. > > 1. sage.rings.polynomials.polynomial_template provides a way to wrap > univariate polynomials. > ... > 2. Matrix_modn_dense_template i

Re: [sage-devel] Re: How to "template" cdef classes

2014-05-14 Thread Martin Albrecht
We've done some templating before when Cython didn't speak C++ so well and/or when C code was involved. 1. sage.rings.polynomials.polynomial_template provides a way to wrap univariate polynomials. It is used by three classes: polynomial_gf2x polynomial_zmod_flint polynomial_zz_pex 2. Matrix_m

[sage-devel] Re: How to "template" cdef classes

2014-05-14 Thread Jean-Pierre Flori
On Wednesday, May 14, 2014 5:09:11 PM UTC+2, Simon King wrote: > > Hi Jean-Pierre, > > On 2014-05-14, Jean-Pierre Flori > wrote: > > Maybe use Cython C++ template support? > > Note that recent Cython version even allows C++ template functions (and > not > > only classes/methods as before).

[sage-devel] Re: How to "template" cdef classes

2014-05-14 Thread Simon King
Hi Jean-Pierre, On 2014-05-14, Jean-Pierre Flori wrote: > Maybe use Cython C++ template support? > Note that recent Cython version even allows C++ template functions (and not > only classes/methods as before). In the cython version that is included in Sage? And is it possible to write this in p

[sage-devel] Re: How to "template" cdef classes

2014-05-14 Thread Jean-Pierre Flori
On Wednesday, May 14, 2014 4:46:52 PM UTC+2, Simon King wrote: > > Hi! > > The topic of this post/request: Please share your knowledge about how > to keep code duplication as small as possible when writing Cython code > relying on several underlying implementations! > > In the Sage library, I