ext/cumo/narray/gen/tmpl/accum_index.c in cumo-0.1.2 vs ext/cumo/narray/gen/tmpl/accum_index.c in cumo-0.2.0
- old
+ new
@@ -111,9 +111,14 @@
<% else %>
reduce = cumo_na_reduce_dimension(argc, argv, 1, &self, &ndf, 0);
<% end %>
}
- return cumo_na_ndloop(&ndf, 2, self, reduce);
+ if (cumo_na_has_idx_p(self)) {
+ VALUE copy = cumo_na_copy(self); // reduction does not support idx, make conttiguous
+ return cumo_na_ndloop(&ndf, 2, copy, reduce);
+ } else {
+ return cumo_na_ndloop(&ndf, 2, self, reduce);
+ }
}
<% end %>
}