> The GMP implementation that is used doesn't look very sophisticated, though.
> We should really patch it to use DeBruijn sequences instead.
H.. Well, that is faster only if you do many many computations one
after the other. You must compensate for the time spent building the
cache !
Though
On Friday, December 6, 2013 6:39:53 AM UTC-8, Tom wrote:
>
> (i.valuation(2) for i in srange(1,2^n))
>
> does the job -- though this can certainly be implemented better.
>
Yes, I think in sage it should be spelled
(i.trailing_zero_bits() for i in srange(1,2^n))
The GMP implementation that is u
> The most beautiful way to do this is certainly this one :
Oops, my apologies. It is actually the last example in the list you gave :-)
Nathann
--
You received this message because you are subscribed to the Google Groups
"sage-devel" group.
To unsubscribe from this group and stop receiving em
> Hm, I can imagine that counting ones may not be the fastest way to determine
> the valuation of an integer. If i is very large and odd, for instance, the
> above solution seems a bit slow to me. Here are some other solutions:
> http://graphics.stanford.edu/~seander/bithacks.html#ZerosOnRightL
On Friday, December 6, 2013 6:52:26 AM UTC-8, Tom wrote:
>
> Well too darned bad, 'cause I'm gonna share the magic formula I just
> found anyway:
>
> [((i&-i)-1).popcount() for i in srange(1,2^n)]
>
> from http://aggregate.org/MAGIC/
>
Hm, I can imagine that counting ones may not be the faste
> FXT [1] that Nathan mentioned seems very nice...
This book is GREAT. The only default it has is its price... Even though it
can be downloaded for free.
> and GPL... but is not
> yet a standard spkg of Sage! Does it make sense to create a spkg for
> it ?
What do you mean, create a SPKG ? That's
Hi,
FXT [1] that Nathan mentioned seems very nice... and GPL... but is not
yet a standard spkg of Sage! Does it make sense to create a spkg for
it ? It is mentionned on trac only in #7656 about bitsets.
Best
Vincent
[1] http://www.jjj.de/fxt/fxtpage.html
2013/12/6, Nathann Cohen :
> Yo
> Well too darned bad, 'cause I'm gonna share the magic formula I just
> found anyway:
>
> [((i&-i)-1).popcount() for i in srange(1,2^n)]
Nice !!!
Nathann
--
You received this message because you are subscribed to the Google Groups
"sage-devel" group.
To unsubscribe from this group and stop re
Well too darned bad, 'cause I'm gonna share the magic formula I just
found anyway:
[((i&-i)-1).popcount() for i in srange(1,2^n)]
from http://aggregate.org/MAGIC/
On Fri, Dec 6, 2013 at 6:42 AM, Nathann Cohen wrote:
> Yo !!
>
>> Yes indeed -- with a formula like that, there's little re
Yo !!
> Yes indeed -- with a formula like that, there's little reason not to
> implement it ad-hoc every time. Unless a user wants it, and doesn't
> know this bit of information. Though... what Nathann said was
> that he wants to know which bit changes...
>
> (i.valuation(2) for i in
On Thu, Dec 5, 2013 at 9:50 PM, Nils Bruin wrote:
> It will be very hard to beat the simple closed formula
>
> ( (i>>1) ^^ i for i in xrange(2^n) )
>
Yes indeed -- with a formula like that, there's little reason not to
implement it ad-hoc every time. Unless a user wants it, and doesn't
know thi
Hi all,
> ... especially if it's C code messing with bits :-P
It's only for lengths up to 16 but M4RI is kinda build around Gray codes, so:
https://bitbucket.org/malb/m4ri/src/49263e2d1095cd0db69b61e11c158230f94d5529/src/graycode.h?at=default
--
name: Martin Albrecht
_pgp: http://pgp.mit.edu:11
12 matches
Mail list logo