bridge/class-master/depend/pari/src/basemath/mftrace.c
/* perm vector of strictly increasing indices, v a vector or arbitrary length;
 * the last r entries of perm fall beyond v.
 * Return v o perm[1..(-r)], discarding the last r entries of v */
perm vector of strictly increasing indices, v a vector or arbitrary length;
the last r entries of perm fall beyond v.
Return v o perm[1..(-r)], discarding the last r entries of v
perm vector of strictly increasing indices v a vector or arbitrary length ; the last r entries of perm fall beyond v . Return v o perm [ 1 .. ( - r ) ] discarding the last r entries of v
static GEN
vecpermute_partial(GEN v, GEN perm, long *r)
{
  long i, n = lg(v)-1, l = lg(perm);
  GEN w;
  if (perm[l-1] <= n) { *r = 0; return vecpermute(v,perm); }
  for (i = 1; i < l; i++)
    if (perm[i] > n) break;
  *r = l - i; l = i;
  w = cgetg(l, typ(v));
  for (i = 1; i < l; i++) gel(w,i) = gel(v,perm[i]);
  return w;
}
static GEN vecpermute_partial ( GEN v , GEN perm , long * r ) { long i , n = lg ( v ) - 1 , l = lg ( perm ) ; GEN w ; if ( perm [ l - 1 ] <= n ) { * r = 0 ; return vecpermute ( v , perm ) ; } for ( i = 1 ; i < l ; i ++ ) if ( perm [ i ] > n ) break ; * r = l - i ; l = i ; w = cgetg ( l , typ ( v ) ) ; for ( i = 1 ; i < l ; i ++ ) gel ( w , i ) = gel ( v , perm [ i ] ) ; return w ; }
perm vector of strictly increasing indices, v a vector or arbitrary length;
 the last r entries of perm fall beyond v.
 Return v o perm[1..(-r)], discarding the last r entries of v
perm vector of strictly increasing indices v a vector or arbitrary length ; the last r entries of perm fall beyond v . Return v o perm [ 1 .. ( - r ) ] discarding the last r entries of v