OrcaSlicer/deps_src/libigl/igl/grid_search.h
SoftFever 883607e1d4
Refactor folder (#10475)
Move many third-party components' source codes from the src folder to a new folder called deps_src. The goal is to make the code structure clearer and easier to navigate.
2025-08-22 20:02:26 +08:00

42 lines
969 B
C++

#ifndef IGL_GRID_SEARCH_H
#define IGL_GRID_SEARCH_H
#include "igl_inline.h"
#include <Eigen/Core>
#include <functional>
namespace igl
{
// Solve the problem:
//
// minimize f(x)
// subject to lb ≤ x ≤ ub
//
// by exhaustive grid search.
//
// Inputs:
// f function to minimize
// LB #X vector of finite lower bounds
// UB #X vector of finite upper bounds
// I #X vector of number of steps for each variable
// Outputs:
// X #X optimal parameter vector
// Returns f(X)
//
template <
typename Scalar,
typename DerivedX,
typename DerivedLB,
typename DerivedUB,
typename DerivedI>
IGL_INLINE Scalar grid_search(
const std::function< Scalar (DerivedX &) > f,
const Eigen::MatrixBase<DerivedLB> & LB,
const Eigen::MatrixBase<DerivedUB> & UB,
const Eigen::MatrixBase<DerivedI> & I,
DerivedX & X);
}
#ifndef IGL_STATIC_LIBRARY
# include "grid_search.cpp"
#endif
#endif