bridge/class-master/depend/pari/src/modules/algebras.c
/* ord is assumed to be in hnf wrt the integral basis of al. */
/* assumes that alg_get_invbasis(al) is integral. */
ord is assumed to be in hnf wrt the integral basis of al.
assumes that alg_get_invbasis(al) is integral.
ord is assumed to be in hnf wrt the integral basis of al . assumes that alg_get_invbasis ( al ) is integral .
static GEN
alg_change_overorder_shallow(GEN al, GEN ord)
{
  GEN al2, mt, iord, mtx, den, den2, div;
  long i, n;
  n = alg_get_absdim(al);
  iord = QM_inv(ord);
  al2 = shallowcopy(al);
  ord = Q_remove_denom(ord,&den);
  gel(al2,7) = Q_remove_denom(gel(al,7), &den2);
  if (den2) div = mulii(den,den2);
  else      div = den;
  gel(al2,7) = ZM_Z_div(ZM_mul(gel(al2,7), ord), div);
  gel(al2,8) = ZM_mul(iord, gel(al,8));
  mt = cgetg(n+1,t_VEC);
  gel(mt,1) = matid(n);
  div = sqri(den);
  for (i=2; i<=n; i++) {
    mtx = algbasismultable(al,gel(ord,i));
    gel(mt,i) = ZM_mul(iord, ZM_mul(mtx, ord));
    gel(mt,i) = ZM_Z_divexact(gel(mt,i), div);
  }
  gel(al2,9) = mt;
  gel(al2,11) = algtracebasis(al2);
  return al2;
}
static GEN alg_change_overorder_shallow ( GEN al , GEN ord ) { GEN al2 , mt , iord , mtx , den , den2 , div ; long i , n ; n = alg_get_absdim ( al ) ; iord = QM_inv ( ord ) ; al2 = shallowcopy ( al ) ; ord = Q_remove_denom ( ord , & den ) ; gel ( al2 , 7 ) = Q_remove_denom ( gel ( al , 7 ) , & den2 ) ; if ( den2 ) div = mulii ( den , den2 ) ; else div = den ; gel ( al2 , 7 ) = ZM_Z_div ( ZM_mul ( gel ( al2 , 7 ) , ord ) , div ) ; gel ( al2 , 8 ) = ZM_mul ( iord , gel ( al , 8 ) ) ; mt = cgetg ( n + 1 , t_VEC ) ; gel ( mt , 1 ) = matid ( n ) ; div = sqri ( den ) ; for ( i = 2 ; i <= n ; i ++ ) { mtx = algbasismultable ( al , gel ( ord , i ) ) ; gel ( mt , i ) = ZM_mul ( iord , ZM_mul ( mtx , ord ) ) ; gel ( mt , i ) = ZM_Z_divexact ( gel ( mt , i ) , div ) ; } gel ( al2 , 9 ) = mt ; gel ( al2 , 11 ) = algtracebasis ( al2 ) ; return al2 ; }
ord is assumed to be in hnf wrt the integral basis of al.
ord is assumed to be in hnf wrt the integral basis of al .