rheolef  6.5
asr_to_csr_dist_logical.h
Go to the documentation of this file.
1 #ifndef _ASR_TO_CSR_DIST_LOGICAL_H
2 #define _ASR_TO_CSR_DIST_LOGICAL_H
3 
4 namespace rheolef {
49 template <
50  class InputPtrIterator,
51  class Predicate,
52  class Set>
53 typename Set::value_type
55  InputPtrIterator iter_ptr_a,
56  InputPtrIterator last_ptr_a,
57  Predicate is_dia,
58  Set& colext)
59 {
60  typedef typename std::iterator_traits<InputPtrIterator>::value_type Row;
61  typedef typename Row::const_iterator InputDataIterator;
62  typedef typename Set::value_type Size;
63 
64  Size nnzext = 0;
65  while (iter_ptr_a != last_ptr_a) {
66  InputDataIterator iter_data_a = (*iter_ptr_a).begin();
67  InputDataIterator last_data_a = (*iter_ptr_a).end();
68  iter_ptr_a++;
69  while (iter_data_a != last_data_a) {
70  if (!is_dia(*iter_data_a)) {
71  colext.insert((*iter_data_a).first);
72  nnzext++;
73  }
74  iter_data_a++;
75  }
76  }
77  return nnzext;
78 }
79 template <class Size, class Pair>
80 struct is_dia_t : public std::unary_function<Pair, bool> {
81  bool operator()(const Pair& x) const {
82  return x.first >= j1 && x.first < j2; }
83  is_dia_t(Size k1, Size k2) : j1(k1), j2(k2) {}
84  Size j1, j2;
85 };
86 } // namespace rheolef
87 @endcode
88 #endif // _ASR_TO_CSR_DIST_LOGICAL_H
89