//@{
virtual CBP* clone() const { return new CBP(*this); }
// virtual CBP* create() const { return new CBP(); }
- virtual CBP* create() const { throw "Unimplemented"; }
+ virtual CBP* create() const { DAI_THROW(NOT_IMPLEMENTED); }
virtual std::string identify() const { return string(Name) + printProperties(); }
virtual Factor belief (const Var &n) const { return _beliefs1[findVar(n)]; }
virtual Factor belief (const VarSet &) const { assert(0); }
// XXX why is it off by a factor of 2?
adj_est.push_back((cf_prb-cf0)/h);
}
- Prob p_adj_est(adj_est);
+ Prob p_adj_est(adj_est.begin(), adj_est.end());
// compare this numerical estimate to the BBP estimate; sum the distances
cerr << "i: " << i
<< ", p_adj_est: " << p_adj_est
adj_m_est.push_back((cf_prb-cf0)/h);
}
- Prob p_adj_n_est(adj_n_est);
+ Prob p_adj_n_est(adj_n_est.begin(), adj_n_est.end());
// compare this numerical estimate to the BBP estimate; sum the distances
cerr << "i: " << i << ", I: " << I
<< ", adj_n_est: " << p_adj_n_est
<< ", bbp.adj_n(i,I): " << bbp.adj_n(i,I) << endl;
d += dist(p_adj_n_est, bbp.adj_n(i,I), Prob::DISTL1);
- Prob p_adj_m_est(adj_m_est);
+ Prob p_adj_m_est(adj_m_est.begin(), adj_m_est.end());
// compare this numerical estimate to the BBP estimate; sum the distances
cerr << "i: " << i << ", I: " << I
<< ", adj_m_est: " << p_adj_m_est
// add it to list of adjoints
adj_b_1_est.push_back((cf_prb-cf0)/h);
}
- Prob p_adj_b_1_est(adj_b_1_est);
+ Prob p_adj_b_1_est(adj_b_1_est.begin(), adj_b_1_est.end());
// compare this numerical estimate to the BBP estimate; sum the distances
cerr << "i: " << i
<< ", adj_b_1_est: " << p_adj_b_1_est
die=true;
}
}
- if(die) throw "BP_dual: Couldn't set properties";
+ if(die)
+ DAI_THROW(NOT_ALL_PROPERTIES_SPECIFIED);
props.tol = opts.getStringAs<double>("tol");
props.maxiter = opts.getStringAs<size_t>("maxiter");
foreach(size_t i, is) { assert( i <= n.states() ); mask_n[i] = 1.0; }
for( size_t I = 0; I < g.nrFactors(); I++ )
- if( g.factor(I).vars() && n )
+ if( g.factor(I).vars().contains( n ) )
g.factor(I) *= mask_n;
}