Sha256: 00ea79f88ab5e9f646691afb27d3f90d6abb0fc8f33bfe1c318747c9d47dd7cf

Contents?: true

Size: 1015 Bytes

Versions: 1

Compression:

Stored size: 1015 Bytes

Contents

/*
 *  Main authors:
 *     Guido Tack <tack@gecode.org>
 *
 *  Copyright:
 *     Guido Tack, 2004
 *
 *  Last modified:
 *     $Date: 2006-04-11 15:58:37 +0200 (Tue, 11 Apr 2006) $ by $Author: tack $
 *     $Revision: 3188 $
 *
 *  This file is part of Gecode, the generic constraint
 *  development environment:
 *     http://www.gecode.org
 *
 *  See the file "LICENSE" for information on usage and
 *  redistribution of this file, and for a
 *     DISCLAIMER OF ALL WARRANTIES.
 *
 */

#include "gecode/set.hh"
#include "gecode/set/distinct/binomial.icc"

namespace Gecode { namespace Set { namespace Distinct {

  void
  Binomial::init(unsigned int n) {
    int n2 = (n-2)/2;
    int nn = n2*(n2-1);
    nn += n2;
    if (n % 2 == 1)
      nn += n2;

    //    sar.ensure(n*(n-1)/2);
    sar.ensure(nn);
    unsigned int oldnmax = nmax;
    nmax = n;
    for (unsigned int i=oldnmax+1; i<=n; i++)
      for (unsigned int j=2; j<=(i/2); j++)
	y(i, j, y(i-1, j-1) + y(i-1, j));
  }

}}}

// STATISTICS: set-prop

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
gecoder-with-gecode-0.7.1 ext/gecode-1.3.1/gecode/set/distinct/binomial.cc