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

Fix lookup in pow test on llvm19 #3109

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 15 additions & 18 deletions test/unit/math/mix/fun/pow_part1_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,20 +5,19 @@

template <typename T>
void expect_arith_instantiate() {
using stan::math::pow;
auto a1 = pow(T(1.0), 1);
auto b1 = pow(T(1.0), 1.0);
auto c1 = pow(1, T(1.0));
auto d1 = pow(1.0, T(1.0));
auto e1 = pow(T(1.0), T(1.0));

auto a2 = pow(std::complex<T>(1.0), 1);
auto b2 = pow(std::complex<T>(1.0), 1.0);
auto c2 = pow(1, std::complex<T>(1.0));
auto d2 = pow(1.0, std::complex<T>(1.0));
auto e2 = pow(std::complex<T>(1.0), std::complex<T>(1.0));
auto f2 = pow(std::complex<double>(1.0), std::complex<T>(1.0));
auto g2 = pow(std::complex<T>(1.0), std::complex<double>(1.0));
auto a1 = stan::math::pow(T(1.0), 1);
auto b1 = stan::math::pow(T(1.0), 1.0);
auto c1 = stan::math::pow(1, T(1.0));
auto d1 = stan::math::pow(1.0, T(1.0));
auto e1 = stan::math::pow(T(1.0), T(1.0));

auto a2 = stan::math::pow(std::complex<T>(1.0), 1);
auto b2 = stan::math::pow(std::complex<T>(1.0), 1.0);
auto c2 = stan::math::pow(1, std::complex<T>(1.0));
auto d2 = stan::math::pow(1.0, std::complex<T>(1.0));
auto e2 = stan::math::pow(std::complex<T>(1.0), std::complex<T>(1.0));
auto f2 = stan::math::pow(std::complex<double>(1.0), std::complex<T>(1.0));
auto g2 = stan::math::pow(std::complex<T>(1.0), std::complex<double>(1.0));
}

// this one's been tricky to instantiate, so test all instances
Expand All @@ -34,10 +33,8 @@ TEST(mathMixScalFun, powInstantiations) {
}

