1 #ifndef VIENNACL_TOOLS_ADAPTER_HPP_
2 #define VIENNACL_TOOLS_ADAPTER_HPP_
47 template<
typename NumericT,
typename SizeT,
bool is_iterator1,
bool is_forward>
72 if (i_ < mat_.size() && mat_[
static_cast<vcl_size_t>(i)].
size() > 0 )
75 if (static_cast<int>(mat_[static_cast<vcl_size_t>(i)].rbegin()->first) < j)
80 else if (i_ < mat_.size() && mat_[
static_cast<vcl_size_t>(i)].
size() == 0)
81 iter2 = mat_[static_cast<vcl_size_t>(i)].end();
83 iter2 = mat_.back().end();
90 bool flag_iterator1 = is_iterator1;
93 typedef typename std::map<SizeT, NumericT>::const_iterator col_iterator;
95 col_iterator colit = mat_[i_].find(static_cast<unsigned int>(j_));
97 if (colit != mat_[i_].
end())
102 return iter2->second;
107 bool flag_iterator1 = is_iterator1;
108 bool flag_forward = is_forward;
124 bool flag_iterator1 = is_iterator1;
125 bool flag_forward = is_forward;
135 for (SizeT k=0; k<offset; ++k)
143 bool flag_iterator1 = is_iterator1;
144 return flag_iterator1 ? (i_ == other.i_) : (iter2 == other.iter2);
152 bool flag_iterator1 = is_iterator1;
165 int end_ =
static_cast<int>(mat_[i_].size());
167 end_ =
static_cast<int>(mat_[i_].rbegin()->first);
172 std::vector<std::map<SizeT, NumericT> >
const & mat_;
173 typename std::map<SizeT, NumericT>::const_iterator iter2;
182 template<
typename NumericT,
typename SizeT =
unsigned int>
194 : mat_(mat), size1_(mat_.
size()), size2_(mat_.
size()) {}
197 : mat_(mat), size1_(num_rows), size2_(num_cols) {}
213 typedef typename std::map<SizeT, NumericT>::const_iterator col_iterator;
215 col_iterator colit = mat_[i].find(j);
217 if (colit != mat_[i].end())
218 return colit->second;
223 std::vector<std::map<SizeT, NumericT> >
const & mat_;
236 template<
typename NumericT,
typename SizeT,
bool is_iterator1>
261 if (i_ < mat_.size() && mat_[i_].size() > 0 )
264 if (static_cast<int>(mat_[i_].rbegin()->first) < j)
265 iter2 = mat_[i_].
end();
267 iter2 = mat_[i_].begin();
269 else if (i_ < mat_.size() && mat_[i_].size() == 0)
270 iter2 = mat_[i_].
end();
272 iter2 = mat_.back().end();
279 bool flag_iterator1 = is_iterator1;
282 return mat_[i_][
static_cast<SizeT
>(j_)];
285 return iter2->second;
290 bool flag_iterator1 = is_iterator1;
301 bool flag_iterator1 = is_iterator1;
314 bool flag_iterator1 = is_iterator1;
316 return (i_ == other.i_);
317 return (iter2 == other.iter2);
324 bool flag_iterator1 = is_iterator1;
337 int end_ =
static_cast<int>(mat_[i_].size());
339 end_ =
static_cast<int>(mat_[i_].rbegin()->first);
344 std::vector<std::map<SizeT, NumericT> > & mat_;
345 typename std::map<SizeT, NumericT>::iterator iter2;
356 template<
typename NumericT,
typename SizeT =
unsigned int>
368 :
BaseType(mat), mat_(mat), size1_(static_cast<SizeT>(mat_.
size())), size2_(static_cast<SizeT>(mat_.
size())) {}
373 :
BaseType(mat, num_rows, num_cols), mat_(mat), size1_(static_cast<
size_type>(num_rows)), size2_(static_cast<
size_type>(num_cols)) {}
414 std::vector<std::map<SizeT, NumericT> > & mat_;
This file provides the forward declarations for the main types used within ViennaCL.
vcl_size_t size(VectorType const &vec)
Generic routine for obtaining the size of a vector (ViennaCL, uBLAS, etc.)