bridge/class-master/depend/pari/src/modules/algebras.c
/* assumes same center and same variable */
/* currently only works for coprime degrees */
assumes same center and same variable
currently only works for coprime degrees
assumes same center and same variable currently only works for coprime degrees
GEN
algtensor(GEN al1, GEN al2, long maxord) {
  pari_sp av = avma;
  long v, k, d1, d2;
  GEN nf, P1, P2, aut1, aut2, b1, b2, C, rnf, aut, b, x1, x2, al;
  checkalg(al1);
  checkalg(al2);
  if (alg_type(al1) != al_CYCLIC  || alg_type(al2) != al_CYCLIC)
    pari_err_IMPL("tensor of non-cyclic algebras"); 
  nf=alg_get_center(al1);
  if (!gequal(alg_get_center(al2),nf))
    pari_err_OP("tensor product [not the same center]", al1, al2);
  P1=alg_get_splitpol(al1); aut1=alg_get_aut(al1); b1=alg_get_b(al1);
  P2=alg_get_splitpol(al2); aut2=alg_get_aut(al2); b2=alg_get_b(al2);
  v=varn(P1);
  d1=alg_get_degree(al1);
  d2=alg_get_degree(al2);
  if (ugcd(d1,d2) != 1)
    pari_err_IMPL("tensor of cylic algebras of non-coprime degrees"); 
  if (d1==1) return gcopy(al2);
  if (d2==1) return gcopy(al1);
  C = nfcompositum(nf, P1, P2, 3);
  rnf = rnfinit(nf,gel(C,1));
  x1 = gel(C,2);
  x2 = gel(C,3);
  k = itos(gel(C,4));
  aut = gadd(gsubst(aut2,v,x2),gmulsg(k,gsubst(aut1,v,x1)));
  b = nfmul(nf,nfpow_u(nf,b1,d2),nfpow_u(nf,b2,d1));
  al = alg_cyclic(rnf,aut,b,maxord);
  return gerepilecopy(av,al);
}
GEN algtensor ( GEN al1 , GEN al2 , long maxord ) { pari_sp av = avma ; long v , k , d1 , d2 ; GEN nf , P1 , P2 , aut1 , aut2 , b1 , b2 , C , rnf , aut , b , x1 , x2 , al ; checkalg ( al1 ) ; checkalg ( al2 ) ; if ( alg_type ( al1 ) != al_CYCLIC || alg_type ( al2 ) != al_CYCLIC ) pari_err_IMPL ( " " ) ; nf = alg_get_center ( al1 ) ; if ( ! gequal ( alg_get_center ( al2 ) , nf ) ) pari_err_OP ( " " , al1 , al2 ) ; P1 = alg_get_splitpol ( al1 ) ; aut1 = alg_get_aut ( al1 ) ; b1 = alg_get_b ( al1 ) ; P2 = alg_get_splitpol ( al2 ) ; aut2 = alg_get_aut ( al2 ) ; b2 = alg_get_b ( al2 ) ; v = varn ( P1 ) ; d1 = alg_get_degree ( al1 ) ; d2 = alg_get_degree ( al2 ) ; if ( ugcd ( d1 , d2 ) != 1 ) pari_err_IMPL ( " " ) ; if ( d1 == 1 ) return gcopy ( al2 ) ; if ( d2 == 1 ) return gcopy ( al1 ) ; C = nfcompositum ( nf , P1 , P2 , 3 ) ; rnf = rnfinit ( nf , gel ( C , 1 ) ) ; x1 = gel ( C , 2 ) ; x2 = gel ( C , 3 ) ; k = itos ( gel ( C , 4 ) ) ; aut = gadd ( gsubst ( aut2 , v , x2 ) , gmulsg ( k , gsubst ( aut1 , v , x1 ) ) ) ; b = nfmul ( nf , nfpow_u ( nf , b1 , d2 ) , nfpow_u ( nf , b2 , d1 ) ) ; al = alg_cyclic ( rnf , aut , b , maxord ) ; return gerepilecopy ( av , al ) ; }
assumes same center and same variable
currently only works for coprime degrees
assumes same center and same variable currently only works for coprime degrees
/* TODO: do it. */ /* TODO */