12 using auto_const_t =
typename Base::template auto_const_t<U>;
15 using SegmentVector = Eigen::Matrix<T, N, 1>;
22 using ThisViewer = std::conditional_t<IsConst, ConstViewer, NonConstViewer>;
26 int m_total_segment_count = 0;
29 int m_doublet_index_offset = 0;
30 int m_doublet_count = 0;
31 int m_total_doublet_count = 0;
34 int m_subvector_offset = 0;
35 int m_subvector_extent = 0;
38 auto_const_t<int>* m_segment_indices;
39 auto_const_t<SegmentVector>* m_segment_values;
44 int doublet_index_offset,
46 int total_doublet_count,
51 auto_const_t<int>* segment_indices,
52 auto_const_t<SegmentVector>* segment_values)
53 : m_total_segment_count(total_segment_count)
54 , m_doublet_index_offset(doublet_index_offset)
55 , m_doublet_count(doublet_count)
56 , m_total_doublet_count(total_doublet_count)
57 , m_subvector_offset(subvector_offset)
58 , m_subvector_extent(subvector_extent)
59 , m_segment_indices(segment_indices)
60 , m_segment_values(segment_values)
62 MUDA_KERNEL_ASSERT(doublet_index_offset + doublet_count <= total_doublet_count,
63 "DoubletVectorView: out of range, m_total_doublet_count=%d, "
64 "your doublet_index_offset=%d, doublet_count=%d",
65 m_total_doublet_count,
69 MUDA_KERNEL_ASSERT(subvector_offset + subvector_extent <= total_segment_count,
70 "DoubletVectorView: out of range, m_total_segment_count=%d, "
71 "your subvector_offset=%d, subvector_extent=%d",
72 m_total_segment_count,
78 int total_doublet_count,
79 auto_const_t<int>* segment_indices,
80 auto_const_t<SegmentVector>* segment_values)
94 MUDA_GENERIC
ConstView as_const()
const noexcept
97 m_doublet_index_offset,
99 m_total_doublet_count,
106 MUDA_GENERIC
operator ConstView()
const noexcept {
return as_const(); }
110 MUDA_GENERIC
ThisView subview(
int offset,
int count)
const noexcept
113 MUDA_KERNEL_ASSERT(offset + count <= m_doublet_count,
114 "DoubletVectorView : offset is out of range, size=%d, your offset=%d",
118 return ThisView{m_total_segment_count,
119 m_doublet_index_offset + offset,
121 m_total_doublet_count,
128 MUDA_GENERIC
ThisView subview(
int offset)
const noexcept
130 return subview(offset, m_doublet_count - offset);
133 MUDA_GENERIC
auto subvector(
int offset,
int extent)
const noexcept
135 MUDA_KERNEL_ASSERT(offset + extent <= m_subvector_extent,
136 "DoubletVectorView : subvector out of range, extent=%d, your offset=%d, your extent=%d",
141 return ThisView{m_total_segment_count,
142 m_doublet_index_offset,
144 m_total_doublet_count,
145 m_subvector_offset + offset,
151 MUDA_GENERIC ThisViewer viewer()
noexcept
153 return ThisViewer{m_total_segment_count,
154 m_doublet_index_offset,
156 m_total_doublet_count,
166 m_doublet_index_offset,
168 m_total_doublet_count,
175 MUDA_GENERIC
int extent()
const noexcept {
return m_subvector_extent; }
177 MUDA_GENERIC
int total_extent()
const noexcept
179 return m_total_segment_count;
182 MUDA_GENERIC
int subvector_offset()
const noexcept
184 return m_subvector_offset;
187 MUDA_GENERIC
int doublet_count()
const noexcept {
return m_doublet_count; }
188 MUDA_GENERIC
int total_doublet_count()
const noexcept
190 return m_total_doublet_count;
199 template <
typename U>
200 using auto_const_t =
typename Base::template auto_const_t<U>;
208 using ThisViewer = std::conditional_t<IsConst, ConstViewer, NonConstViewer>;
211 int m_total_count = 0;
213 int m_doublet_index_offset = 0;
214 int m_doublet_count = 0;
215 int m_total_doublet_count = 0;
217 int m_subvector_offset = 0;
218 int m_subvector_extent = 0;
220 auto_const_t<int>* m_indices;
221 auto_const_t<T>* m_values;
227 int doublet_index_offset,
229 int total_doublet_count,
230 int subvector_offset,
231 int subvector_extent,
232 auto_const_t<int>* indices,
233 auto_const_t<T>* values)
234 : m_total_count(total_count)
235 , m_doublet_index_offset(doublet_index_offset)
236 , m_doublet_count(doublet_count)
237 , m_total_doublet_count(total_doublet_count)
238 , m_subvector_offset(subvector_offset)
239 , m_subvector_extent(subvector_extent)
243 MUDA_KERNEL_ASSERT(doublet_index_offset + doublet_count <= total_doublet_count,
244 "DoubletVectorView: out of range, m_total_count=%d, "
245 "your doublet_index_offset=%d, doublet_count=%d",
246 m_total_doublet_count,
247 doublet_index_offset,
250 MUDA_KERNEL_ASSERT(subvector_offset + subvector_extent <= total_count,
251 "DoubletVectorView: out of range, m_total_count=%d, "
252 "your subvector_offset=%d, subvector_extent=%d",
259 int total_doublet_count,
260 auto_const_t<int>* indices,
261 auto_const_t<T>* values)
263 total_count, 0, total_doublet_count, total_doublet_count, 0, total_count, indices, values)
269 MUDA_GENERIC
ConstView as_const()
const noexcept
272 m_doublet_index_offset,
274 m_total_doublet_count,
281 MUDA_GENERIC
operator ConstView()
const noexcept {
return as_const(); }
285 MUDA_GENERIC
auto subview(
int offset,
int count)
const noexcept
287 MUDA_KERNEL_ASSERT(offset + count <= m_doublet_count,
288 "DoubletVectorView : offset is out of range, size=%d, your offset=%d",
293 m_doublet_index_offset + offset,
295 m_total_doublet_count,
302 MUDA_GENERIC
auto subview(
int offset)
const noexcept
304 return subview(offset, m_doublet_count - offset);
307 MUDA_GENERIC
auto subvector(
int offset,
int extent)
const noexcept
309 MUDA_KERNEL_ASSERT(offset + extent <= m_subvector_extent,
310 "DoubletVectorView : subvector out of range, extent=%d, your offset=%d, your extent=%d",
316 m_doublet_index_offset,
318 m_total_doublet_count,
319 m_subvector_offset + offset,
325 MUDA_GENERIC ThisViewer viewer()
noexcept
327 return ThisViewer{m_total_count,
328 m_doublet_index_offset,
330 m_total_doublet_count,
342 m_doublet_index_offset,
344 m_total_doublet_count,
352 MUDA_GENERIC
int doublet_count()
const noexcept {
return m_doublet_count; }
353 MUDA_GENERIC
int total_doublet_count()
const noexcept
355 return m_total_doublet_count;
358 MUDA_GENERIC
int extent()
const noexcept {
return m_subvector_extent; }
359 MUDA_GENERIC
int total_extent()
const noexcept {
return m_total_count; }
361 MUDA_GENERIC
int subvector_offset()
const noexcept
363 return m_subvector_offset;