add .reset_cache()

This commit is contained in:
conrad
2021-07-13 12:23:37 +10:00
parent c9a848dc5d
commit 8c97ea4df1
2 changed files with 40 additions and 0 deletions
+1
View File
@@ -360,6 +360,7 @@ class SpMat : public SpBase< eT, SpMat<eT> >
inline const SpMat& sprandn(const SizeMat& s, const double density);
inline void reset();
inline void reset_cache();
//! don't use this unless you're writing internal Armadillo code
inline void reserve(const uword in_rows, const uword in_cols, const uword new_n_nonzero);
+39
View File
@@ -4501,6 +4501,45 @@ SpMat<eT>::reset()
template<typename eT>
inline
void
SpMat<eT>::reset_cache()
{
arma_extra_debug_sigprint();
sync_csc();
#if defined(ARMA_USE_OPENMP)
{
#pragma omp critical (arma_SpMat_cache)
{
cache.reset();
sync_state = 0;
}
}
#elif (!defined(ARMA_DONT_USE_STD_MUTEX))
{
cache_mutex.lock();
cache.reset();
sync_state = 0;
cache_mutex.unlock();
}
#else
{
cache.reset();
sync_state = 0;
}
#endif
}
template<typename eT>
inline
void