Opened 17 months ago

# Implement integer_representation method for all finite fields

Reported by: Owned by: slelievre major sage-9.7 finite rings gh-DaveWitteMorris, slelievre N/A

In Sage 9.3.rc0, this works:

```sage: p = 127
sage: K.<t> = GF(p^2, modulus=x^2 + 1)
sage: type(K)
<class
'sage.rings.finite_rings.finite_field_givaro.FiniteField_givaro_with_category'>
sage: a = 3*t + 2
sage: a.integer_representation()
383
sage: 3*p + 2
383
```

but this does not:

```sage: p = 367
sage: K.<t> = GF(p^2, modulus=x^2 + 1)
sage: type(K)
<class
'sage.rings.finite_rings.finite_field_pari_ffelt.FiniteField_pari_ffelt_with_category'>
sage: a = 3*t + 2
sage: a.integer_representation()
Traceback (most recent call last)
...
AttributeError:
'sage.rings.finite_rings.element_pari_ffelt.FiniteFieldElement_pari_ffelt'
object has no attribute 'integer_representation'
```

Expected (`3 * 367 + 2`):

```1103
```

Additionally, the method should return a Sage integer rather than a Python integer as the existing implementation for Givaro finite field elements currently does.

Suggested by revisiting this 2013 question by Ask Sage user "bonjour":

Similar to:

• #31294: Implement `fetch_int` method for non-givaro finite fields

### comment:1 follow-up: ↓ 2 Changed 17 months ago by gh-DaveWitteMorris

This seems to be a duplicate of #8578 (except that the name of the method seems to have been `int_repr` back then), so I think one of the two should be closed.

There is a bit of discussion of this issue in this sage-devel thread.

### comment:2 in reply to: ↑ 1 Changed 17 months ago by slelievre

• Description modified (diff)
• Summary changed from Implement integer_representation method for non-givaro finite fields to Implement integer_representation method for all finite fields

This seems to be a duplicate of #8578 (except that the name of the method seems to have been `int_repr` back then), so I think one of the two should be closed.

Thanks for spotting that. I agree one of the tickets should be closed as duplicate. I don't mind which. Maybe it's less trouble to close the older one given the method changed name in the meantime.

### comment:3 Changed 16 months ago by mkoeppe

• Milestone changed from sage-9.3 to sage-9.4

Sage development has entered the release candidate phase for 9.3. Setting a new milestone for this ticket based on a cursory review.

### comment:4 Changed 12 months ago by mkoeppe

• Milestone changed from sage-9.4 to sage-9.5

### comment:5 Changed 8 months ago by mkoeppe

• Milestone changed from sage-9.5 to sage-9.6

### comment:6 Changed 5 months ago by mkoeppe

• Milestone changed from sage-9.6 to sage-9.7

### comment:7 Changed 3 months ago by lorenz

Sorry, I wasn't aware of this ticket and opened yet another duplicate at #33941. (This time with a patch!)

Note: See TracTickets for help on using tickets.