aimstil
5.0.5
sparse_vector_tools.h
Go to the documentation of this file.
1
#ifndef SPARSE_VECTOR_TOOLS_H_
2
#define SPARSE_VECTOR_TOOLS_H_
3
6
7
namespace
til
8
{
14
// template < typename T >
15
// bool is_nan(const sparse_vector<T> & a)
16
// {
17
// typename sparse_vector<T>::Map::const_iterator i = a.getMap().begin();
18
// typename sparse_vector<T>::Map::const_iterator end = a.getMap().end();
19
// for (; i != end; ++i)
20
// {
21
// if (is_nan(i->second)) return true;
22
// }
23
// return false;
24
// }
25
// template < typename T >
26
inline
bool
is_nan
(
const
sparse_vector<double>
& a)
27
{
28
for
(
sparse_vector<double>::Map::const_iterator
i = a.
getMap
().begin(); i != a.
getMap
().end(); ++i)
29
{
30
if
(
is_nan
(i->second))
return
true
;
31
}
32
return
false
;
33
}
34
}
// namespace til
35
36
#endif
/*SPARSE_VECTOR_TOOLS_H_*/
til
Belongs to package Box Do not include directly, include til/Box.h instead.
Definition:
Accumulator.h:10
til::sparse_vector
A class that mimic the behavior of std::vector but with a storage policy focused on sparse data...
Definition:
sparse_vector.h:134
til::sparse_vector::getMap
Map & getMap()
Returns the internal data.
Definition:
sparse_vector.h:315
til::is_nan
bool is_nan(const numeric_array< T, D > &a)
Check that numeric_array does not contain any NAN TODO: Actually, is_nan should be a functor...
Definition:
numeric_array_tools.h:276
til
sparse_vector_tools.h
Generated by
1.8.13