| 135 | } |
| 136 | |
| 137 | void General_LzUnAd_observe_model::Likelihood_uncorrelated::Lz (const Uncorrelated_additive_observe_model& model) |
| 138 | /* Set the observation zz and Zv about which to evaluate the Likelihood function |
| 139 | * Postcond: Observation Information: z,Zv_inv,detZterm |
| 140 | */ |
| 141 | { |
| 142 | zset = true; |
| 143 | // Compute inverse of Zv and its reciprocal condition number |
| 144 | Float rcond = FM::UdUrcond(model.Zv); |
| 145 | model.rclimit.check_PD(rcond, "Z not PD in observe"); |
| 146 | |
| 147 | Bayes_base::Float detZ = 1; |
| 148 | |
| 149 | for (FM::Vec::const_iterator zi = model.Zv.begin(), zi_end = model.Zv.end(); zi != zi_end; ++zi) { |
| 150 | detZ *= *zi; |
| 151 | Zv_inv[zi.index()] = 1 / (*zi); // Protected from /0 by rcond check |
| 152 | } |
| 153 | using namespace std; |
| 154 | logdetZ = log(detZ); // Protected from ln(0) by rcond check |
| 155 | } |
| 156 | |
| 157 | Bayes_base::Float |
| 158 | General_LzCoAd_observe_model::Likelihood_correlated::L(const Correlated_additive_observe_model& model, const FM::Vec& z, const FM::Vec& zp) const |