mirror of
https://github.com/ceres-solver/ceres-solver.git
synced 2026-08-30 00:50:37 +08:00
Run clang-format on the public headers.
Also update copyright year. Change-Id: I8508d4fd4564c646ec2281a1b3b2c36136b54b46
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
// Ceres Solver - A fast non-linear least squares minimizer
|
||||
// Copyright 2015 Google Inc. All rights reserved.
|
||||
// Copyright 2019 Google Inc. All rights reserved.
|
||||
// http://ceres-solver.org/
|
||||
//
|
||||
// Redistribution and use in source and binary forms, with or without
|
||||
@@ -98,6 +98,8 @@
|
||||
// NumericDiffCostFunction also supports cost functions with a
|
||||
// runtime-determined number of residuals. For example:
|
||||
//
|
||||
// clang-format off
|
||||
//
|
||||
// CostFunction* cost_function
|
||||
// = new NumericDiffCostFunction<MyScalarCostFunctor, CENTRAL, DYNAMIC, 2, 2>(
|
||||
// new CostFunctorWithDynamicNumResiduals(1.0), ^ ^ ^
|
||||
@@ -109,6 +111,8 @@
|
||||
// Indicate dynamic number of residuals --------------------+ | |
|
||||
// Dimension of x ------------------------------------------------+ |
|
||||
// Dimension of y ---------------------------------------------------+
|
||||
// clang-format on
|
||||
//
|
||||
//
|
||||
// The central difference method is considerably more accurate at the cost of
|
||||
// twice as many function evaluations than forward difference. Consider using
|
||||
@@ -182,9 +186,7 @@ class NumericDiffCostFunction : public SizedCostFunction<kNumResiduals, Ns...> {
|
||||
Ownership ownership = TAKE_OWNERSHIP,
|
||||
int num_residuals = kNumResiduals,
|
||||
const NumericDiffOptions& options = NumericDiffOptions())
|
||||
: functor_(functor),
|
||||
ownership_(ownership),
|
||||
options_(options) {
|
||||
: functor_(functor), ownership_(ownership), options_(options) {
|
||||
if (kNumResiduals == DYNAMIC) {
|
||||
SizedCostFunction<kNumResiduals, Ns...>::set_num_residuals(num_residuals);
|
||||
}
|
||||
@@ -210,9 +212,8 @@ class NumericDiffCostFunction : public SizedCostFunction<kNumResiduals, Ns...> {
|
||||
constexpr int kNumParameterBlocks = ParameterDims::kNumParameterBlocks;
|
||||
|
||||
// Get the function value (residuals) at the the point to evaluate.
|
||||
if (!internal::VariadicEvaluate<ParameterDims>(*functor_,
|
||||
parameters,
|
||||
residuals)) {
|
||||
if (!internal::VariadicEvaluate<ParameterDims>(
|
||||
*functor_, parameters, residuals)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -226,18 +227,19 @@ class NumericDiffCostFunction : public SizedCostFunction<kNumResiduals, Ns...> {
|
||||
ParameterDims::GetUnpackedParameters(parameters_copy.data());
|
||||
|
||||
for (int block = 0; block < kNumParameterBlocks; ++block) {
|
||||
memcpy(parameters_reference_copy[block], parameters[block],
|
||||
memcpy(parameters_reference_copy[block],
|
||||
parameters[block],
|
||||
sizeof(double) * ParameterDims::GetDim(block));
|
||||
}
|
||||
|
||||
internal::EvaluateJacobianForParameterBlocks<ParameterDims>::template Apply<
|
||||
method, kNumResiduals>(
|
||||
functor_.get(),
|
||||
residuals,
|
||||
options_,
|
||||
SizedCostFunction<kNumResiduals, Ns...>::num_residuals(),
|
||||
parameters_reference_copy.data(),
|
||||
jacobians);
|
||||
internal::EvaluateJacobianForParameterBlocks<ParameterDims>::
|
||||
template Apply<method, kNumResiduals>(
|
||||
functor_.get(),
|
||||
residuals,
|
||||
options_,
|
||||
SizedCostFunction<kNumResiduals, Ns...>::num_residuals(),
|
||||
parameters_reference_copy.data(),
|
||||
jacobians);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user