bridge/class-master/depend/pari/src/basemath/bb_hnf.c
/* H: Howell form of A */
/* (m,n): dimensions of original matrix A */
/* return NULL if no solution */
Howell form of A
(m,n): dimensions of original matrix A
return NULL if no solution
Howell form of A ( m n ) : dimensions of original matrix A return NULL if no solution
static GEN
gen_solve_from_howell(GEN H, GEN ops, long m, long n, GEN Y, void* data, const struct bb_hermite *R)
{
  pari_sp av = avma;
  GEN Z, X;
  long n2, mH, nH, i;
  RgM_dimensions(H,&mH,&nH);
  n2 = maxss(n,m+1);
  Z = gen_reduce_mod_howell(H, Y, &X, data, R);
  if (!gen_is_zerocol(Z,m,data,R)) { avma=av; return NULL; }
  X = shallowconcat(zerocol(n2-nH),X);
  for (i=lg(ops)-1; i>0; i--) gen_leftapply(X, gel(ops,i), data, R);
  X = vecslice(X, n2-n+1, n2);
  gen_redcol(X, n, data, R);
  return gerepilecopy(av, X);
}
static GEN gen_solve_from_howell ( GEN H , GEN ops , long m , long n , GEN Y , void * data , const struct bb_hermite * R ) { pari_sp av = avma ; GEN Z , X ; long n2 , mH , nH , i ; RgM_dimensions ( H , & mH , & nH ) ; n2 = maxss ( n , m + 1 ) ; Z = gen_reduce_mod_howell ( H , Y , & X , data , R ) ; if ( ! gen_is_zerocol ( Z , m , data , R ) ) { avma = av ; return NULL ; } X = shallowconcat ( zerocol ( n2 - nH ) , X ) ; for ( i = lg ( ops ) - 1 ; i > 0 ; i -- ) gen_leftapply ( X , gel ( ops , i ) , data , R ) ; X = vecslice ( X , n2 - n + 1 , n2 ) ; gen_redcol ( X , n , data , R ) ; return gerepilecopy ( av , X ) ; }
H: Howell form of A
(m,n): dimensions of original matrix A
return NULL if no solution
H : Howell form of A ( m n ) : dimensions of original matrix A return NULL if no solution