\\% Normal polynomials and multiplier matrices. \\ Author: Joerg Arndt \\ online at http://www.jjj.de/pari/ \\ version: 2009-September-11 (02:35) normal_mat(p)= { /* auxiliary routine */ local(n, m, tm, t, v, n1, e); n = poldegree(p); e = Mod(1,2); tm = Mod(x*e, e*p); n1 = n - 1; m=matrix(n,n); for (i=1, n, \\ t = component(tm, 2); t = lift(tm); for (j=1, n, m[i,j]=polcoeff(t,j-1)); tm *= tm; ); return ( m ); } /* ------------ */ pol_is_normal(p, iq=0)= { /* Return whether polynomial p is normal */ local(n,m,t); if ( 0==iq, iq=polisirreducible(p) ); if ( 0==iq, return( 0 ) ); n = poldegree(p); m = normal_mat(p); t = matrank(m); return ( t==n ); } /* ------------ */ mat_foo(d)= { /* permutation needed for multiplier matrix */ local(n, n1, m); n = matsize(d)[1]; m = matrix(n,n); n1 = n-1; for (i=0, n1, c = (n-i) % n; for (j=0, n1, r = (j-i) % n; m[i+1, j+1] = d[r+1, c+1]; ); ); return ( m ); } /* ------------ */ normal_multiplier(p)= { /* Return multiplier matrix for p */ local(n, a, b, c); n = poldegree(p); a = normal_mat(p); b = a^(-1); c = matcompanion(p); d = a*c~*b; d = mat_foo(d); return (d); } /* ------------ */ \\ ==== end of file ====