Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

__getitem__ followed by idealfrobenius -> SystemError #136

Open
pjbruin opened this issue Apr 3, 2023 · 4 comments
Open

__getitem__ followed by idealfrobenius -> SystemError #136

pjbruin opened this issue Apr 3, 2023 · 4 comments
Labels

Comments

@pjbruin
Copy link

pjbruin commented Apr 3, 2023

In cypari2 2.1.3, the code

from cypari2.pari_instance import Pari
pari = Pari()
M = pari('nfinit(x^2 + 1)')
P = M.idealfactor(7)[0, 0]
G = M.galoisinit()
print(G[5])  # error does not arise without this line
print(M.idealfrobenius(G, P))

raises SystemError: new_gen() argument not on PARI stack, not on PARI heap and not a universal constant

Possibly related: #133

@pjbruin
Copy link
Author

pjbruin commented Apr 3, 2023

Here is the output of G.debug() before doing G[5]:

[&=00007fa27bfff808] VEC(lg=9):2200000000000009 00007fa27bfff7e0 00007fa27bfff790 00007fa27bfff730 00007fa27bfff6e8 00007fa27bfff640 00007fa27bfff628 00007fa27bfff5e8 00007fa27bfff5c0 
  1st component = [&=00007fa27bfff7e0] POL(lg=5):1400000000000005 (+,varn=0):4000000000000000 00007fa27bfff7c8 00007fa28166a900 00007fa27bfff7b0 
    coef of degree 0 = [&=00007fa27bfff7c8] INT(lg=3):0200000000000003 (+,lgefint=3):4000000000000003 0000000000000001 
    coef of degree 1 = gen_0
    coef of degree 2 = [&=00007fa27bfff7b0] INT(lg=3):0200000000000003 (+,lgefint=3):4000000000000003 0000000000000001 
  2nd component = [&=00007fa27bfff790] VEC(lg=4):2200000000000004 00007fa27bfff778 00007fa27bfff760 00007fa27bfff748 
    1st component = [&=00007fa27bfff778] INT(lg=3):0200000000000003 (+,lgefint=3):4000000000000003 000000000000000d 
    2nd component = [&=00007fa27bfff760] INT(lg=3):0200000000000003 (+,lgefint=3):4000000000000003 0000000000000002 
    3rd component = [&=00007fa27bfff748] INT(lg=3):0200000000000003 (+,lgefint=3):4000000000000003 00000000000000a9 
  3rd component = [&=00007fa27bfff730] VEC(lg=3):2200000000000003 00007fa27bfff718 00007fa27bfff700 
    1st component = [&=00007fa27bfff718] INT(lg=3):0200000000000003 (+,lgefint=3):4000000000000003 0000000000000063 
    2nd component = [&=00007fa27bfff700] INT(lg=3):0200000000000003 (+,lgefint=3):4000000000000003 0000000000000046 
  4th component = [&=00007fa27bfff6e8] MAT(lg=3):2600000000000003 00007fa27bfff6d0 00007fa27bfff688 
    mat(1,1) = [&=00007fa27bfff6b8] INT(lg=3):0200000000000003 (+,lgefint=3):4000000000000003 0000000000000055 
    mat(1,2) = [&=00007fa27bfff670] INT(lg=3):0200000000000003 (+,lgefint=3):4000000000000003 0000000000000055 
    mat(2,1) = [&=00007fa27bfff6a0] INT(lg=3):0200000000000003 (+,lgefint=3):4000000000000003 0000000000000023 
    mat(2,2) = [&=00007fa27bfff658] INT(lg=3):0200000000000003 (+,lgefint=3):4000000000000003 0000000000000086 
  5th component = [&=00007fa27bfff640] INT(lg=3):0200000000000003 (+,lgefint=3):4000000000000003 0000000000000001 
  6th component = [&=00007fa27bfff628] VEC(lg=3):2200000000000003 00007fa27bfff610 00007fa27bfff5f8 
    1st component = [&=00007fa27bfff610] VECSMALL(lg=3):2c00000000000003 0000000000000001 0000000000000002 
    2nd component = [&=00007fa27bfff5f8] VECSMALL(lg=3):2c00000000000003 0000000000000002 0000000000000001 
  7th component = [&=00007fa27bfff5e8] VEC(lg=2):2200000000000002 00007fa27bfff5d0 
    1st component = [&=00007fa27bfff5d0] VECSMALL(lg=3):2c00000000000003 0000000000000002 0000000000000001 
  8th component = [&=00007fa27bfff5c0] VECSMALL(lg=2):2c00000000000002 0000000000000002 

