#15820: Implement sequences of bounded integers
--------------------------------------------+------------------------
Reporter: SimonKing | Owner:
Type: enhancement | Status: new
Priority: major | Milestone: sage-6.2
Component: algebra | Resolution:
Keywords: sequence bounded integer | Merged in:
Authors: | Reviewers:
Report Upstream: N/A | Work issues:
Branch: | Commit:
Dependencies: | Stopgaps:
--------------------------------------------+------------------------
Comment (by ncohen):
> Apparently I am not used to templated code...
>
> I was somehow thinking that you suggested to keep the bitlength of the
upper bound for the integers as the ''only'' parameter, which means that
you would need to compute all the other things either for each operation
or (when storing it as attribute of the sequences) for each sequence.
Nonono. Somehow, you can think of templates as a way to "script" the
generation of code. You write some code with a constant k which is never
defined anywhere, and then you say "compile one version of this code for
each k in 1, 2, 3, 4, 5, 6. You end up with several data structures
implemented, each with a hardcoded value. And then you can create an
object `cdef LongCompressedPath<5> my_path` in which the hardcoded bound
is `2^5`. You just have many additional types, each with its own
constant.
> Part of the question is: Do we want to use gmp as backend? Or do we want
to (re-)implement operations on densely packed `long*` by ourselves? Given
the timings, gmp ''is'' an option.
Yep, you are right. Depends on how you weight the operations that you will
need: it looks okay for concatenations and bad for startwith, but I expect
that the most time consuming operation will be concatenation ? You are the
one who needs it `:-)`
> Anyway, I'll have a look at the stackoverflow discussion. Thank you for
the pointer!
>
> The next question then is how to access the code from Cython. I've done
this with C, but not C++.
HMmmmmmm.... There is a C++ interface in
numerical/backends/coin_backend.pyx but it does not play with templates. I
am interested in knowing if this kind of templates can be written in pure
Cython, do you mind if I ask the question on cython-devel (did you want to
send one yourself) ?
Nathann
--
Ticket URL: <http://trac.sagemath.org/ticket/15820#comment:35>
Sage <http://www.sagemath.org>
Sage: Creating a Viable Open Source Alternative to Magma, Maple, Mathematica,
and MATLAB
--
You received this message because you are subscribed to the Google Groups
"sage-trac" 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-trac.
For more options, visit https://groups.google.com/d/optout.