File tree Expand file tree Collapse file tree 1 file changed +10
-5
lines changed
Common/MathUtils/include/MathUtils Expand file tree Collapse file tree 1 file changed +10
-5
lines changed Original file line number Diff line number Diff line change @@ -259,6 +259,14 @@ struct meta_matrix_dot<0> {
259259
260260namespace row_offsets_utils
261261{
262+ template <unsigned int D>
263+ struct proxy_offset {
264+ static constexpr int off0 (int i) { return i == 0 ? 0 : off0 (i - 1 ) + i; }
265+ static constexpr int off2 (int i, int j) { return j < i ? off0 (i) + j : off0 (j) + i; }
266+ static constexpr int off1 (int i) { return off2 (i / D, i % D); }
267+ int operator ()(int i) const { return off1 (i); }
268+ };
269+
262270template <int ...>
263271struct indices {
264272};
@@ -352,13 +360,10 @@ class MatRepSymGPU
352360 kSize = D * (D + 1 ) / 2 // rows*columns
353361 };
354362
355- static constexpr int off0 (int i) { return i == 0 ? 0 : off0 (i - 1 ) + i; }
356- static constexpr int off2 (int i, int j) { return j < i ? off0 (i) + j : off0 (j) + i; }
357- static constexpr int off1 (int i) { return off2 (i / D, i % D); }
358-
359363 static GPUdi () int off(int i)
360364 {
361- static constexpr auto v = row_offsets_utils::make<D * D>(off1);
365+ row_offsets_utils::proxy_offset<D> proxy;
366+ static constexpr auto v = row_offsets_utils::make<D * D>(proxy);
362367 return v[i];
363368 }
364369
You can’t perform that action at this time.
0 commit comments