24 using scaltype =
typename std::conditional<std::is_same<T, fvec>::value,
fscal, T>::type;
27 using masktype =
typename std::conditional<std::is_same<T, fvec>::value,
fmask,
bool>::type;
33 inline T
iif(
bool b, T t, T f)
47 if constexpr (std::is_same_v<T, fmask>) {
56 inline T
max(
const T& a,
const T& b)
58 if constexpr (std::is_same_v<T, fvec>) {
62 return std::max(a, b);
67#if defined(__GNUC__) && __GNUC__ - 0 >= 3
80 if constexpr (std::is_same_v<T, float>) {
81 return std::isnan(val);
83 else if constexpr (std::is_same_v<T, double>) {
84 return std::isnan(val);
86 else if constexpr (std::is_same_v<T, fscal>) {
87 return std::isnan(val);
89 else if constexpr (std::is_same_v<T, fvec>) {
90 return isnan(val).isNotEmpty();
102 if constexpr (std::is_same_v<T, float>) {
103 return std::isfinite(val);
105 else if constexpr (std::is_same_v<T, double>) {
106 return std::isfinite(val);
108 else if constexpr (std::is_same_v<T, fscal>) {
109 return std::isfinite(val);
111 else if constexpr (std::is_same_v<T, fvec>) {
112 return isfinite(val).isFull();
120 template<
typename DataT>
124 template<
typename DataT>
135 template<
typename TdataA,
typename TdataB,
bool TDoAllA,
bool TDoAllB>
138 [[gnu::always_inline]]
static void CopyEntries(TdataA& a,
int ia,
const TdataB& b,
int ib);
141 template<
typename TdataA,
typename TdataB>
144 [[gnu::always_inline]]
static void CopyEntries(TdataA& a,
int,
const TdataB& b,
int) { a = b; }
147 template<
typename TdataA,
typename TdataB>
150 [[gnu::always_inline]]
static void CopyEntries(TdataA& a,
int,
const TdataB& b,
int ib) { a = b[ib]; }
153 template<
typename TdataA,
typename TdataB>
156 [[gnu::always_inline]]
static void CopyEntries(TdataA& a,
int ia,
const TdataB& b,
int) { a[ia] = b; }
159 template<
typename TdataA,
typename TdataB>
162 [[gnu::always_inline]]
static void CopyEntries(TdataA& a,
int ia,
const TdataB& b,
int ib) { a[ia] = b[ib]; }
178 template<
typename TdataA,
typename TdataB,
bool TDoAllA,
bool TDoAllB>
181 static void CopyEntries(TdataA& a,
int ia,
const TdataB& b,
int ib)
183 constexpr bool allA{TDoAllA || !std::is_same<TdataA, fvec>::value};
184 constexpr bool allB{TDoAllB || !std::is_same<TdataB, fvec>::value};
195 return static_cast<int>(t);
211 template<
typename DataT,
typename DataOut>
212 inline DataOut
Cast(
const DataT& val)
214 return static_cast<DataOut
>(val);
234 return static_cast<double>(val[0]);
244 template<
typename DataT,
typename DataOut>
245 inline DataOut
Cast(
const DataT& val,
size_t )
247 return static_cast<DataOut
>(val);
250 template<
typename DataT,
typename DataOut,
size_t N>
251 inline std::array<DataOut, N>
Cast(
const std::array<DataT, N>& arr,
size_t i)
253 std::array<DataOut, N> res;
254 for (
size_t iEl = 0; iEl < arr.size(); ++iEl) {
260 template<
typename DataT,
typename DataOut,
size_t N>
261 inline std::array<DataOut, N>
Cast(
const std::array<DataT, N>& arr)
263 std::array<DataOut, N> res;
264 for (
size_t iEl = 0; iEl < arr.size(); ++iEl) {
289 return static_cast<double>(val[i]);
296 template<
typename DataT>
315 template<
typename DataT>
318 return static_cast<DataT
>(1);
337 template<
typename DataT,
typename DataIn>
338 inline void SetEntry(DataT& out, DataIn in,
size_t )
340 out =
static_cast<DataT
>(in);
348 template<
typename DataIn>
364 void CholeskyFactorization(
const double a[],
const int n,
int nn,
double u[],
int* nullty,
int* ifault);
366 void SymInv(
const double a[],
const int n,
double c[],
double w[],
int* nullty,
int* ifault);
Common constant definitions for the Kalman Filter library.
friend fmask isnan(const fvec &a)
Implementation selection for the SIMD utilities (VS or pseudo)
static void CopyEntries(TdataA &a, int ia, const TdataB &b, int ib)
static void CopyEntries(TdataA &a, int ia, const TdataB &b, int)
static void CopyEntries(TdataA &a, int, const TdataB &b, int ib)
static void CopyEntries(TdataA &a, int, const TdataB &b, int)
static void CopyEntries(TdataA &a, int ia, const TdataB &b, int ib)
Copies all/one SIMD entries from one class to the other class.
static void CopyEntries(TdataA &a, int ia, const TdataB &b, int ib)
constexpr T2 Undef
Undefined values.
void SymInv(const double a[], const int n, double c[], double w[], int *nullty, int *ifault)
void CholeskyFactorization(const double a[], const int n, int nn, double u[], int *nullty, int *ifault)
size_t Size()
Returns the number of elements available for a given data type.
DataOut Cast(const DataT &val)
Converts a value of type DataT to type DataOut.
DataT One()
Returns a value of the data type set to one.
void SetEntry(DataT &out, DataIn in, size_t)
Sets a value at a specific index in the output data.
fvec One< fvec >()
Returns a value of the data type set to one.
size_t Size< fvec >()
Returns the number of elements available for a given data type.
void PrintSIMDmsg(std::stringstream &msg, DataT &v)
Stingstream output operation for simd data.
typename std::conditional< std::is_same< T, fvec >::value, fmask, bool >::type masktype
void CheckSimdVectorEquality(fvec v, const char *name)
Checks, if a SIMD vector horizontally equal TODO: Find this method in the VC!
typename std::conditional< std::is_same< T, fvec >::value, fscal, T >::type scaltype
bool IsLikely(bool b)
tell the CPU that the bool condition is likely to be true
T max(const T &a, const T &b)
fvec iif(const fmask &m, const fvec &t, const fvec &f)
bool IsFinite(const T &val)
Checks whether a variable of a particular type is finite.
bool IsUndefined(const T &val)
Checks whether a variable of a particular type defined.
class cbm::algo::kf::fvec __attribute__((aligned(16)))
Hash for unordered_map with enum class keys.
int operator()(T t) const