Skip to content

Commit a929e7e

Browse files
committed
Fix opencl
1 parent 7789c57 commit a929e7e

2 files changed

Lines changed: 9 additions & 1 deletion

File tree

stan/math/prim/prob/std_normal_lpdf.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ return_type_t<T_y> std_normal_lpdf(const T_y& y) {
4343
return 0.0;
4444
}
4545

46-
T_partials_return y_val = as_value_column_vector_or_scalar(y_ref);
46+
const auto& y_val = as_value_column_vector_or_scalar(y_ref);
4747
T_partials_return logp = -dot_self(y_val) / 2.0;
4848
auto ops_partials = make_partials_propagator(y_ref);
4949

test/unit/math/mix/prob/std_normal_test.cpp

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,4 +7,12 @@ TEST_F(AgradRev, mathMixScalFun_std_normal) {
77
stan::test::expect_ad(f, -0.3);
88
stan::test::expect_ad(f, 0.0);
99
stan::test::expect_ad(f, 1.7);
10+
11+
Eigen::VectorXd x(3);
12+
x << -0.3, 0.0, 1.7;
13+
std::vector<double> x2{0.0, 1.7};
14+
15+
stan::test::expect_ad(f, x);
16+
stan::test::expect_ad(f, x.transpose().eval());
17+
stan::test::expect_ad(f, x2);
1018
}

0 commit comments

Comments
 (0)