ACloudViewer  3.9.4
A Modern Library for 3D Data Processing
least_absolute_deviations.h
Go to the documentation of this file.
1 // ----------------------------------------------------------------------------
2 // - CloudViewer: www.cloudViewer.org -
3 // ----------------------------------------------------------------------------
4 // Copyright (c) 2018-2024 www.cloudViewer.org
5 // SPDX-License-Identifier: MIT
6 // ----------------------------------------------------------------------------
7 
8 #pragma once
9 
10 #include <Eigen/Core>
11 #include <Eigen/SparseCore>
12 
13 #include "util/logging.h"
14 
15 namespace colmap {
16 
18  // Augmented Lagrangian parameter.
19  double rho = 1.0;
20 
21  // Over-relaxation parameter, typical values are between 1.0 and 1.8.
22  double alpha = 1.0;
23 
24  // Maximum solver iterations.
25  int max_num_iterations = 1000;
26 
27  // Absolute and relative solution thresholds, as suggested by Boyd et al.
28  double absolute_tolerance = 1e-4;
29  double relative_tolerance = 1e-2;
30 };
31 
32 // Least absolute deviations (LAD) fitting via ADMM by solving the problem:
33 //
34 // min || A x - b ||_1
35 //
36 // The solution is returned in the vector x and the iterative solver is
37 // initialized with the given value. This implementation is based on the paper
38 // "Distributed Optimization and Statistical Learning via the Alternating
39 // Direction Method of Multipliers" by Boyd et al. and the Matlab implementation
40 // at https://web.stanford.edu/~boyd/papers/admm/least_abs_deviations/lad.html
42  const Eigen::SparseMatrix<double>& A,
43  const Eigen::VectorXd& b,
44  Eigen::VectorXd* x);
45 
46 } // namespace colmap
const double * e
normal_z x
bool SolveLeastAbsoluteDeviations(const LeastAbsoluteDeviationsOptions &options, const Eigen::SparseMatrix< double > &A, const Eigen::VectorXd &b, Eigen::VectorXd *x)