예제 #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
파일: std_isinf.hpp 프로젝트: alyst/math
 /**
  * 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());
 }