bridge/class-master/depend/pari/src/basemath/bb_hnf.c
/* right inverse, not GC-clean */
right inverse, not GC-clean
right inverse not GC - clean
static GEN
gen_inv(GEN A, void* data, const struct bb_hermite *R)
{
  pari_sp av;
  GEN ops, H, U, un=R->s(data,1);
  long m,n,j,o,n2;
  RgM_dimensions(A,&m,&n);
  av = avma;
  H = gen_howell_i(A, 0, 0, 1, 0, &ops, data, R);
  if (!H) pari_err_INV("gen_inv", ops);
  n2 = lg(H)-1;
  ops = gerepilecopy(av,ops); 
  U = gen_zeromat(n2, m, data, R);
  for (j=1; j<=m; j++)
    gcoeff(U,j+n2-m,j) = un;
  for (j=1; j<=m; j++)
  {
    av = avma;
    for (o=lg(ops)-1; o>0; o--)
      gen_leftapply(gel(U,j), gel(ops,o), data, R);
    gen_redcol(gel(U,j), n2, data, R);
    gerepileall(av, 1, &gel(U,j));
  }
  if (n2>n) U = rowslice(U, n2-n+1, n2);
  return U;
}
static GEN gen_inv ( GEN A , void * data , const struct bb_hermite * R ) { pari_sp av ; GEN ops , H , U , un = R -> s ( data , 1 ) ; long m , n , j , o , n2 ; RgM_dimensions ( A , & m , & n ) ; av = avma ; H = gen_howell_i ( A , 0 , 0 , 1 , 0 , & ops , data , R ) ; if ( ! H ) pari_err_INV ( " " , ops ) ; n2 = lg ( H ) - 1 ; ops = gerepilecopy ( av , ops ) ; U = gen_zeromat ( n2 , m , data , R ) ; for ( j = 1 ; j <= m ; j ++ ) gcoeff ( U , j + n2 - m , j ) = un ; for ( j = 1 ; j <= m ; j ++ ) { av = avma ; for ( o = lg ( ops ) - 1 ; o > 0 ; o -- ) gen_leftapply ( gel ( U , j ) , gel ( ops , o ) , data , R ) ; gen_redcol ( gel ( U , j ) , n2 , data , R ) ; gerepileall ( av , 1 , & gel ( U , j ) ) ; } if ( n2 > n ) U = rowslice ( U , n2 - n + 1 , n2 ) ; return U ; }
right inverse, not GC-clean
right inverse not GC - clean
/* get rid of H */