#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 SimonKing):

 Replying to [comment:25 ncohen]:
 > Hmmmm... I see. Well, isn't your only parameter the number of bits you
 need to store each entry ?

 No. We have
 {{{
 #!c
 cdef Integer NumberArrows
 cdef Integer IntegerMask
 cdef size_t ArrowBitSize, BigArrowBitSize
 cdef block* bitmask = NULL
 cdef block DataMask, BitMask
 cdef size_t ArrowsPerBlock, BigArrowsPerBlock
 cdef size_t ModBAPB, DivBAPB, TimesBABS, TimesBlockSize
 }}}

 For example, `ModBAPB` is used to replace `n%BigArrowsPerBlock` by a bit-
 wise `and`, which is noticeably faster.

 > If it is, did you decided whether you want to allow it to be arbitrary,
 or if you want it to be a power of 2 ?

 Depending on the implementation...


 > If it is a power of 2, then perhaps templates are sufficient, i.e. "one
 data structure per value of this parameter". There are not so many powers
 of 2 between 1 and 64 that make sense to store something `:-)`

 Isn't duplication of code supposed to smell?

 > If your data structure is not an object, you could also add this width
 parameter as an input of the functions you use ? I guess all Bounded
 Sequence Integer that you use in the same function would have the same
 bound.

 Do I understand correctly: You suggest that we should ''not'' provide a
 class `BoundedIntegerSequence` that can be used interactively in Sage, but
 you suggest that we should just provide a couple of functions that operate
 on C structures (say, `mpz_t` or `usigned long*`) and can only be used in
 Cython code?

 Then it would be better to revert this ticket to its original purpose:
 There would be...
 1. ... cdef functions operating on `mpz_t` resp. on `unsigned long*`,
 2. ... a Cython class `Path` using `mpz_t` resp. `unsigned long*` as a
 cdef attribute, using the afore mentioned functions to implement
 concatenation and iteration,
 3. ... a subsequent ticket, implementing an F5 style algorithm to compute
 standard bases, operating not with `Path` but with `mpz_t*` resp `unsigned
 long**` (which will be the case anyway).

 > But admittedly I love to split hairs. Tell me if you think that this is
 going too far `:-P`

 No problem. I just want to know if people see the need to have a Cython
 implementation of sequences of bounded integers, for use in Python.

 > Ahahahah. That's up to you. I just hate Sage's parents/elements. I would
 live happy with a C pointer I can  control, but not witha framework that I
 do not understand.

 Making it something like a container rather than a fully fledged parent
 would be an option, from my perspective.

--
Ticket URL: <http://trac.sagemath.org/ticket/15820#comment:26>
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/groups/opt_out.

Reply via email to