New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Lin space #2840
Lin space #2840
Conversation
as I said, I already tried that... |
Codecov Report
@@ Coverage Diff @@
## python #2840 +/- ##
======================================
Coverage 82% 82%
======================================
Files 519 519
Lines 26958 26958
======================================
Hits 22312 22312
Misses 4646 4646
Continue to review full report at Codecov.
|
The Numpy thing can easily be fixed by replacing |
this is hard to read, I'd prefer to have a utility function that wraps this logic for older numpy versions |
diff --git a/src/utils/include/utils/math/make_lin_space.hpp b/src/utils/include/utils/math/make_lin_space.hpp
index fa2198d06..6145048a3 100644
--- a/src/utils/include/utils/math/make_lin_space.hpp
+++ b/src/utils/include/utils/math/make_lin_space.hpp
@@ -45,8 +45,21 @@ auto make_lin_space(T start, T stop, size_t number, bool endpoint = true) {
using boost::make_iterator_range;
using boost::make_transform_iterator;
+ struct X {
+ using result_type = T;
+
+ T dx;
+ T start;
+
+ T operator()(size_t i) const {
+ return start + i * dx;
+ }
+ };
+
auto const dx = (stop - start) / (number - endpoint);
- auto x = [dx, start](size_t i) { return start + i * dx; };
+// auto x = [dx, start](size_t i) { return start + i * dx; };
+
+ auto const x = X{dx, start};
return make_iterator_range(
make_transform_iterator(make_counting_iterator(size_t(0)), x), |
@@ -22,19 +23,19 @@ namespace Utils { | |||
template <class T, class F> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
where is T
actually used?
bors r+ |
Build succeeded |
Maybe fixes #2837.