Keywords: 389

Next: About this document ... Up: The unusual Hecke algebra X(389) Previous: Discriminant of the Hecke

# PARI code

The following is a PARI program that might be helpful to the reader interested in computing discriminants of Z-modules. In retrospect it looks ``unfinished''.

    \\ disc.gp -- Usually compute the discriminant of a finite commutative
    \\            Z-module represented by matrices T1,...,Tn, such that
    \\            the inner product is <Ti,Tj> = tr(Ti*Tj).
    \\ The word ``usually'' is used in the description because the program
    \\ can fail if the matrices aren't ``generic enough.''  See
    \\ the ``coords'' function.
    {nrows(M)=matsize(M)[1];}
    {ncols(M)=matsize(M)[2];}
    \\ coords: make a matrix whose columns are the col's columns of all of the Ti
    {coords(col,   i,j)=matrix(nrows(T[1]),ncols(T),i,j,  T[j][i,col]);}
    \\ Find an integral basis for the module.
    \\ The columns of the matrix returned give the
    \\ linear combination a1*T1+a2*T2+...+an*Tn, ai in Z,
    \\ which give a system of generators for the module.
    {intbasis(
      i,j,n,C,h,U,M)=
      n=nrows(T[1]); i=1; C=coords(i);
      while(matrank(C)<n,
        i++; if(i>ncols(T), print("Error, not enough generators."); return(0););
        C=coords(i););
      print("The ", i,"th columns coordinatize the module.");
      print("Computing mathnf.");
      U=mathnf(C,2)[2];
      print("Extracting integral basis.");
      \\ take exactly those columns of U, so that when multiplied
      \\ by C, the result is =/= 0.
      M=matrix(nrows(U),n,i,j,0);
      j=1;
      for(i=1,ncols(U),
        if(C*U[,i]!=0,
          if(j>n,print("ERROR: PARI's mathnf is incorrect.");return(0););
          M[,j]=U[,i]; j++)
      );
      if(j<n,print("ERROR: PARI's mathnf is producing invalid results."));
      M;
    }
    {Bmat(     i=0,j=0)=
      B=matrix(ncols(T),ncols(T),i,j,if(i>=j,trace(T[i]*T[j]),0));
      for(i=1,nrows(B),for(j=i+1,ncols(B),B[i,j]=B[j,i]));
      B;}
    \\ A = computed using intbasis; an integral basis of the Hecke algebra,
    \\     expressed on the T[i].
    \\ B = computed using Bmat; matrix of inner products (tr(T[i]*T[j])).
    {DiscMat(A,B)=mattranspose(A)*B*A;}