Skip to content

Commit c8409ec

Browse files
committed
Split eigendecompose test for mem issues
1 parent 598dba7 commit c8409ec

2 files changed

Lines changed: 22 additions & 20 deletions

File tree

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
#include <test/unit/math/test_ad.hpp>
2+
#include <stdexcept>
3+
4+
TEST(mathMixFun, eigendecompose) {
5+
auto f = [](const auto& x) {
6+
using stan::math::eigendecompose;
7+
return std::get<0>(eigendecompose(x));
8+
};
9+
auto g = [](const auto& x) {
10+
using stan::math::eigendecompose;
11+
return std::get<1>(eigendecompose(x));
12+
};
13+
for (const auto& x : stan::test::square_test_matrices(0, 2)) {
14+
stan::test::expect_ad(f, x);
15+
stan::test::expect_ad(g, x);
16+
}
17+
18+
Eigen::MatrixXd a32(3, 2);
19+
a32 << 3, -5, 7, -7.2, 9.1, -6.3;
20+
EXPECT_THROW(f(a32), std::invalid_argument);
21+
EXPECT_THROW(g(a32), std::invalid_argument);
22+
}

test/unit/math/mix/fun/eigendecompose_test.cpp renamed to test/unit/math/mix/fun/eigendecompose_part2_test.cpp

Lines changed: 0 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,6 @@
11
#include <test/unit/math/test_ad.hpp>
22
#include <stdexcept>
33

4-
TEST(mathMixFun, eigendecompose) {
5-
auto f = [](const auto& x) {
6-
using stan::math::eigendecompose;
7-
return std::get<0>(eigendecompose(x));
8-
};
9-
auto g = [](const auto& x) {
10-
using stan::math::eigendecompose;
11-
return std::get<1>(eigendecompose(x));
12-
};
13-
for (const auto& x : stan::test::square_test_matrices(0, 2)) {
14-
stan::test::expect_ad(f, x);
15-
stan::test::expect_ad(g, x);
16-
}
17-
18-
Eigen::MatrixXd a32(3, 2);
19-
a32 << 3, -5, 7, -7.2, 9.1, -6.3;
20-
EXPECT_THROW(f(a32), std::invalid_argument);
21-
EXPECT_THROW(g(a32), std::invalid_argument);
22-
}
23-
244
TEST(mathMixFun, eigendecomposeComplex) {
255
auto f = [](const auto& x) {
266
using stan::math::eigendecompose;

0 commit comments

Comments
 (0)