Skip to content

Instantly share code, notes, and snippets.

@SteveBronder
Created September 15, 2023 14:52
Show Gist options
  • Save SteveBronder/62911d8ada95c85008325300be834630 to your computer and use it in GitHub Desktop.
Save SteveBronder/62911d8ada95c85008325300be834630 to your computer and use it in GitHub Desktop.
#include <stan/math/mix.hpp>
#include <test/unit/math/test_ad.hpp>
TEST(mathMixScalFun, wiener5_lpdf) {
using stan::math::fvar;
using stan::math::var;
fvar<var> y = 0;
fvar<var> a = 0;
fvar<var> t0 = 0;
double w = 0;
double v = 0;
double sv = 0;
double sw = 0;
double st0 = 0;
stan::math::wiener5_lpdf(y, a, t0, w, v, sv, st0);
auto f1 = [](const auto& y, const auto& a, const auto& t0, const auto& w, const auto& v) {
return [&y, &a, &t0, &w, &v](const auto& sv, const auto& st0) {
return stan::math::wiener5_lpdf(y, a, t0, w, v, sv, st0);
};
};
double y = 0.1;
double a = 2.0;
double t0 = 0.2;
double w = 0.5;
double v = 2.0;
double sv = 0.2;
double st0 = 0.3;
stan::test::expect_ad(f1(y, a, t0, w, v), sv, st0);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment