mirror of
https://github.com/ceres-solver/ceres-solver.git
synced 2026-08-29 08:34:37 +08:00
Refactor FunctionSample & LineSearchFunction
1. Move FunctionSample to its own .h/.cc files. 2. Migrate LineSearchFunction::Evaluate to use FunctionSample for input and output. Change-Id: I8bfb97e1900d95a4686c9621dda5b584458b45c0
This commit is contained in:
@@ -32,7 +32,6 @@
|
||||
#ifndef CERES_INTERNAL_POLYNOMIAL_SOLVER_H_
|
||||
#define CERES_INTERNAL_POLYNOMIAL_SOLVER_H_
|
||||
|
||||
#include <string>
|
||||
#include <vector>
|
||||
#include "ceres/internal/eigen.h"
|
||||
#include "ceres/internal/port.h"
|
||||
@@ -40,6 +39,8 @@
|
||||
namespace ceres {
|
||||
namespace internal {
|
||||
|
||||
struct FunctionSample;
|
||||
|
||||
// All polynomials are assumed to be the form
|
||||
//
|
||||
// sum_{i=0}^N polynomial(i) x^{N-i}.
|
||||
@@ -84,27 +85,6 @@ void MinimizePolynomial(const Vector& polynomial,
|
||||
double* optimal_x,
|
||||
double* optimal_value);
|
||||
|
||||
// Structure for storing sample values of a function.
|
||||
//
|
||||
// Clients can use this struct to communicate the value of the
|
||||
// function and or its gradient at a given point x.
|
||||
struct FunctionSample {
|
||||
FunctionSample()
|
||||
: x(0.0),
|
||||
value(0.0),
|
||||
value_is_valid(false),
|
||||
gradient(0.0),
|
||||
gradient_is_valid(false) {
|
||||
}
|
||||
std::string ToDebugString() const;
|
||||
|
||||
double x;
|
||||
double value; // value = f(x)
|
||||
bool value_is_valid;
|
||||
double gradient; // gradient = f'(x)
|
||||
bool gradient_is_valid;
|
||||
};
|
||||
|
||||
// Given a set of function value and/or gradient samples, find a
|
||||
// polynomial whose value and gradients are exactly equal to the ones
|
||||
// in samples.
|
||||
|
||||
Reference in New Issue
Block a user