| Mat_meat.hpp | | Mat_meat.hpp | |
| | | | |
| skipping to change at line 4835 | | skipping to change at line 4835 | |
| //! returns true if all of the elements are finite | | //! returns true if all of the elements are finite | |
| template<typename eT> | | template<typename eT> | |
| inline | | inline | |
| arma_warn_unused | | arma_warn_unused | |
| bool | | bool | |
| Mat<eT>::is_finite() const | | Mat<eT>::is_finite() const | |
| { | | { | |
| return arrayops::is_finite( memptr(), n_elem ); | | return arrayops::is_finite( memptr(), n_elem ); | |
| } | | } | |
| | | | |
|
| | | template<typename eT> | |
| | | inline | |
| | | arma_warn_unused | |
| | | bool | |
| | | Mat<eT>::is_sorted(const char* direction) const | |
| | | { | |
| | | arma_extra_debug_sigprint(); | |
| | | | |
| | | return (*this).is_sorted(direction, (((vec_state == 2) || (n_rows == 1)) | |
| | | ? uword(1) : uword(0))); | |
| | | } | |
| | | | |
| | | template<typename eT> | |
| | | inline | |
| | | arma_warn_unused | |
| | | bool | |
| | | Mat<eT>::is_sorted(const char* direction, const uword dim) const | |
| | | { | |
| | | arma_extra_debug_sigprint(); | |
| | | | |
| | | const char sig = (direction != NULL) ? direction[0] : char(0); | |
| | | | |
| | | arma_debug_check( ((sig != 'a') && (sig != 'd')), "Mat::is_sorted(): unkn | |
| | | own sort direction" ); | |
| | | | |
| | | arma_debug_check( (dim > 1), "Mat::is_sorted(): dim must be 0 or 1" ); | |
| | | | |
| | | if(n_elem <= 1) { return true; } | |
| | | | |
| | | const uword local_n_cols = n_cols; | |
| | | const uword local_n_rows = n_rows; | |
| | | | |
| | | if(sig == 'a') | |
| | | { | |
| | | // deliberately using the opposite direction comparator, | |
| | | // as we need to handle the case of two elements being equal | |
| | | | |
| | | arma_descend_sort_helper<eT> comparator; | |
| | | | |
| | | if(dim == 0) | |
| | | { | |
| | | if(local_n_rows <= 1u) { return true; } | |
| | | | |
| | | const uword local_n_rows_m1 = local_n_rows - 1; | |
| | | | |
| | | for(uword col=0; col < local_n_cols; ++col) | |
| | | { | |
| | | const eT* coldata = colptr(col); | |
| | | | |
| | | for(uword row=0; row < local_n_rows_m1; ++row) | |
| | | { | |
| | | const eT val1 = (*coldata); coldata++; | |
| | | const eT val2 = (*coldata); | |
| | | | |
| | | if(comparator(val1,val2)) { return false; } | |
| | | } | |
| | | } | |
| | | } | |
| | | else // dim == 1 | |
| | | { | |
| | | if(local_n_cols <= 1u) { return true; } | |
| | | | |
| | | const uword local_n_cols_m1 = local_n_cols - 1; | |
| | | | |
| | | if(local_n_rows == 1) | |
| | | { | |
| | | const eT* rowdata = memptr(); | |
| | | | |
| | | for(uword col=0; col < local_n_cols_m1; ++col) | |
| | | { | |
| | | const eT val1 = (*rowdata); rowdata++; | |
| | | const eT val2 = (*rowdata); | |
| | | | |
| | | if(comparator(val1,val2)) { return false; } | |
| | | } | |
| | | } | |
| | | else | |
| | | { | |
| | | for(uword row=0; row < local_n_rows; ++row) | |
| | | for(uword col=0; col < local_n_cols_m1; ++col) | |
| | | { | |
| | | const eT val1 = at(row,col ); | |
| | | const eT val2 = at(row,col+1); | |
| | | | |
| | | if(comparator(val1,val2)) { return false; } | |
| | | } | |
| | | } | |
| | | } | |
| | | } | |
| | | else | |
| | | if(sig == 'd') | |
| | | { | |
| | | // deliberately using the opposite direction comparator, | |
| | | // as we need to handle the case of two elements being equal | |
| | | | |
| | | arma_ascend_sort_helper<eT> comparator; | |
| | | | |
| | | if(dim == 0) | |
| | | { | |
| | | if(local_n_rows <= 1u) { return true; } | |
| | | | |
| | | const uword local_n_rows_m1 = local_n_rows - 1; | |
| | | | |
| | | for(uword col=0; col < local_n_cols; ++col) | |
| | | { | |
| | | const eT* coldata = colptr(col); | |
| | | | |
| | | for(uword row=0; row < local_n_rows_m1; ++row) | |
| | | { | |
| | | const eT val1 = (*coldata); coldata++; | |
| | | const eT val2 = (*coldata); | |
| | | | |
| | | if(comparator(val1,val2)) { return false; } | |
| | | } | |
| | | } | |
| | | } | |
| | | else // dim == 1 | |
| | | { | |
| | | if(local_n_cols <= 1u) { return true; } | |
| | | | |
| | | const uword local_n_cols_m1 = local_n_cols - 1; | |
| | | | |
| | | if(local_n_rows == 1) | |
| | | { | |
| | | const eT* rowdata = memptr(); | |
| | | | |
| | | for(uword col=0; col < local_n_cols_m1; ++col) | |
| | | { | |
| | | const eT val1 = (*rowdata); rowdata++; | |
| | | const eT val2 = (*rowdata); | |
| | | | |
| | | if(comparator(val1,val2)) { return false; } | |
| | | } | |
| | | } | |
| | | else | |
| | | { | |
| | | for(uword row=0; row < local_n_rows; ++row) | |
| | | for(uword col=0; col < local_n_cols_m1; ++col) | |
| | | { | |
| | | const eT val1 = at(row,col ); | |
| | | const eT val2 = at(row,col+1); | |
| | | | |
| | | if(comparator(val1,val2)) { return false; } | |
| | | } | |
| | | } | |
| | | } | |
| | | } | |
| | | | |
| | | return true; | |
| | | } | |
| | | | |
| //! returns true if the given index is currently in range | | //! returns true if the given index is currently in range | |
| template<typename eT> | | template<typename eT> | |
| arma_inline | | arma_inline | |
| arma_warn_unused | | arma_warn_unused | |
| bool | | bool | |
| Mat<eT>::in_range(const uword ii) const | | Mat<eT>::in_range(const uword ii) const | |
| { | | { | |
| return (ii < n_elem); | | return (ii < n_elem); | |
| } | | } | |
| | | | |
| | | | |
End of changes. 1 change blocks. |
| 0 lines changed or deleted | | 151 lines changed or added | |
|
| compiler_setup.hpp | | compiler_setup.hpp | |
| | | | |
| skipping to change at line 85 | | skipping to change at line 85 | |
| #undef ARMA_64BIT_WORD | | #undef ARMA_64BIT_WORD | |
| #define ARMA_64BIT_WORD | | #define ARMA_64BIT_WORD | |
| #endif | | #endif | |
| #endif | | #endif | |
| | | | |
| #if defined(ARMA_64BIT_WORD) | | #if defined(ARMA_64BIT_WORD) | |
| #undef ARMA_USE_U64S64 | | #undef ARMA_USE_U64S64 | |
| #define ARMA_USE_U64S64 | | #define ARMA_USE_U64S64 | |
| #endif | | #endif | |
| | | | |
|
| | | // most compilers can't vectorise slightly elaborate loops; | |
| | | // for example clang: http://llvm.org/bugs/show_bug.cgi?id=16358 | |
| | | #undef ARMA_SIMPLE_LOOPS | |
| | | #define ARMA_SIMPLE_LOOPS | |
| | | | |
| | | #undef ARMA_GOOD_COMPILER | |
| | | | |
| | | #undef ARMA_HAVE_TR1 | |
| #undef ARMA_HAVE_GETTIMEOFDAY | | #undef ARMA_HAVE_GETTIMEOFDAY | |
| #undef ARMA_HAVE_SNPRINTF | | #undef ARMA_HAVE_SNPRINTF | |
| #undef ARMA_HAVE_ISFINITE | | #undef ARMA_HAVE_ISFINITE | |
| #undef ARMA_HAVE_LOG1P | | #undef ARMA_HAVE_LOG1P | |
| #undef ARMA_HAVE_ISINF | | #undef ARMA_HAVE_ISINF | |
| #undef ARMA_HAVE_ISNAN | | #undef ARMA_HAVE_ISNAN | |
| | | | |
| #if (defined(_POSIX_C_SOURCE) && (_POSIX_C_SOURCE >= 200112L)) | | #if (defined(_POSIX_C_SOURCE) && (_POSIX_C_SOURCE >= 200112L)) | |
| #define ARMA_HAVE_GETTIMEOFDAY | | #define ARMA_HAVE_GETTIMEOFDAY | |
|
| | | | |
| #if defined(__GNUG__) | | | |
| #define ARMA_HAVE_SNPRINTF | | | |
| #define ARMA_HAVE_ISFINITE | | | |
| #define ARMA_HAVE_LOG1P | | | |
| #define ARMA_HAVE_ISINF | | | |
| #define ARMA_HAVE_ISNAN | | | |
| #endif | | | |
| #endif | | #endif | |
| | | | |
| // posix_memalign() is part of IEEE standard 1003.1 | | // posix_memalign() is part of IEEE standard 1003.1 | |
| // http://pubs.opengroup.org/onlinepubs/009696899/functions/posix_memalign.
html | | // http://pubs.opengroup.org/onlinepubs/009696899/functions/posix_memalign.
html | |
| // http://pubs.opengroup.org/onlinepubs/9699919799/basedefs/unistd.h.html | | // http://pubs.opengroup.org/onlinepubs/9699919799/basedefs/unistd.h.html | |
| // http://sourceforge.net/p/predef/wiki/Standards/ | | // http://sourceforge.net/p/predef/wiki/Standards/ | |
| #if ( defined(_POSIX_ADVISORY_INFO) && (_POSIX_ADVISORY_INFO >= 200112L) ) | | #if ( defined(_POSIX_ADVISORY_INFO) && (_POSIX_ADVISORY_INFO >= 200112L) ) | |
| #undef ARMA_HAVE_POSIX_MEMALIGN | | #undef ARMA_HAVE_POSIX_MEMALIGN | |
| #define ARMA_HAVE_POSIX_MEMALIGN | | #define ARMA_HAVE_POSIX_MEMALIGN | |
| #endif | | #endif | |
| | | | |
| skipping to change at line 137 | | skipping to change at line 137 | |
| #elif defined (_MSC_VER) | | #elif defined (_MSC_VER) | |
| #define ARMA_FNSIG __FUNCSIG__ | | #define ARMA_FNSIG __FUNCSIG__ | |
| #elif defined(__INTEL_COMPILER) | | #elif defined(__INTEL_COMPILER) | |
| #define ARMA_FNSIG __FUNCTION__ | | #define ARMA_FNSIG __FUNCTION__ | |
| #elif defined(ARMA_USE_CXX11) | | #elif defined(ARMA_USE_CXX11) | |
| #define ARMA_FNSIG __func__ | | #define ARMA_FNSIG __func__ | |
| #else | | #else | |
| #define ARMA_FNSIG "(unknown)" | | #define ARMA_FNSIG "(unknown)" | |
| #endif | | #endif | |
| | | | |
|
| #if defined(__GNUG__) && !defined(__clang__) && !defined(__INTEL_COMPILER) | | #if (defined(__GNUG__) || defined(__GNUC__)) && (defined(__clang__) || defi | |
| && !defined(__NVCC__) && !defined(__PGI) && !defined(__PATHSCALE__) | | ned(__INTEL_COMPILER) || defined(__NVCC__) || defined(__CUDACC__) || define | |
| | | d(__PGI) || defined(__PATHSCALE__)) | |
| | | #undef ARMA_FAKE_GCC | |
| | | #define ARMA_FAKE_GCC | |
| | | #endif | |
| | | | |
| | | #if defined(__GNUG__) && !defined(ARMA_FAKE_GCC) | |
| | | | |
| #undef ARMA_GCC_VERSION | | #undef ARMA_GCC_VERSION | |
| #define ARMA_GCC_VERSION (__GNUC__ * 10000 + __GNUC_MINOR__ * 100 + __GNU
C_PATCHLEVEL__) | | #define ARMA_GCC_VERSION (__GNUC__ * 10000 + __GNUC_MINOR__ * 100 + __GNU
C_PATCHLEVEL__) | |
| | | | |
| #if (ARMA_GCC_VERSION < 40200) | | #if (ARMA_GCC_VERSION < 40200) | |
| #error "*** Need a newer compiler ***" | | #error "*** Need a newer compiler ***" | |
| #endif | | #endif | |
| | | | |
| #if ( (ARMA_GCC_VERSION >= 40700) && (ARMA_GCC_VERSION <= 40701) ) | | #if ( (ARMA_GCC_VERSION >= 40700) && (ARMA_GCC_VERSION <= 40701) ) | |
| #error "gcc versions 4.7.0 and 4.7.1 are unsupported; use 4.7.2 or late
r" | | #error "gcc versions 4.7.0 and 4.7.1 are unsupported; use 4.7.2 or late
r" | |
| // due to http://gcc.gnu.org/bugzilla/show_bug.cgi?id=53549 | | // due to http://gcc.gnu.org/bugzilla/show_bug.cgi?id=53549 | |
| #endif | | #endif | |
| | | | |
|
| #undef ARMA_GOOD_COMPILER | | | |
| #define ARMA_GOOD_COMPILER | | #define ARMA_GOOD_COMPILER | |
| | | | |
| #undef arma_pure | | #undef arma_pure | |
| #undef arma_const | | #undef arma_const | |
| #undef arma_aligned | | #undef arma_aligned | |
| #undef arma_align_mem | | #undef arma_align_mem | |
| #undef arma_warn_unused | | #undef arma_warn_unused | |
| #undef arma_deprecated | | #undef arma_deprecated | |
| #undef arma_malloc | | #undef arma_malloc | |
| #undef arma_inline | | #undef arma_inline | |
| | | | |
| skipping to change at line 187 | | skipping to change at line 191 | |
| #if defined(ARMA_USE_CXX11) | | #if defined(ARMA_USE_CXX11) | |
| #if (ARMA_GCC_VERSION < 40800) | | #if (ARMA_GCC_VERSION < 40800) | |
| #pragma message ("WARNING: compiler is in C++11 mode, but it has inco
mplete support for C++11 features;") | | #pragma message ("WARNING: compiler is in C++11 mode, but it has inco
mplete support for C++11 features;") | |
| #pragma message ("WARNING: if something breaks, you get to keep all t
he pieces") | | #pragma message ("WARNING: if something breaks, you get to keep all t
he pieces") | |
| #pragma message ("WARNING: To forcefully prevent Armadillo from using
C++11 features,") | | #pragma message ("WARNING: To forcefully prevent Armadillo from using
C++11 features,") | |
| #pragma message ("WARNING: #define ARMA_DONT_USE_CXX11 before #includ
e <armadillo>") | | #pragma message ("WARNING: #define ARMA_DONT_USE_CXX11 before #includ
e <armadillo>") | |
| #define ARMA_DONT_USE_CXX11_CHRONO | | #define ARMA_DONT_USE_CXX11_CHRONO | |
| #endif | | #endif | |
| #endif | | #endif | |
| | | | |
|
| #undef ARMA_HAVE_TR1 | | | |
| | | | |
| #if !defined(ARMA_USE_CXX11) | | #if !defined(ARMA_USE_CXX11) | |
| #if defined(_GLIBCXX_USE_C99_MATH_TR1) && defined(_GLIBCXX_USE_C99_COMP
LEX_TR1) | | #if defined(_GLIBCXX_USE_C99_MATH_TR1) && defined(_GLIBCXX_USE_C99_COMP
LEX_TR1) | |
| #define ARMA_HAVE_TR1 | | #define ARMA_HAVE_TR1 | |
| #endif | | #endif | |
| #endif | | #endif | |
| | | | |
| #if (ARMA_GCC_VERSION >= 40300) | | #if (ARMA_GCC_VERSION >= 40300) | |
| #undef arma_hot | | #undef arma_hot | |
| #undef arma_cold | | #undef arma_cold | |
| | | | |
| #define arma_hot __attribute__((__hot__)) | | #define arma_hot __attribute__((__hot__)) | |
| #define arma_cold __attribute__((__cold__)) | | #define arma_cold __attribute__((__cold__)) | |
| #endif | | #endif | |
| | | | |
| #if (ARMA_GCC_VERSION >= 40700) | | #if (ARMA_GCC_VERSION >= 40700) | |
| #define ARMA_HAVE_GCC_ASSUME_ALIGNED | | #define ARMA_HAVE_GCC_ASSUME_ALIGNED | |
| #endif | | #endif | |
| | | | |
|
| | | // gcc's vectoriser can handle elaborate loops | |
| | | #undef ARMA_SIMPLE_LOOPS | |
| | | | |
| #if defined(__OPTIMIZE_SIZE__) | | #if defined(__OPTIMIZE_SIZE__) | |
|
| #undef ARMA_SIMPLE_LOOPS | | | |
| #define ARMA_SIMPLE_LOOPS | | #define ARMA_SIMPLE_LOOPS | |
| #endif | | #endif | |
| | | | |
|
| | | #if (defined(_POSIX_C_SOURCE) && (_POSIX_C_SOURCE >= 200112L)) | |
| | | #define ARMA_HAVE_SNPRINTF | |
| | | #define ARMA_HAVE_ISFINITE | |
| | | #define ARMA_HAVE_LOG1P | |
| | | #define ARMA_HAVE_ISINF | |
| | | #define ARMA_HAVE_ISNAN | |
| | | #endif | |
| | | | |
| #undef ARMA_GCC_VERSION | | #undef ARMA_GCC_VERSION | |
| | | | |
| #endif | | #endif | |
| | | | |
|
| #if defined(__clang__) && !defined(__INTEL_COMPILER) | | #if defined(__clang__) && (defined(__INTEL_COMPILER) || defined(__NVCC__) | | |
| #undef ARMA_HAVE_TR1 | | | defined(__CUDACC__) || defined(__PGI) || defined(__PATHSCALE__)) | |
| | | #undef ARMA_FAKE_CLANG | |
| | | #define ARMA_FAKE_CLANG | |
| | | #endif | |
| | | | |
|
| #undef ARMA_GOOD_COMPILER | | #if defined(__clang__) && !defined(ARMA_FAKE_CLANG) | |
| #define ARMA_GOOD_COMPILER | | | |
| | | | |
|
| // clang's vectoriser has trouble dealing with slightly more elaborate lo | | #define ARMA_GOOD_COMPILER | |
| ops | | | |
| // http://llvm.org/bugs/show_bug.cgi?id=16358 | | | |
| #undef ARMA_SIMPLE_LOOPS | | | |
| #define ARMA_SIMPLE_LOOPS | | | |
| | | | |
| #if !defined(__has_attribute) | | #if !defined(__has_attribute) | |
| #define __has_attribute(x) 0 | | #define __has_attribute(x) 0 | |
| #endif | | #endif | |
| | | | |
| #if __has_attribute(__pure__) | | #if __has_attribute(__pure__) | |
| #undef arma_pure | | #undef arma_pure | |
| #define arma_pure __attribute__((__pure__)) | | #define arma_pure __attribute__((__pure__)) | |
| #endif | | #endif | |
| | | | |
| | | | |
| skipping to change at line 297 | | skipping to change at line 307 | |
| #if defined(__has_builtin) && __has_builtin(__builtin_assume_aligned) | | #if defined(__has_builtin) && __has_builtin(__builtin_assume_aligned) | |
| #undef ARMA_HAVE_GCC_ASSUME_ALIGNED | | #undef ARMA_HAVE_GCC_ASSUME_ALIGNED | |
| #define ARMA_HAVE_GCC_ASSUME_ALIGNED | | #define ARMA_HAVE_GCC_ASSUME_ALIGNED | |
| #endif | | #endif | |
| | | | |
| #if defined(__apple_build_version__) | | #if defined(__apple_build_version__) | |
| #undef ARMA_USE_EXTERN_CXX11_RNG | | #undef ARMA_USE_EXTERN_CXX11_RNG | |
| // because Apple engineers are too lazy to implement thread_local | | // because Apple engineers are too lazy to implement thread_local | |
| #endif | | #endif | |
| | | | |
|
| | | #if (defined(_POSIX_C_SOURCE) && (_POSIX_C_SOURCE >= 200112L)) | |
| | | #define ARMA_HAVE_SNPRINTF | |
| | | #define ARMA_HAVE_ISFINITE | |
| | | #define ARMA_HAVE_LOG1P | |
| | | #define ARMA_HAVE_ISINF | |
| | | #define ARMA_HAVE_ISNAN | |
| | | #endif | |
| | | | |
| #endif | | #endif | |
| | | | |
| #if defined(__INTEL_COMPILER) | | #if defined(__INTEL_COMPILER) | |
| | | | |
| #if (__INTEL_COMPILER_BUILD_DATE < 20090623) | | #if (__INTEL_COMPILER_BUILD_DATE < 20090623) | |
| #error "*** Need a newer compiler ***" | | #error "*** Need a newer compiler ***" | |
| #endif | | #endif | |
| | | | |
|
| #undef ARMA_GOOD_COMPILER | | | |
| #undef ARMA_HAVE_TR1 | | | |
| | | | |
| #undef ARMA_HAVE_GCC_ASSUME_ALIGNED | | #undef ARMA_HAVE_GCC_ASSUME_ALIGNED | |
| #undef ARMA_HAVE_ICC_ASSUME_ALIGNED | | #undef ARMA_HAVE_ICC_ASSUME_ALIGNED | |
| #define ARMA_HAVE_ICC_ASSUME_ALIGNED | | #define ARMA_HAVE_ICC_ASSUME_ALIGNED | |
| | | | |
|
| #undef ARMA_SIMPLE_LOOPS | | | |
| #define ARMA_SIMPLE_LOOPS | | | |
| | | | |
| #endif | | #endif | |
| | | | |
| #if defined(_MSC_VER) | | #if defined(_MSC_VER) | |
| | | | |
| #if (_MSC_VER < 1600) | | #if (_MSC_VER < 1600) | |
| #error "*** Need a newer compiler ***" | | #error "*** Need a newer compiler ***" | |
| #endif | | #endif | |
| | | | |
| #if (_MSC_VER < 1700) | | #if (_MSC_VER < 1700) | |
| #pragma message ("WARNING: this compiler is outdated and has incomplete
support for the C++ standard;") | | #pragma message ("WARNING: this compiler is outdated and has incomplete
support for the C++ standard;") | |
| | | | |
| skipping to change at line 336 | | skipping to change at line 348 | |
| #define ARMA_BAD_COMPILER | | #define ARMA_BAD_COMPILER | |
| #endif | | #endif | |
| | | | |
| #if defined(ARMA_USE_CXX11) | | #if defined(ARMA_USE_CXX11) | |
| #if (_MSC_VER < 1800) | | #if (_MSC_VER < 1800) | |
| #pragma message ("WARNING: compiler is in C++11 mode, but it has inco
mplete support for C++11 features;") | | #pragma message ("WARNING: compiler is in C++11 mode, but it has inco
mplete support for C++11 features;") | |
| #pragma message ("WARNING: if something breaks, you get to keep all t
he pieces") | | #pragma message ("WARNING: if something breaks, you get to keep all t
he pieces") | |
| #endif | | #endif | |
| #endif | | #endif | |
| | | | |
|
| #undef ARMA_SIMPLE_LOOPS | | | |
| #define ARMA_SIMPLE_LOOPS | | | |
| | | | |
| #undef ARMA_GOOD_COMPILER | | | |
| #undef ARMA_HAVE_SNPRINTF | | | |
| #undef ARMA_HAVE_ISFINITE | | | |
| #undef ARMA_HAVE_LOG1P | | | |
| #undef ARMA_HAVE_ISINF | | | |
| #undef ARMA_HAVE_ISNAN | | | |
| #undef ARMA_HAVE_TR1 | | | |
| | | | |
| // #undef arma_inline | | // #undef arma_inline | |
| // #define arma_inline inline __forceinline | | // #define arma_inline inline __forceinline | |
| | | | |
| #pragma warning(push) | | #pragma warning(push) | |
| | | | |
| #pragma warning(disable: 4127) // conditional expression is constant | | #pragma warning(disable: 4127) // conditional expression is constant | |
| #pragma warning(disable: 4510) // default constructor could not be gener
ated | | #pragma warning(disable: 4510) // default constructor could not be gener
ated | |
| #pragma warning(disable: 4511) // copy constructor can't be generated | | #pragma warning(disable: 4511) // copy constructor can't be generated | |
| #pragma warning(disable: 4512) // assignment operator can't be generated | | #pragma warning(disable: 4512) // assignment operator can't be generated | |
| #pragma warning(disable: 4513) // destructor can't be generated | | #pragma warning(disable: 4513) // destructor can't be generated | |
| | | | |
| skipping to change at line 400 | | skipping to change at line 401 | |
| | | | |
| #if defined(__SUNPRO_CC) | | #if defined(__SUNPRO_CC) | |
| | | | |
| // http://www.oracle.com/technetwork/server-storage/solarisstudio/trainin
g/index-jsp-141991.html | | // http://www.oracle.com/technetwork/server-storage/solarisstudio/trainin
g/index-jsp-141991.html | |
| // http://www.oracle.com/technetwork/server-storage/solarisstudio/documen
tation/cplusplus-faq-355066.html | | // http://www.oracle.com/technetwork/server-storage/solarisstudio/documen
tation/cplusplus-faq-355066.html | |
| | | | |
| #if (__SUNPRO_CC < 0x5100) | | #if (__SUNPRO_CC < 0x5100) | |
| #error "*** Need a newer compiler ***" | | #error "*** Need a newer compiler ***" | |
| #endif | | #endif | |
| | | | |
|
| #undef ARMA_HAVE_SNPRINTF | | | |
| #undef ARMA_HAVE_ISFINITE | | | |
| #undef ARMA_HAVE_LOG1P | | | |
| #undef ARMA_HAVE_ISINF | | | |
| #undef ARMA_HAVE_ISNAN | | | |
| #undef ARMA_HAVE_TR1 | | | |
| | | | |
| #endif | | | |
| | | | |
| #if defined(__NVCC__) | | | |
| #undef ARMA_HAVE_SNPRINTF | | | |
| #undef ARMA_HAVE_ISFINITE | | | |
| #undef ARMA_HAVE_LOG1P | | | |
| #undef ARMA_HAVE_ISINF | | | |
| #undef ARMA_HAVE_ISNAN | | | |
| #undef ARMA_HAVE_TR1 | | | |
| #endif | | #endif | |
| | | | |
| #if defined(log2) | | #if defined(log2) | |
| #undef log2 | | #undef log2 | |
| #pragma message ("WARNING: detected 'log2' macro and undefined it") | | #pragma message ("WARNING: detected 'log2' macro and undefined it") | |
| #endif | | #endif | |
| | | | |
| // | | // | |
| // whoever defined macros with the names "min" and "max" should be permanen
tly removed from the gene pool | | // whoever defined macros with the names "min" and "max" should be permanen
tly removed from the gene pool | |
| | | | |
| | | | |
End of changes. 16 change blocks. |
| 56 lines changed or deleted | | 42 lines changed or added | |
|
| constants.hpp | | constants.hpp | |
| | | | |
| skipping to change at line 99 | | skipping to change at line 99 | |
| { | | { | |
| arma_ignore(junk); | | arma_ignore(junk); | |
| | | | |
| return std::numeric_limits<eT>::max(); | | return std::numeric_limits<eT>::max(); | |
| } | | } | |
| | | | |
| }; | | }; | |
| } | | } | |
| | | | |
| //! various constants. | | //! various constants. | |
|
| //! Physical constants taken from NIST and WolframAlpha on 2009-06-23 | | //! Physical constants taken from NIST 2010 CODATA values, and some from Wo
lframAlpha (values provided as of 2009-06-23) | |
| //! http://physics.nist.gov/cuu/Constants | | //! http://physics.nist.gov/cuu/Constants | |
| //! http://www.wolframalpha.com | | //! http://www.wolframalpha.com | |
| //! See also http://en.wikipedia.org/wiki/Physical_constant | | //! See also http://en.wikipedia.org/wiki/Physical_constant | |
| | | | |
| template<typename eT> | | template<typename eT> | |
| class Datum | | class Datum | |
| { | | { | |
| public: | | public: | |
| | | | |
| static const eT pi; //!< ratio of any circle's circumference to its
diameter | | static const eT pi; //!< ratio of any circle's circumference to its
diameter | |
| | | | |
| skipping to change at line 167 | | skipping to change at line 167 | |
| template<typename eT> const eT Datum<eT>::e = eT(2.7182818284590452
353602874713526624977572470936999595749669676277240766303535475945713821785
251664274); | | template<typename eT> const eT Datum<eT>::e = eT(2.7182818284590452
353602874713526624977572470936999595749669676277240766303535475945713821785
251664274); | |
| template<typename eT> const eT Datum<eT>::euler = eT(0.5772156649015328
606065120900824024310421593359399235988057672348848677267776646709369470632
917467495); | | template<typename eT> const eT Datum<eT>::euler = eT(0.5772156649015328
606065120900824024310421593359399235988057672348848677267776646709369470632
917467495); | |
| template<typename eT> const eT Datum<eT>::gratio = eT(1.6180339887498948
482045868343656381177203091798057628621354486227052604628189024497072072041
893911374); | | template<typename eT> const eT Datum<eT>::gratio = eT(1.6180339887498948
482045868343656381177203091798057628621354486227052604628189024497072072041
893911374); | |
| template<typename eT> const eT Datum<eT>::sqrt2 = eT(1.4142135623730950
488016887242096980785696718753769480731766797379907324784621070388503875343
276415727); | | template<typename eT> const eT Datum<eT>::sqrt2 = eT(1.4142135623730950
488016887242096980785696718753769480731766797379907324784621070388503875343
276415727); | |
| template<typename eT> const eT Datum<eT>::eps = std::numeric_limits<e
T>::epsilon(); | | template<typename eT> const eT Datum<eT>::eps = std::numeric_limits<e
T>::epsilon(); | |
| template<typename eT> const eT Datum<eT>::log_min = std::log(std::numeric
_limits<eT>::min()); | | template<typename eT> const eT Datum<eT>::log_min = std::log(std::numeric
_limits<eT>::min()); | |
| template<typename eT> const eT Datum<eT>::log_max = std::log(std::numeric
_limits<eT>::max()); | | template<typename eT> const eT Datum<eT>::log_max = std::log(std::numeric
_limits<eT>::max()); | |
| template<typename eT> const eT Datum<eT>::nan = priv::Datum_helper::n
an<eT>(); | | template<typename eT> const eT Datum<eT>::nan = priv::Datum_helper::n
an<eT>(); | |
| template<typename eT> const eT Datum<eT>::inf = priv::Datum_helper::i
nf<eT>(); | | template<typename eT> const eT Datum<eT>::inf = priv::Datum_helper::i
nf<eT>(); | |
| | | | |
|
| template<typename eT> const eT Datum<eT>::m_u = eT(1.660538782e-27); | | template<typename eT> const eT Datum<eT>::m_u = eT(1.660538921e-27); | |
| template<typename eT> const eT Datum<eT>::N_A = eT(6.02214179e23); | | template<typename eT> const eT Datum<eT>::N_A = eT(6.02214129e23); | |
| template<typename eT> const eT Datum<eT>::k = eT(1.3806504e-23); | | template<typename eT> const eT Datum<eT>::k = eT(1.3806488e-23); | |
| template<typename eT> const eT Datum<eT>::k_evk = eT(8.617343e-5); | | template<typename eT> const eT Datum<eT>::k_evk = eT(8.6173324e-5); | |
| template<typename eT> const eT Datum<eT>::a_0 = eT(0.52917720859e-10) | | template<typename eT> const eT Datum<eT>::a_0 = eT(0.52917721092e-10) | |
| ; | | ; | |
| template<typename eT> const eT Datum<eT>::mu_B = eT(927.400915e-26); | | template<typename eT> const eT Datum<eT>::mu_B = eT(927.400968e-26); | |
| template<typename eT> const eT Datum<eT>::Z_0 = eT(3.76730313461771e-
2); | | template<typename eT> const eT Datum<eT>::Z_0 = eT(3.76730313461771e-
2); | |
|
| template<typename eT> const eT Datum<eT>::G_0 = eT(7.7480917004e-5); | | template<typename eT> const eT Datum<eT>::G_0 = eT(7.7480917346e-5); | |
| template<typename eT> const eT Datum<eT>::k_e = eT(8.9875517873681764
e9); | | template<typename eT> const eT Datum<eT>::k_e = eT(8.9875517873681764
e9); | |
| template<typename eT> const eT Datum<eT>::eps_0 = eT(8.85418781762039e-
12); | | template<typename eT> const eT Datum<eT>::eps_0 = eT(8.85418781762039e-
12); | |
|
| template<typename eT> const eT Datum<eT>::m_e = eT(9.10938215e-31); | | template<typename eT> const eT Datum<eT>::m_e = eT(9.10938291e-31); | |
| template<typename eT> const eT Datum<eT>::eV = eT(1.602176487e-19); | | template<typename eT> const eT Datum<eT>::eV = eT(1.602176565e-19); | |
| template<typename eT> const eT Datum<eT>::ec = eT(1.602176487e-19); | | template<typename eT> const eT Datum<eT>::ec = eT(1.602176565e-19); | |
| template<typename eT> const eT Datum<eT>::F = eT(96485.3399); | | template<typename eT> const eT Datum<eT>::F = eT(96485.3365); | |
| template<typename eT> const eT Datum<eT>::alpha = eT(7.2973525376e-3); | | template<typename eT> const eT Datum<eT>::alpha = eT(7.2973525698e-3); | |
| template<typename eT> const eT Datum<eT>::alpha_inv = eT(137.035999679); | | template<typename eT> const eT Datum<eT>::alpha_inv = eT(137.035999074); | |
| template<typename eT> const eT Datum<eT>::K_J = eT(483597.891e9); | | template<typename eT> const eT Datum<eT>::K_J = eT(483597.870e9); | |
| template<typename eT> const eT Datum<eT>::mu_0 = eT(1.25663706143592e-
06); | | template<typename eT> const eT Datum<eT>::mu_0 = eT(1.25663706143592e-
06); | |
| template<typename eT> const eT Datum<eT>::phi_0 = eT(2.067833667e-15); | | template<typename eT> const eT Datum<eT>::phi_0 = eT(2.067833667e-15); | |
|
| template<typename eT> const eT Datum<eT>::R = eT(8.314472); | | template<typename eT> const eT Datum<eT>::R = eT(8.3144621); | |
| template<typename eT> const eT Datum<eT>::G = eT(6.67428e-11); | | template<typename eT> const eT Datum<eT>::G = eT(6.67384e-11); | |
| template<typename eT> const eT Datum<eT>::h = eT(6.62606896e-34); | | template<typename eT> const eT Datum<eT>::h = eT(6.62606957e-34); | |
| template<typename eT> const eT Datum<eT>::h_bar = eT(1.054571628e-34); | | template<typename eT> const eT Datum<eT>::h_bar = eT(1.054571726e-34); | |
| template<typename eT> const eT Datum<eT>::m_p = eT(1.672621637e-27); | | template<typename eT> const eT Datum<eT>::m_p = eT(1.672621777e-27); | |
| template<typename eT> const eT Datum<eT>::R_inf = eT(10973731.568527); | | template<typename eT> const eT Datum<eT>::R_inf = eT(10973731.568539); | |
| template<typename eT> const eT Datum<eT>::c_0 = eT(299792458.0); | | template<typename eT> const eT Datum<eT>::c_0 = eT(299792458.0); | |
|
| template<typename eT> const eT Datum<eT>::sigma = eT(5.670400e-8); | | template<typename eT> const eT Datum<eT>::sigma = eT(5.670373e-8); | |
| template<typename eT> const eT Datum<eT>::R_k = eT(25812.807557); | | template<typename eT> const eT Datum<eT>::R_k = eT(25812.8074434); | |
| template<typename eT> const eT Datum<eT>::b = eT(2.8977685e-3); | | template<typename eT> const eT Datum<eT>::b = eT(2.8977721e-3); | |
| | | | |
| typedef Datum<float> fdatum; | | typedef Datum<float> fdatum; | |
| typedef Datum<double> datum; | | typedef Datum<double> datum; | |
| | | | |
| namespace priv | | namespace priv | |
| { | | { | |
| | | | |
| template<typename eT> | | template<typename eT> | |
| static | | static | |
| arma_inline | | arma_inline | |
| | | | |
End of changes. 6 change blocks. |
| 25 lines changed or deleted | | 25 lines changed or added | |
|
| constants_compat.hpp | | constants_compat.hpp | |
| | | | |
| skipping to change at line 54 | | skipping to change at line 54 | |
| //! log of the maximum representable value | | //! log of the maximum representable value | |
| static eT log_max() { static const eT out = std::log(std::numeric_limit
s<eT>::max()); return out; } | | static eT log_max() { static const eT out = std::log(std::numeric_limit
s<eT>::max()); return out; } | |
| | | | |
| //! "not a number" | | //! "not a number" | |
| static eT nan() { return priv::Datum_helper::nan<eT>(); } | | static eT nan() { return priv::Datum_helper::nan<eT>(); } | |
| | | | |
| //! infinity | | //! infinity | |
| static eT inf() { return priv::Datum_helper::inf<eT>(); } | | static eT inf() { return priv::Datum_helper::inf<eT>(); } | |
| }; | | }; | |
| | | | |
|
| //! Physical constants taken from NIST and WolframAlpha on 2009-06-23 | | //! Physical constants taken from NIST 2010 CODATA values, and some from Wo
lframAlpha (values provided as of 2009-06-23) | |
| //! http://physics.nist.gov/cuu/Constants | | //! http://physics.nist.gov/cuu/Constants | |
| //! http://www.wolframalpha.com | | //! http://www.wolframalpha.com | |
| //! See also http://en.wikipedia.org/wiki/Physical_constant | | //! See also http://en.wikipedia.org/wiki/Physical_constant | |
| template<typename eT> | | template<typename eT> | |
| class Phy | | class Phy | |
| { | | { | |
| public: | | public: | |
| | | | |
| //! atomic mass constant (in kg) | | //! atomic mass constant (in kg) | |
|
| static eT m_u() { return eT(1.660538782e-27); } | | static eT m_u() { return eT(1.660538921e-27); } | |
| | | | |
| //! Avogadro constant | | //! Avogadro constant | |
|
| static eT N_A() { return eT(6.02214179e23); } | | static eT N_A() { return eT(6.02214129e23); } | |
| | | | |
| //! Boltzmann constant (in joules per kelvin) | | //! Boltzmann constant (in joules per kelvin) | |
|
| static eT k() { return eT(1.3806504e-23); } | | static eT k() { return eT(1.3806488e-23); } | |
| | | | |
| //! Boltzmann constant (in eV/K) | | //! Boltzmann constant (in eV/K) | |
|
| static eT k_evk() { return eT(8.617343e-5); } | | static eT k_evk() { return eT(8.6173324e-5); } | |
| | | | |
| //! Bohr radius (in meters) | | //! Bohr radius (in meters) | |
|
| static eT a_0() { return eT(0.52917720859e-10); } | | static eT a_0() { return eT(0.52917721092e-10); } | |
| | | | |
| //! Bohr magneton | | //! Bohr magneton | |
|
| static eT mu_B() { return eT(927.400915e-26); } | | static eT mu_B() { return eT(927.400968e-26); } | |
| | | | |
| //! characteristic impedance of vacuum (in ohms) | | //! characteristic impedance of vacuum (in ohms) | |
| static eT Z_0() { return eT(3.76730313461771e-2); } | | static eT Z_0() { return eT(3.76730313461771e-2); } | |
| | | | |
| //! conductance quantum (in siemens) | | //! conductance quantum (in siemens) | |
|
| static eT G_0() { return eT(7.7480917004e-5); } | | static eT G_0() { return eT(7.7480917346e-5); } | |
| | | | |
| //! Coulomb's constant (in meters per farad) | | //! Coulomb's constant (in meters per farad) | |
| static eT k_e() { return eT(8.9875517873681764e9); } | | static eT k_e() { return eT(8.9875517873681764e9); } | |
| | | | |
| //! electric constant (in farads per meter) | | //! electric constant (in farads per meter) | |
| static eT eps_0() { return eT(8.85418781762039e-12); } | | static eT eps_0() { return eT(8.85418781762039e-12); } | |
| | | | |
| //! electron mass (in kg) | | //! electron mass (in kg) | |
|
| static eT m_e() { return eT(9.10938215e-31); } | | static eT m_e() { return eT(9.10938291e-31); } | |
| | | | |
| //! electron volt (in joules) | | //! electron volt (in joules) | |
|
| static eT eV() { return eT(1.602176487e-19); } | | static eT eV() { return eT(1.602176565e-19); } | |
| | | | |
| //! elementary charge (in coulombs) | | //! elementary charge (in coulombs) | |
|
| static eT e() { return eT(1.602176487e-19); } | | static eT e() { return eT(1.602176565e-19); } | |
| | | | |
| //! Faraday constant (in coulombs) | | //! Faraday constant (in coulombs) | |
|
| static eT F() { return eT(96485.3399); } | | static eT F() { return eT(96485.3365); } | |
| | | | |
| //! fine-structure constant | | //! fine-structure constant | |
|
| static eT alpha() { return eT(7.2973525376e-3); } | | static eT alpha() { return eT(7.2973525698e-3); } | |
| | | | |
| //! inverse fine-structure constant | | //! inverse fine-structure constant | |
|
| static eT alpha_inv() { return eT(137.035999679); } | | static eT alpha_inv() { return eT(137.035999074); } | |
| | | | |
| //! Josephson constant | | //! Josephson constant | |
|
| static eT K_J() { return eT(483597.891e9); } | | static eT K_J() { return eT(483597.870e9); } | |
| | | | |
| //! magnetic constant (in henries per meter) | | //! magnetic constant (in henries per meter) | |
| static eT mu_0() { return eT(1.25663706143592e-06); } | | static eT mu_0() { return eT(1.25663706143592e-06); } | |
| | | | |
| //! magnetic flux quantum (in webers) | | //! magnetic flux quantum (in webers) | |
| static eT phi_0() { return eT(2.067833667e-15); } | | static eT phi_0() { return eT(2.067833667e-15); } | |
| | | | |
| //! molar gas constant (in joules per mole kelvin) | | //! molar gas constant (in joules per mole kelvin) | |
|
| static eT R() { return eT(8.314472); } | | static eT R() { return eT(8.3144621); } | |
| | | | |
| //! Newtonian constant of gravitation (in newton square meters per kilogr
am squared) | | //! Newtonian constant of gravitation (in newton square meters per kilogr
am squared) | |
|
| static eT G() { return eT(6.67428e-11); } | | static eT G() { return eT(6.67384e-11); } | |
| | | | |
| //! Planck constant (in joule seconds) | | //! Planck constant (in joule seconds) | |
|
| static eT h() { return eT(6.62606896e-34); } | | static eT h() { return eT(6.62606957e-34); } | |
| | | | |
| //! Planck constant over 2 pi, aka reduced Planck constant (in joule seco
nds) | | //! Planck constant over 2 pi, aka reduced Planck constant (in joule seco
nds) | |
|
| static eT h_bar() { return eT(1.054571628e-34); } | | static eT h_bar() { return eT(1.054571726e-34); } | |
| | | | |
| //! proton mass (in kg) | | //! proton mass (in kg) | |
|
| static eT m_p() { return eT(1.672621637e-27); } | | static eT m_p() { return eT(1.672621777e-27); } | |
| | | | |
| //! Rydberg constant (in reciprocal meters) | | //! Rydberg constant (in reciprocal meters) | |
|
| static eT R_inf() { return eT(10973731.568527); } | | static eT R_inf() { return eT(10973731.568539); } | |
| | | | |
| //! speed of light in vacuum (in meters per second) | | //! speed of light in vacuum (in meters per second) | |
| static eT c_0() { return eT(299792458.0); } | | static eT c_0() { return eT(299792458.0); } | |
| | | | |
| //! Stefan-Boltzmann constant | | //! Stefan-Boltzmann constant | |
|
| static eT sigma() { return eT(5.670400e-8); } | | static eT sigma() { return eT(5.670373e-8); } | |
| | | | |
| //! von Klitzing constant (in ohms) | | //! von Klitzing constant (in ohms) | |
|
| static eT R_k() { return eT(25812.807557); } | | static eT R_k() { return eT(25812.8074434); } | |
| | | | |
| //! Wien wavelength displacement law constant | | //! Wien wavelength displacement law constant | |
|
| static eT b() { return eT(2.8977685e-3); } | | static eT b() { return eT(2.8977721e-3); } | |
| }; | | }; | |
| | | | |
| typedef Math<float> fmath; | | typedef Math<float> fmath; | |
| typedef Math<double> math; | | typedef Math<double> math; | |
| | | | |
| typedef Phy<float> fphy; | | typedef Phy<float> fphy; | |
| typedef Phy<double> phy; | | typedef Phy<double> phy; | |
| | | | |
| //! @} | | //! @} | |
| | | | |
End of changes. 24 change blocks. |
| 24 lines changed or deleted | | 24 lines changed or added | |
|