#15820: Implement sequences of bounded integers
-------------------------------------+-------------------------------------
       Reporter:  SimonKing          |        Owner:
           Type:  enhancement        |       Status:  needs_work
       Priority:  major              |    Milestone:  sage-6.3
      Component:  algebra            |   Resolution:
       Keywords:  sequence bounded   |    Merged in:
  integer                            |    Reviewers:
        Authors:  Simon King         |  Work issues:  Fix flakyness in
Report Upstream:  N/A                |  adding sequences
         Branch:                     |       Commit:
  u/SimonKing/ticket/15820           |  735939e593c9c302ff42c4973cbfe2e48eb22644
   Dependencies:                     |     Stopgaps:
-------------------------------------+-------------------------------------

Comment (by SimonKing):

 Current status is a struggle with sub-sequence recognition in the presence
 of trailing zeroes.

 Here is the type of examples that I propose:
 - Use a sequence of length 7 with a bound of 32. Then, we need 35 bit to
 store the sequence.
 - At least on my machine, a GMP limb comprises 32 bit. Hence, the above
 sequence fits into two limbs, we only use three bit of the second limb.
 - Choose the last item of the sequence such that it fits into 2 bit. Then,
 the three bit stored in the second limb are zero.
 - Now, do an operation that involves a `mpz_*` function to create a new
 bounded integer sequence, ''only'' adding trailing zeroes. This currently
 is in concatenation and slicing. This may result in GMP cutting off the
 trailing zeroes.

 When we then do operations involving `mpn_*` functions, it is needed to
 take care of the cut off bits (and treat them as zero). My current private
 branch (not pushed yet) involves several tests that are failing with the
 branch currently attached here, but succeed in my current branch.

 Still failing is this:
 {{{
             sage: X = BoundedIntegerSequence(21, [4,1,6,2,7,2,3])
             sage: S = BoundedIntegerSequence(21, [0,0,0,0,0,0,0])
             sage: loads(dumps(X+S))
             <4, 1, 6, 2, 7, 2, 3, 0, 0, 0, 0, 0, 0, 0>
             sage: loads(dumps(X+S)) == X+S
             True
             sage: T = BoundedIntegerSequence(21,
 [0,4,0,1,0,6,0,2,0,7,0,2,0,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0])
             sage: T[3::2]==(X+S)[1:]
             True
             sage: T[3::2] in X+S
             False     # should return True!
 }}}

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

Reply via email to