mirror of
https://gitlab.com/libeigen/eigen.git
synced 2025-08-11 19:29:02 +08:00
Some of our unit tests require mathematical constants and thus we rely on non-ansi code.
It seems as if the new standard removed pow(T,int). M_PIL is only defined when _GNU_SOURCE is defined.
This commit is contained in:
parent
4b1aca2288
commit
66534b782c
@ -223,7 +223,7 @@ if(CMAKE_COMPILER_IS_GNUCXX)
|
|||||||
set(COVERAGE_FLAGS "")
|
set(COVERAGE_FLAGS "")
|
||||||
endif(EIGEN_COVERAGE_TESTING)
|
endif(EIGEN_COVERAGE_TESTING)
|
||||||
if(EIGEN_TEST_RVALUE_REF_SUPPORT OR EIGEN_TEST_C++0x)
|
if(EIGEN_TEST_RVALUE_REF_SUPPORT OR EIGEN_TEST_C++0x)
|
||||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++0x")
|
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=gnu++0x")
|
||||||
endif(EIGEN_TEST_RVALUE_REF_SUPPORT OR EIGEN_TEST_C++0x)
|
endif(EIGEN_TEST_RVALUE_REF_SUPPORT OR EIGEN_TEST_C++0x)
|
||||||
if(CMAKE_SYSTEM_NAME MATCHES Linux)
|
if(CMAKE_SYSTEM_NAME MATCHES Linux)
|
||||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${COVERAGE_FLAGS} -g2")
|
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${COVERAGE_FLAGS} -g2")
|
||||||
|
@ -272,7 +272,7 @@ void MatrixExponential<MatrixType>::computeUV(float)
|
|||||||
} else {
|
} else {
|
||||||
const float maxnorm = 3.925724783138660f;
|
const float maxnorm = 3.925724783138660f;
|
||||||
m_squarings = std::max(0, (int)ceil(log2(m_l1norm / maxnorm)));
|
m_squarings = std::max(0, (int)ceil(log2(m_l1norm / maxnorm)));
|
||||||
MatrixType A = *m_M / std::pow(Scalar(2), m_squarings);
|
MatrixType A = *m_M / std::pow(Scalar(2), Scalar(m_squarings));
|
||||||
pade7(A);
|
pade7(A);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -291,7 +291,7 @@ void MatrixExponential<MatrixType>::computeUV(double)
|
|||||||
} else {
|
} else {
|
||||||
const double maxnorm = 5.371920351148152;
|
const double maxnorm = 5.371920351148152;
|
||||||
m_squarings = std::max(0, (int)ceil(log2(m_l1norm / maxnorm)));
|
m_squarings = std::max(0, (int)ceil(log2(m_l1norm / maxnorm)));
|
||||||
MatrixType A = *m_M / std::pow(Scalar(2), m_squarings);
|
MatrixType A = *m_M / std::pow(Scalar(2), Scalar(m_squarings));
|
||||||
pade13(A);
|
pade13(A);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -47,7 +47,11 @@ complex<long double> promote(long double x) { return complex<long double>( x);
|
|||||||
cerr <<"idx\ttruth\t\tvalue\t|dif|=\n";
|
cerr <<"idx\ttruth\t\tvalue\t|dif|=\n";
|
||||||
for (size_t k0=0;k0<size_t(fftbuf.size());++k0) {
|
for (size_t k0=0;k0<size_t(fftbuf.size());++k0) {
|
||||||
complex<long double> acc = 0;
|
complex<long double> acc = 0;
|
||||||
|
#ifdef _GNU_SOURCE
|
||||||
long double phinc = -2.*k0* M_PIl / timebuf.size();
|
long double phinc = -2.*k0* M_PIl / timebuf.size();
|
||||||
|
#else
|
||||||
|
long double phinc = -2.*k0* M_PI / timebuf.size();
|
||||||
|
#endif
|
||||||
for (size_t k1=0;k1<size_t(timebuf.size());++k1) {
|
for (size_t k1=0;k1<size_t(timebuf.size());++k1) {
|
||||||
acc += promote( timebuf[k1] ) * exp( complex<long double>(0,k1*phinc) );
|
acc += promote( timebuf[k1] ) * exp( complex<long double>(0,k1*phinc) );
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user