Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[WIP] initial implementation of sqrt_spd and inv_sqrt_spd #1145

Closed
wants to merge 11 commits into from
Prev Previous commit
Next Next commit
bump size of test up
[CI skip]
  • Loading branch information
bgoodri committed Mar 8, 2019
commit ca80605705f5d02db8bf3942419a800bf9b91301
9 changes: 4 additions & 5 deletions test/unit/math/rev/mat/fun/sqrt_spd_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ TEST(AgradRevMatrix, check_varis_on_stack) {

struct make_zero {
template <typename T>
Eigen::Matrix<T, Eigen::Dynamic, 1> operator()(
const Eigen::Matrix<T, Eigen::Dynamic, 1>& a) const {
Eigen::Matrix<T, Eigen::Dynamic, 1>
operator()(const Eigen::Matrix<T, Eigen::Dynamic, 1> &a) const {
typedef Eigen::Matrix<T, Eigen::Dynamic, Eigen::Dynamic> matrix_t;
const int K = static_cast<int>(sqrt(a.rows()));
matrix_t A(K, K);
Expand All @@ -37,7 +37,7 @@ TEST(AgradRevMatrix, sqrt_spd) {
using stan::math::sqrt_spd;
using stan::math::vector_v;

int K = 2;
int K = 9;
matrix_d A(K, K);
A.setRandom();
A = A.transpose() * A;
Expand All @@ -53,7 +53,6 @@ TEST(AgradRevMatrix, sqrt_spd) {
EXPECT_NEAR(f_x(pos++), 0, TOL);
for (int i = 0; i < J.rows(); i++)
for (int j = 0; j < J.cols(); j++)
if (i != j)
EXPECT_NEAR(J(i, j), 0, TOL);
EXPECT_NEAR(J(i, j), 0, TOL);
EXPECT_TRUE(J.array().any());
}