bridge/class-master/depend/pari/src/basemath/bibli1.c
/* If V depends linearly from the columns of the matrix, return 0.
 * Otherwise, update INVP and L and return 1. No GC. */
If V depends linearly from the columns of the matrix, return 0.
Otherwise, update INVP and L and return 1. No GC.
If V depends linearly from the columns of the matrix return 0 . Otherwise update INVP and L and return 1 . No GC .
static int
addcolumntomatrix(GEN V, GEN invp, GEN L)
{
  long i,j,k, n = lg(invp);
  GEN a = cgetg(n, t_COL), ak = NULL, mak;
  for (k = 1; k < n; k++)
    if (!L[k])
    {
      ak = RgMrow_zc_mul(invp, V, k);
      if (!gequal0(ak)) break;
    }
  if (k == n) return 0;
  L[k] = 1;
  mak = gneg_i(ak);
  for (i=k+1; i<n; i++)
    gel(a,i) = gdiv(RgMrow_zc_mul(invp, V, i), mak);
  for (j=1; j<=k; j++)
  {
    GEN c = gel(invp,j), ck = gel(c,k);
    if (gequal0(ck)) continue;
    gel(c,k) = gdiv(ck, ak);
    if (j==k)
      for (i=k+1; i<n; i++)
        gel(c,i) = gmul(gel(a,i), ck);
    else
      for (i=k+1; i<n; i++)
        gel(c,i) = gadd(gel(c,i), gmul(gel(a,i), ck));
  }
  return 1;
}
static int addcolumntomatrix ( GEN V , GEN invp , GEN L ) { long i , j , k , n = lg ( invp ) ; GEN a = cgetg ( n , t_COL ) , ak = NULL , mak ; for ( k = 1 ; k < n ; k ++ ) if ( ! L [ k ] ) { ak = RgMrow_zc_mul ( invp , V , k ) ; if ( ! gequal0 ( ak ) ) break ; } if ( k == n ) return 0 ; L [ k ] = 1 ; mak = gneg_i ( ak ) ; for ( i = k + 1 ; i < n ; i ++ ) gel ( a , i ) = gdiv ( RgMrow_zc_mul ( invp , V , i ) , mak ) ; for ( j = 1 ; j <= k ; j ++ ) { GEN c = gel ( invp , j ) , ck = gel ( c , k ) ; if ( gequal0 ( ck ) ) continue ; gel ( c , k ) = gdiv ( ck , ak ) ; if ( j == k ) for ( i = k + 1 ; i < n ; i ++ ) gel ( c , i ) = gmul ( gel ( a , i ) , ck ) ; else for ( i = k + 1 ; i < n ; i ++ ) gel ( c , i ) = gadd ( gel ( c , i ) , gmul ( gel ( a , i ) , ck ) ) ; } return 1 ; }
If V depends linearly from the columns of the matrix, return 0.
If V depends linearly from the columns of the matrix return 0 .