10 #ifndef STOKHOS_SPARSEARRAY_HPP
11 #define STOKHOS_SPARSEARRAY_HPP
14 #if defined (__clang__) && !defined (__INTEL_COMPILER)
15 #pragma clang system_header
23 template <
typename index_iterator,
typename value_iterator>
26 template <
typename index_iterator,
typename value_iterator>
30 template <
typename ordinal_type,
typename val_type>
79 bool found = it !=
end() && *it == i;
98 template <
typename index_iterator_type,
typename value_iterator_type>
99 class SparseArrayIterator :
100 public std::iterator<
101 std::bidirectional_iterator_tag,
102 typename std::iterator_traits<index_iterator_type>::value_type,
103 typename std::iterator_traits<index_iterator_type>::difference_type,
104 typename std::iterator_traits<index_iterator_type>::pointer,
105 typename std::iterator_traits<index_iterator_type>::reference > {
108 typedef std::iterator<
109 std::bidirectional_iterator_tag,
111 typename std::iterator_traits<index_iterator_type>::difference_type,
112 typename std::iterator_traits<index_iterator_type>::pointer,
113 typename std::iterator_traits<index_iterator_type>::reference >
base_type;
119 typedef typename std::iterator_traits<value_iterator_type>::reference
value_reference;
126 value_iterator_type value_it) :
203 template <
typename index_iterator_type,
typename value_iterator_type>
205 public std::reverse_iterator< SparseArrayIterator<index_iterator_type,
206 value_iterator_type> > {
216 typedef typename std::iterator_traits<value_iterator_type>::reference
value_reference;
235 #endif // STOKHOS_SPARSEARRAY_HPP
std::reverse_iterator< iterator_type > base_type
bool operator==(const SparseArrayIterator &it) const
== operator
SparseArrayIterator operator--(int)
Postfix –.
base_type::reference reference
base_type::pointer pointer
std::iterator_traits< value_iterator_type >::reference value_reference
base_type::value_type value_type
std::iterator_traits< value_iterator_type >::reference value_reference
const_reverse_iterator rbegin() const
Reverse iterator pointing to end of array.
SparseArrayReverseIterator(iterator_type it)
Constructor.
Container for a "sparse" array.
base_type::iterator_category iterator_category
SparseArrayReverseIterator()
Default constructor.
Bi-directional iterator for traversing a sparse array.
Bi-directional reverse iterator for traversing a sparse array.
base_type::value_type value_type
Teuchos::Array< val_type >::const_iterator value_const_iterator
bool operator<(const SparseArrayIterator &b) const
Return true of *this < b.
SparseArrayIterator(index_iterator_type index_it, value_iterator_type value_it)
Constructor.
value_iterator_type value_iterator
Value iterator.
SparseArrayIterator & operator++()
Prefix ++.
value_reference value() const
Return value associated with iterator.
SparseArrayReverseIterator< index_const_iterator, value_const_iterator > const_reverse_iterator
const_iterator find(ordinal_type i) const
Return iterator pointing to given index i.
SparseArrayIterator & operator--()
Prefix –.
void resize(size_type new_size, const value_type &x=value_type())
Teuchos::Array< ordinal_type > indices
Indices of nonzeros.
std::vector< T >::const_iterator const_iterator
Teuchos::Array< ordinal_type >::const_iterator index_const_iterator
base_type::difference_type difference_type
bool operator!=(const SparseArrayIterator &it) const
!= operator
const_reverse_iterator rend() const
Reverse iterator pointing to begining of array.
SparseArrayIterator< index_iterator_type, value_iterator_type > iterator_type
base_type::difference_type difference_type
SparseArrayIterator operator++(int)
Postfix ++.
const_iterator begin() const
Iterator pointing to beginning of array.
index_iterator_type index_iterator
Index iterator.
Teuchos::Array< val_type > values
Nonzero values.
SparseArrayIterator< index_const_iterator, value_const_iterator > const_iterator
base_type::iterator_category iterator_category
base_type::reference reference
reference operator*() const
const_iterator end() const
Iterator pointing to end of array.
pointer operator->() const
-> operator
SparseArrayIterator()
Default constructor.
std::iterator< std::bidirectional_iterator_tag, typename std::iterator_traits< index_iterator_type >::value_type, typename std::iterator_traits< index_iterator_type >::difference_type, typename std::iterator_traits< index_iterator_type >::pointer, typename std::iterator_traits< index_iterator_type >::reference > base_type
ordinal_type size() const
Return size of array.
value_reference value() const
Return value associated with iterator.
base_type::pointer pointer
void resize(ordinal_type sz)
Resize array.