TEST(mathMixScalFun, pow) {
auto f = [](const auto& x1, const auto& x2) {
using stan::math::pow;
return pow(x1, x2);
};
auto f
= [](const auto& x1, const auto& x2) { return stan::math::pow(x1, x2); };

stan::test::expect_ad(f, -0.4, 0.5);
stan::test::expect_ad(f, 0.5, 0.5);
Expand Down
106 changes: 52 additions & 54 deletions test/unit/math/mix/fun/pow_part2_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,6 @@ TEST(mathMixFun, complexPow) {
}

TEST(mathMixFun, powIntAmbiguityTest) {
using stan::math::pow; // included to check ambiguities
using stan::math::var;
using std::complex;
int i = 2;
Expand All @@ -58,35 +57,35 @@ TEST(mathMixFun, powIntAmbiguityTest) {
complex<double> cd = 2.5;
complex<var> cv = 2.5;

auto a1 = pow(i, i);
auto a2 = pow(i, d);
auto a3 = pow(i, v);
auto a4 = pow(i, cd);
auto a5 = pow(i, cv);

auto b1 = pow(d, i);
auto b2 = pow(d, d);
auto b3 = pow(d, v);
auto b4 = pow(d, cd);
auto b5 = pow(d, cv);

auto e1 = pow(v, i);
auto e2 = pow(v, d);
auto e3 = pow(v, v);
auto e4 = pow(v, cd);
auto e5 = pow(v, cv);

auto c1 = pow(cd, i);
auto c2 = pow(cd, d);
auto c3 = pow(cd, v);
auto c4 = pow(cd, cd);
auto c5 = pow(cd, cv);

auto d1 = pow(cv, i);
auto d2 = pow(cv, d);
auto d3 = pow(cv, v);
auto d4 = pow(cv, cd);
auto d5 = pow(cv, cv);
auto a1 = stan::math::pow(i, i);
auto a2 = stan::math::pow(i, d);
auto a3 = stan::math::pow(i, v);
auto a4 = stan::math::pow(i, cd);
auto a5 = stan::math::pow(i, cv);

auto b1 = stan::math::pow(d, i);
auto b2 = stan::math::pow(d, d);
auto b3 = stan::math::pow(d, v);
auto b4 = stan::math::pow(d, cd);
auto b5 = stan::math::pow(d, cv);

auto e1 = stan::math::pow(v, i);
auto e2 = stan::math::pow(v, d);
auto e3 = stan::math::pow(v, v);
auto e4 = stan::math::pow(v, cd);
auto e5 = stan::math::pow(v, cv);

auto c1 = stan::math::pow(cd, i);
auto c2 = stan::math::pow(cd, d);
auto c3 = stan::math::pow(cd, v);
auto c4 = stan::math::pow(cd, cd);
auto c5 = stan::math::pow(cd, cv);

auto d1 = stan::math::pow(cv, i);
auto d2 = stan::math::pow(cv, d);
auto d3 = stan::math::pow(cv, v);
auto d4 = stan::math::pow(cv, cd);
auto d5 = stan::math::pow(cv, cv);

auto e = a1 + a2 + a3 + a4 + a5 + b1 + b2 + b3 + b4 + b5 + c1 + c2 + c3 + c4
+ c5 + d1 + d2 + d3 + d4 + d5 + e1 + e2 + e3 + e4 + e5;
Expand All @@ -96,37 +95,36 @@ TEST(mathMixFun, powIntAmbiguityTest) {

TEST(mathMixFun, powIntAmbiguityTestFvar) {
using stan::math::fvar;
using stan::math::pow; // included to check ambiguities
using std::complex;
int i = 2;
double d = 2.5;
fvar<double> v = 2.5;
complex<double> cd = 2.5;
complex<fvar<double>> cv = 2.5;

auto a1 = pow(i, i);
auto a2 = pow(i, d);
auto a3 = pow(i, v);
auto a4 = pow(i, cd);
auto a5 = pow(i, cv);

auto b1 = pow(d, i);
auto b2 = pow(d, d);
auto b3 = pow(d, v);
auto b4 = pow(d, cd);
auto b5 = pow(d, cv);

auto c1 = pow(cd, i);
auto c2 = pow(cd, d);
auto c3 = pow(cd, v);
auto c4 = pow(cd, cd);
auto c5 = pow(cd, cv);

auto d1 = pow(cv, i);
auto d2 = pow(cv, d);
auto d3 = pow(cv, v);
auto d4 = pow(cv, cd);
auto d5 = pow(cv, cv);
auto a1 = stan::math::pow(i, i);
auto a2 = stan::math::pow(i, d);
auto a3 = stan::math::pow(i, v);
auto a4 = stan::math::pow(i, cd);
auto a5 = stan::math::pow(i, cv);

auto b1 = stan::math::pow(d, i);
auto b2 = stan::math::pow(d, d);
auto b3 = stan::math::pow(d, v);
auto b4 = stan::math::pow(d, cd);
auto b5 = stan::math::pow(d, cv);

auto c1 = stan::math::pow(cd, i);
auto c2 = stan::math::pow(cd, d);
auto c3 = stan::math::pow(cd, v);
auto c4 = stan::math::pow(cd, cd);
auto c5 = stan::math::pow(cd, cv);

auto d1 = stan::math::pow(cv, i);
auto d2 = stan::math::pow(cv, d);
auto d3 = stan::math::pow(cv, v);
auto d4 = stan::math::pow(cv, cd);
auto d5 = stan::math::pow(cv, cv);

auto e = a1 + a2 + a3 + a4 + a5 + b1 + b2 + b3 + b4 + b5 + c1 + c2 + c3 + c4
+ c5 + d1 + d2 + d3 + d4 + d5;
Expand Down