bridge/class-master/depend/pari/src/language/sumiter.c
/* strictly increasing order [generic] */
strictly increasing order [generic]
strictly increasing order [ generic ]
static GEN
_next_lt(forvec_t *d)
{
  long i = d->n;
  if (d->first) { d->first = 0; return (GEN)d->a; }
  for (;;) {
    d->a[i] = gaddgs(d->a[i], 1);
    if (gcmp(d->a[i], d->M[i]) <= 0)
    {
      while (i < d->n)
      {
        GEN c;
        i++;
        if (gcmp(d->a[i-1], d->a[i]) < 0) continue;
        c = addiu(gfloor(gsub(d->a[i-1], d->a[i])), 1); 
        d->a[i] = gadd(d->a[i], c);
      }
      return (GEN)d->a;
    }
    d->a[i] = d->m[i];
    if (--i <= 0) return NULL;
  }
}
static GEN _next_lt ( forvec_t * d ) { long i = d -> n ; if ( d -> first ) { d -> first = 0 ; return ( GEN ) d -> a ; } for ( ; ; ) { d -> a [ i ] = gaddgs ( d -> a [ i ] , 1 ) ; if ( gcmp ( d -> a [ i ] , d -> M [ i ] ) <= 0 ) { while ( i < d -> n ) { GEN c ; i ++ ; if ( gcmp ( d -> a [ i - 1 ] , d -> a [ i ] ) < 0 ) continue ; c = addiu ( gfloor ( gsub ( d -> a [ i - 1 ] , d -> a [ i ] ) ) , 1 ) ; d -> a [ i ] = gadd ( d -> a [ i ] , c ) ; } return ( GEN ) d -> a ; } d -> a [ i ] = d -> m [ i ] ; if ( -- i <= 0 ) return NULL ; } }
strictly increasing order [generic]
strictly increasing order [ generic ]
/* M[i] > M[i-1] >= a[i-1] >= a[i] */ /* > a[i-1] - a[i] */ /* a[i-1] < a[i] <= M[i-1] + 1 => a[i] < M[i]+1 => a[i] <= M[i] */