1 #ifndef VIENNACL_TOOLS_ADAPTER_HPP_
2 #define VIENNACL_TOOLS_ADAPTER_HPP_
47 template <
typename SCALARTYPE,
typename SizeType,
bool is_iterator1,
bool is_forward>
58 : mat_(mat), i_(i), j_(j)
72 if (i_ < mat_.size() && mat_[i].size() > 0 )
75 if (static_cast<int>(mat_[i].rbegin()->first) < j)
76 iter2 = mat_[i].
end();
78 iter2 = mat_[i].begin();
80 else if (i_ < mat_.size() && mat_[i].size() == 0)
81 iter2 = mat_[i].
end();
83 iter2 = mat_.back().end();
92 typedef typename std::map<SizeType, SCALARTYPE>::const_iterator col_iterator;
94 col_iterator colit = mat_[i_].find(static_cast<unsigned int>(j_));
96 if (colit != mat_[i_].
end())
101 return iter2->second;
130 for (SizeType k=0; k<offset; ++k)
138 return is_iterator1 ? (i_ == other.i_) : (iter2 == other.iter2);
158 int end_ =
static_cast<int>(mat_[i_].size());
160 end_ = mat_[i_].rbegin()->first;
165 std::vector<std::map<SizeType, SCALARTYPE> >
const & mat_;
166 typename std::map<SizeType, SCALARTYPE>::const_iterator iter2;
175 template <
typename SCALARTYPE,
typename SizeType =
unsigned int>
187 : mat_(mat), size1_(mat_.
size()), size2_(mat_.
size()) {}
190 : mat_(mat), size1_(num_rows), size2_(num_cols) {}
206 typedef typename std::map<SizeType, SCALARTYPE>::const_iterator col_iterator;
208 col_iterator colit = mat_[i].find(j);
210 if (colit != mat_[i].end())
211 return colit->second;
216 std::vector<std::map<SizeType, SCALARTYPE> >
const & mat_;
229 template <
typename SCALARTYPE,
typename SizeType,
bool is_iterator1>
240 : mat_(mat), i_(i), j_(j)
254 if (i_ < mat_.size() && mat_[i].size() > 0 )
257 if (static_cast<int>(mat_[i].rbegin()->first) < j)
258 iter2 = mat_[i].
end();
260 iter2 = mat_[i].begin();
262 else if (i_ < mat_.size() && mat_[i].size() == 0)
263 iter2 = mat_[i].
end();
265 iter2 = mat_.back().end();
274 return mat_[i_][
static_cast<SizeType
>(j_)];
277 return iter2->second;
305 return (i_ == other.i_);
306 return (iter2 == other.iter2);
325 int end_ =
static_cast<int>(mat_[i_].size());
327 end_ = mat_[i_].rbegin()->first;
332 std::vector<std::map<SizeType, SCALARTYPE> > & mat_;
333 typename std::map<SizeType, SCALARTYPE>::iterator iter2;
344 template <
typename SCALARTYPE,
typename SizeType =
unsigned int>
361 :
BaseType(mat, num_rows, num_cols), mat_(mat), size1_(static_cast<
size_type>(num_rows)), size2_(static_cast<
size_type>(num_cols)) {}
402 std::vector<std::map<SizeType, SCALARTYPE> > & mat_;
std::size_t vcl_size_t
Definition: forwards.h:58
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.)
Definition: size.hpp:144