Skip to content

Commit cb3770e

Browse files
committed
Grid search uses Eigen::Matrix to store data according to other optimization schemes. Fixed minor bug in grid search scheme.
1 parent 027432d commit cb3770e

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

fdaPDE/src/optimization/grid_search.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ namespace fdapde {
2323

2424
template <int N> class GridSearch {
2525
private:
26-
using vector_t = std::conditional_t<N == Dynamic, std::vector<double>, std::array<double, N>>;
26+
using vector_t = std::conditional_t<N == Dynamic, Eigen::Matrix<double, Dynamic, 1>, Eigen::Matrix<double, N, 1>>;
2727
using grid_t = MdMap<const double, MdExtents<Dynamic, Dynamic>>;
2828

2929
vector_t optimum_;
@@ -64,6 +64,7 @@ template <int N> class GridSearch {
6464
grid_.row(0).assign_to(x_curr);
6565
obj_curr = objective(x_curr);
6666
stop |= internals::exec_eval_hooks(*this, objective, callbacks_);
67+
values_.clear();
6768
values_.push_back(obj_curr);
6869
if (obj_curr < value_) {
6970
value_ = obj_curr;

0 commit comments

Comments
 (0)