if (FALSE) customll_test()
myll <- customll("a1type dirichlet(const veca1 &u, const veca1 &beta) {
size_t d = u.size();
a1type y(0.); // initialize summation at 0
for(size_t i = 0; i < d; i++)
{ y += beta[i] * log(u[i]);
}
return y;
}")
evalll(myll, rep(1/3, 3), rep(-0.5, 3))
tapes <- buildsmdtape("sim", "identity", "sim",
myll, rep(1/3, 3), rep(NA, 3),
bdryw="minsq", acut = 0.01)
evaltape(tapes$lltape, rep(1/3, 3), rep(-0.5, 3))
Run the code above in your browser using DataLab