hermann on Sun, 22 Feb 2026 22:32:17 +0100


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

Re: Question on factorint matrix modification


On 2026-02-22 22:11, Karim Belabas wrote:
Is there a simpler GP way to determine the factorization matrix of n/q from
F?
Is there a way without matrix comprehension?

? removep(F, i) = matreduce(matconcat([F, [F[i,1],-1]]~))
? for (i = 1, #F~, print(removep(F, i)))
[2, 2; 7, 1; 19, 2]
[2, 3; 19, 2]
[2, 3; 7, 1; 19, 1]

matreduce is quite flexible, and more general of course.

Thank you, and yes, matreduce(matconcat(...)) is definitely preferable.
I found the details of matreduce with ??matreduce.

Your method allows me to use foreach as well, nice:

? removep2(F,v)=matreduce(matconcat([F,[v,-1]]~));
? foreach(F~,f,print(removep2(F,f[1])))
[2, 2; 7, 1; 19, 2]
[2, 3; 19, 2]
[2, 3; 7, 1; 19, 1]
?

Regards,

Hermann.