cx specialisatio for is_finite()

This commit is contained in:
conrad
2022-03-30 11:58:26 +10:00
parent 2c02ec50ed
commit 0d65783a29
2 changed files with 32 additions and 2 deletions
+6 -1
View File
@@ -220,7 +220,12 @@ class arrayops
template<typename eT>
arma_hot inline static
bool
is_finite(const eT* src, const uword n_elem);
is_finite(const eT* src, const uword n_elem, const typename arma_not_cx<eT>::result* junk = nullptr);
template<typename T>
arma_hot inline static
bool
is_finite(const std::complex<T>* src, const uword n_elem);
template<typename eT>
arma_hot inline static
+26 -1
View File
@@ -1147,8 +1147,10 @@ template<typename eT>
arma_hot
inline
bool
arrayops::is_finite(const eT* src, const uword n_elem)
arrayops::is_finite(const eT* src, const uword n_elem, const typename arma_not_cx<eT>::result* junk)
{
arma_ignore(junk);
uword j;
for(j=1; j<n_elem; j+=2)
@@ -1175,6 +1177,29 @@ arrayops::is_finite(const eT* src, const uword n_elem)
template<typename T>
arma_hot
inline
bool
arrayops::is_finite(const std::complex<T>* src, const uword n_elem)
{
arma_ignore(junk);
typedef typename std::complex<T> eT;
for(uword i=0; i<n_elem; ++i)
{
const eT& val = src[i];
if(arma_isfinite(val.real()) == false) { return false; }
if(arma_isfinite(val.imag()) == false) { return false; }
}
return true;
}
template<typename eT>
arma_hot
inline