hermann on Thu, 16 Nov 2023 08:07:43 +0100


[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]

Re: Question on ternary quadratic form


On 2023-11-16 07:49, Bill Allombert wrote:

Well, it is still assuming that G is positive definite,
and qflllgram might return a different LLL-reduced form.

qfisom use minimal vectors as you suggest.

Thanks Bill,

I have updated the gist, with some asserts removed:
https://gist.github.com/Hermann-SW/f13b8adf7d7e3094f0b6db0bce29a7b8#file-tqf-gp-L35-L43

    ...
    Q=get_tqf(n1);
    G=qflllgram(Q,flag=1);
    assert(G~*Q*G==[1,0,0;0,1,0;0,0,1]);
    ...

Matrix Q is positive definite by construction.
But I will look into qfisom as well.

Nice:

pi@raspberrypi400:~ $ n=255 gp -q < tqf.gp
255=[2, 13, 9, 1]
all asserts OK
pi@raspberrypi400:~ $ dbg=1 n=255 gp -q < tqf.gp
 Q=[797, 1622, 1; 1622, 3301, 0; 1, 0, 254]
 G=[-2, 521, -753; 1, -256, 370; 0, -2, 3]
255=[2, 13, 9, 1]
all asserts OK
pi@raspberrypi400:~ $ dbg=1 n=65535 gp -q < tqf.gp
 Q=[30390, 204507, 1; 204507, 1376213, 0; 1, 0, 65534]
 G=[-65309, 131190, 262131; 9705, -19495, -38953; 1, -2, -4]
65535=[225, 122, 5, 1]
all asserts OK
pi@raspberrypi400:~ $


So nice that G^-1*[0,0,1]~ gives the sum of three squares.
tqf.gp handles n=4^a*(8**b+7) as well and returns 4 squares.

Here is small animation for n=1..127:
https://stamm-wilbrandt.de/videos/Peek_2023-11-16_01-05.gif


Regards,

Hermann.