Re: Question on factorint matrix modification

[email protected] Sun, 22 Feb 2026 22:32:03 +0100
Newsgroups gmane.comp.mathematics.pari.user
Message-ID <[email protected]>
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.