msvc
This commit is contained in:
parent
37d704826a
commit
206f3cdbe0
@ -6,11 +6,7 @@
|
|||||||
* \author Tianqi Chen
|
* \author Tianqi Chen
|
||||||
*/
|
*/
|
||||||
#include <cmath>
|
#include <cmath>
|
||||||
#ifdef _MSC_VER
|
|
||||||
extern "C" {
|
|
||||||
#include <amp_math.h>
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
namespace xgboost {
|
namespace xgboost {
|
||||||
namespace utils {
|
namespace utils {
|
||||||
#ifdef XGBOOST_STRICT_CXX98_
|
#ifdef XGBOOST_STRICT_CXX98_
|
||||||
@ -21,14 +17,24 @@ double LogGamma(double v);
|
|||||||
template<typename T>
|
template<typename T>
|
||||||
inline bool CheckNAN(T v) {
|
inline bool CheckNAN(T v) {
|
||||||
#ifdef _MSC_VER
|
#ifdef _MSC_VER
|
||||||
return (_isnan(x) != 0);
|
return (_isnan(v) != 0);
|
||||||
#else
|
#else
|
||||||
return isnan(v);
|
return isnan(v);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
template<typename T>
|
template<typename T>
|
||||||
inline T LogGamma(T v) {
|
inline T LogGamma(T v) {
|
||||||
|
#ifdef _MSC_VER
|
||||||
|
#if _MSC_VER >= 1800
|
||||||
return lgamma(v);
|
return lgamma(v);
|
||||||
|
#else
|
||||||
|
#pragma message ("Warning: lgamma function was not available until VS2013, poisson regression will be disabled")
|
||||||
|
utils::Error("lgamma function was not available until VS2013");
|
||||||
|
return static_cast<T>(1.0);
|
||||||
|
#endif
|
||||||
|
#else
|
||||||
|
return lgamma(v);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
} // namespace utils
|
} // namespace utils
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user