bridge/class-master/depend/pari/src/modules/algebras.c
/* on the natural basis */
/* assumes x in algebraic form */
on the natural basis
assumes x in algebraic form
on the natural basis assumes x in algebraic form
static GEN
algZmultable(GEN al, GEN x) {
  pari_sp av = avma;
  GEN res = NULL, x0;
  long tx = alg_model(al,x);
  switch(tx) {
    case al_TRIVIAL:
      x0 = gel(x,1);
      if (typ(x0)==t_POLMOD) x0 = gel(x0,2);
      if (typ(x0)==t_POL) x0 = constant_coeff(x0);
      res = mkmatcopy(mkcol(x0));
      break;
    case al_ALGEBRAIC: res = algmtK2Z(al,algalgmultable(al,x)); break;
  }
  return gerepileupto(av,res);
}
static GEN algZmultable ( GEN al , GEN x ) { pari_sp av = avma ; GEN res = NULL , x0 ; long tx = alg_model ( al , x ) ; switch ( tx ) { case al_TRIVIAL : x0 = gel ( x , 1 ) ; if ( typ ( x0 ) == t_POLMOD ) x0 = gel ( x0 , 2 ) ; if ( typ ( x0 ) == t_POL ) x0 = constant_coeff ( x0 ) ; res = mkmatcopy ( mkcol ( x0 ) ) ; break ; case al_ALGEBRAIC : res = algmtK2Z ( al , algalgmultable ( al , x ) ) ; break ; } return gerepileupto ( av , res ) ; }
on the natural basis
assumes x in algebraic form
on the natural basis assumes x in algebraic form