7 #ifndef JADE_LIKELIHOOD_HPP__
8 #define JADE_LIKELIHOOD_HPP__
10 #include "jade.matrix.hpp"
21 template <
typename TValue>
40 , _mux (_init_mux(mu))
41 , _rkltmux (_init_rkltmux(rf.get_height(), _mux))
42 , _mul (rf.get_height(), rf.get_width())
71 auto rkltmux_ptr = _rkltmux.
get_data();
73 const auto mux_end = _mux.
get_data() + J;
76 while (mux_ptr != mux_end)
81 const auto rkltmux = *rkltmux_ptr++;
82 const auto mux = *mux_ptr++;
92 const auto rf_anchor = rf_ptr;
93 const auto mul_anchor = mul_ptr;
94 const auto mul_end = mul_ptr + (RK * J);
95 while (mul_ptr != mul_end)
97 zip += *rf_ptr * *mul_ptr;
106 sum += rkltmux + (zip / mux);
111 rf_ptr = rf_anchor + 1;
112 mul_ptr = mul_anchor + 1;
125 assert(mu.is_column_vector());
130 const auto J = mu.get_height();
136 const auto mu_end = mu.get_data() + J;
137 auto mu_ptr = mu.get_data();
138 auto mux_ptr = mux.get_data();
139 while (mu_ptr != mu_end)
144 const auto mu_j = *mu_ptr++;
156 static const auto tau =
value_type(2.0 * std::acos(-1.0));
158 assert(mux.is_column_vector());
163 const auto J = mux.get_height();
169 const auto mux_end = mux.get_data() + J;
170 auto mux_ptr = mux.get_data();
171 auto rkltmux_ptr = rkltmux.get_data();
176 while (mux_ptr != mux_end)
177 *rkltmux_ptr++ =
value_type(RK) * std::log(tau * *mux_ptr++);
189 #endif // JADE_LIKELIHOOD_HPP__