42 #ifndef STOKHOS_SPARSEARRAY_HPP
43 #define STOKHOS_SPARSEARRAY_HPP
46 #if defined (__clang__) && !defined (__INTEL_COMPILER)
47 #pragma clang system_header
55 template <
typename index_iterator,
typename value_iterator>
58 template <
typename index_iterator,
typename value_iterator>
62 template <
typename ordinal_type,
typename val_type>
111 bool found = it !=
end() && *it == i;
130 template <
typename index_iterator_type,
typename value_iterator_type>
131 class SparseArrayIterator :
132 public std::iterator<
133 std::bidirectional_iterator_tag,
134 typename std::iterator_traits<index_iterator_type>::value_type,
135 typename std::iterator_traits<index_iterator_type>::difference_type,
136 typename std::iterator_traits<index_iterator_type>::pointer,
137 typename std::iterator_traits<index_iterator_type>::reference > {
140 typedef std::iterator<
141 std::bidirectional_iterator_tag,
143 typename std::iterator_traits<index_iterator_type>::difference_type,
144 typename std::iterator_traits<index_iterator_type>::pointer,
145 typename std::iterator_traits<index_iterator_type>::reference >
base_type;
151 typedef typename std::iterator_traits<value_iterator_type>::reference
value_reference;
158 value_iterator_type value_it) :
235 template <
typename index_iterator_type,
typename value_iterator_type>
237 public std::reverse_iterator< SparseArrayIterator<index_iterator_type,
238 value_iterator_type> > {
248 typedef typename std::iterator_traits<value_iterator_type>::reference
value_reference;
267 #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.