Ticket #11353 (closed enhancement: fixed)

Opened 2 years ago

Last modified 6 months ago

bitset complement

Reported by: jason Owned by: jason
Priority: minor Milestone: sage-5.5
Component: misc Keywords:
Cc: minh, ncohen Work issues:
Report Upstream: N/A Reviewers: Nathann Cohen
Authors: David Coudert Merged in: sage-5.5.beta1
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

trac_11353_complement_of_frozenbitset.patch Download (2.2 KB) - added by dcoudert 10 months ago.

Change History

comment:1 Changed 14 months ago by davidloeffler

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

Changed 10 months ago by dcoudert

comment:2 follow-up: ↓ 3 Changed 10 months ago by dcoudert

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

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 months ago by ncohen

I needed it, so I did it.

Love that quote :-D

Nathann

comment:4 Changed 7 months ago by ncohen

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

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

Nathann

comment:5 Changed 7 months ago by dcoudert

Thanks!

comment:6 Changed 7 months ago by jdemeyer

  • Milestone changed from sage-5.4 to sage-5.5

comment:7 Changed 7 months ago by jdemeyer

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

comment:8 Changed 6 months 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.