void drwnFactor::addVariables(const drwnClique& c) { for (drwnClique::const_iterator it = c.begin(); it != c.end(); ++it) { if (_varIndex.find(*it) == _varIndex.end()) { addVariable(*it); } } }
// Add multiple variables void drwnFrankCopula::setVariables(const drwnClique& c) { // Must have size 2, 3, or 4 (for now) DRWN_ASSERT_MSG(c.size() >= 2 && c.size() <= 4, "Archimedian copula must have size between 2 and 4") // Call set variables from parent drwnCdf::setVariables(c); // Calculate number of subsets of variables _numSubsets = 1 << size(); _partialDerivs = new range_type[_numSubsets << 1]; }
// find a clique containing the subclique int findSuperset(const vector<drwnClique>& cliques, const drwnClique& subclique) { for (int i = 0; i < (int)cliques.size(); i++) { drwnClique s; set_intersection(cliques[i].begin(), cliques[i].end(), subclique.begin(), subclique.end(), insert_iterator<drwnClique>(s, s.begin())); if (s.size() == subclique.size()) { return i; } } return -1; }