After doing G[5]:

[&=000056555531dcc0] VEC(lg=9,CLONE):2300000000000009 000056555531df28 000056555531ded8 000056555531de78 000056555531de30 000056555531dd88 000056555531dd70 000056555531dd30 000056555531dd08 
  1st component = [&=000056555531df28] POL(lg=5):1400000000000005 (+,varn=0):4000000000000000 000056555531df10 00007fa28166a900 000056555531def8 
    coef of degree 0 = [&=000056555531df10] INT(lg=3):0200000000000003 (+,lgefint=3):4000000000000003 0000000000000001 
    coef of degree 1 = gen_0
    coef of degree 2 = [&=000056555531def8] INT(lg=3):0200000000000003 (+,lgefint=3):4000000000000003 0000000000000001 
  2nd component = [&=000056555531ded8] VEC(lg=4):2200000000000004 000056555531dec0 000056555531dea8 000056555531de90 
    1st component = [&=000056555531dec0] INT(lg=3):0200000000000003 (+,lgefint=3):4000000000000003 000000000000000d 
    2nd component = [&=000056555531dea8] INT(lg=3):0200000000000003 (+,lgefint=3):4000000000000003 0000000000000002 
    3rd component = [&=000056555531de90] INT(lg=3):0200000000000003 (+,lgefint=3):4000000000000003 00000000000000a9 
  3rd component = [&=000056555531de78] VEC(lg=3):2200000000000003 000056555531de60 000056555531de48 
    1st component = [&=000056555531de60] INT(lg=3):0200000000000003 (+,lgefint=3):4000000000000003 0000000000000063 
    2nd component = [&=000056555531de48] INT(lg=3):0200000000000003 (+,lgefint=3):4000000000000003 0000000000000046 
  4th component = [&=000056555531de30] MAT(lg=3):2600000000000003 000056555531de18 000056555531ddd0 
    mat(1,1) = [&=000056555531de00] INT(lg=3):0200000000000003 (+,lgefint=3):4000000000000003 0000000000000055 
    mat(1,2) = [&=000056555531ddb8] INT(lg=3):0200000000000003 (+,lgefint=3):4000000000000003 0000000000000055 
    mat(2,1) = [&=000056555531dde8] INT(lg=3):0200000000000003 (+,lgefint=3):4000000000000003 0000000000000023 
    mat(2,2) = [&=000056555531dda0] INT(lg=3):0200000000000003 (+,lgefint=3):4000000000000003 0000000000000086 
  5th component = [&=000056555531dd88] INT(lg=3):0200000000000003 (+,lgefint=3):4000000000000003 0000000000000001 
  6th component = [&=000056555531dd70] VEC(lg=3):2200000000000003 000056555531dd58 000056555531dd40 
    1st component = [&=000056555531dd58] VECSMALL(lg=3):2c00000000000003 0000000000000001 0000000000000002 
    2nd component = [&=000056555531dd40] VECSMALL(lg=3):2c00000000000003 0000000000000002 0000000000000001 
  7th component = [&=000056555531dd30] VEC(lg=2):2200000000000002 000056555531dd18 
    1st component = [&=000056555531dd18] VECSMALL(lg=3):2c00000000000003 0000000000000002 0000000000000001 
  8th component = [&=000056555531dd08] VECSMALL(lg=2):2c00000000000002 0000000000000002 

@videlec
Copy link
Collaborator

videlec commented Apr 3, 2023

Could you test with #134?

@pjbruin
Copy link
Author

pjbruin commented Apr 3, 2023

#134 does not appear to fix the problem. The function idealfrobenius behaves a bit like a member function: it returns (or at least may return), without copying onto the stack, a component of another GEN, in this case of the list of all elements of the Galois group. However, its prototype is simply GGG.

@videlec
Copy link
Collaborator

videlec commented Apr 3, 2023

I see, it is rather the __getitem__ which is problematic.

@videlec videlec added the bug label Oct 31, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants