Пример #1
0
void expect_eq_diffs(const stan::math::var& x1, 
                     const stan::math::var& x2,
                     const stan::math::var& y1, 
                     const stan::math::var& y2,
                     std::string message="") {
  expect_eq_diffs(x1.val(), x2.val(), 
                  y1.val(), y2.val(), message);
}
Пример #2
0
static inline void expect_val_deriv_eq(stan::math::var exp_var,
                                       stan::math::var base_exp_var,
                                       stan::math::var test_var,
                                       stan::math::var base_test_var) {
    using stan::math::set_zero_all_adjoints;

    expect_val_eq(exp_var.val(), test_var.val());
    AVEC exp_y = createAVEC(base_exp_var);
    VEC exp_g;
    set_zero_all_adjoints();
    exp_var.grad(exp_y, exp_g);
    AVEC test_y = createAVEC(base_test_var);
    VEC test_g;
    set_zero_all_adjoints();
    test_var.grad(test_y, test_g);
    expect_val_eq(exp_g[0], test_g[0]);
}
Пример #3
0
inline
bool isfinite(const stan::math::var& v) {
    return (boost::math::isfinite)(v.val());
}
Пример #4
0
 /**
  * Checks if the given number is infinite.
  *
  * Return <code>true</code> if the value of the
  * a is positive or negative infinity.
  *
  * @param a Variable to test.
  * @return <code>true</code> if value is infinite.
  */
 inline int isinf(const stan::math::var& a) {
   return isinf(a.val());
 }