Opened 9 years ago

Closed 7 years ago

Last modified 7 years ago

#11353 closed enhancement (fixed)

bitset complement

Reported by: jason Owned by: jason
Priority: minor Milestone: sage-5.5
Component: misc Keywords:
Cc: minh, ncohen Merged in: sage-5.5.beta1
Authors: David Coudert Reviewers: Nathann Cohen
Report Upstream: N/A Work issues:
Branch: Commit:
Dependencies: Stopgaps:

Description

It would be very useful if the Bitset and FrozenBitset? had complement operators that returned a new bitset that was the complement:

sage: list(~FrozenBitset([0,1],capacity=3))
[2]

There already is a fast bitset_complement cython function, so I think it's a matter of just wrapping it.

Attachments (1)

trac_11353_complement_of_frozenbitset.patch (2.2 KB) - added by dcoudert 7 years ago.

Download all attachments as: .zip

Change History (9)

comment:1 Changed 8 years ago by davidloeffler

  • Component changed from PLEASE CHANGE to misc
  • Owner changed from tbd to jason

Changed 7 years ago by dcoudert

comment:2 follow-up: Changed 7 years ago by dcoudert

  • Authors set to David Coudert
  • Status changed from new to needs_review

The attached file adds the complement operation to FrozenBitset?, and so to Bitset, and binds it to tilde.

I needed it, so I did it.

comment:3 in reply to: ↑ 2 Changed 7 years ago by ncohen

I needed it, so I did it.

Love that quote :-D

Nathann

comment:4 Changed 7 years ago by ncohen

  • Reviewers set to Nathann Cohen
  • Status changed from needs_review to positive_review

WELL. I guess that there's nothing to say here :-)

Nathann

comment:5 Changed 7 years ago by dcoudert

Thanks!

comment:6 Changed 7 years ago by jdemeyer

  • Milestone changed from sage-5.4 to sage-5.5

comment:7 Changed 7 years ago by jdemeyer

  • Merged in set to sage-5.5.beta1
  • Resolution set to fixed
  • Status changed from positive_review to closed

comment:8 Changed 7 years ago by jason

argh! I just spent 20 minutes implementing this and finishing a patch for it. I should have checked here first! Thanks for doing this and getting it in!

Note: See TracTickets for help on using tickets.