Ticket #2598 (closed enhancement: fixed)

Opened 5 years ago

Last modified 5 years ago

[with patch, positive review] allow ZZ element to be constructed from GF(2) list

Reported by: malb Owned by: somebody
Priority: minor Milestone: sage-2.11
Component: basic arithmetic Keywords:
Cc: Work issues:
Report Upstream: Reviewers:
Authors: Merged in:
Dependencies: Stopgaps:

Description (last modified by mabshoff) (diff)

This works for some time now:

sage: ZZ([1,0], 2)
1

and after the patch this also works:

sage: ZZ([GF(2)(1),GF(2)(0)], 2)
1

It is -- at least for my applications -- common to get a list of bits, do some bitstuff with them and combine them again to an integer.

Attachments

zz_gf2_constructor.patch Download (1.4 KB) - added by malb 5 years ago.

Change History

Changed 5 years ago by malb

comment:1 Changed 5 years ago by mabshoff

  • Description modified (diff)

comment:2 Changed 5 years ago by jbmohler

  • Summary changed from [with patch, needs review] allow ZZ element to be constructed from GF(2) list to [with patch, positive review] allow ZZ element to be constructed from GF(2) list

The patch does what it claims and adds an appropriate doc-test. There is a small (maybe 7-8%) speed-hit, but I think it is worth it for the improved functionality.

I say it should be applied.

comment:3 Changed 5 years ago by mabshoff

  • Status changed from new to closed
  • Resolution set to fixed

Merged in Sage 2.11.alpha1

Note: See TracTickets for help on using tickets.