MVE - Multi-View Environment mve-devel
Loading...
Searching...
No Matches
ba_linear_solver.h
Go to the documentation of this file.
1/*
2 * Copyright (C) 2015, Simon Fuhrmann, Fabian Langguth
3 * TU Darmstadt - Graphics, Capture and Massively Parallel Computing
4 * All rights reserved.
5 *
6 * This software may be modified and distributed under the terms
7 * of the BSD 3-Clause license. See the LICENSE.txt file for details.
8 */
9
10#ifndef SFM_BA_LINEAR_SOLVER_HEADER
11#define SFM_BA_LINEAR_SOLVER_HEADER
12
13#include <vector>
14
15#include "sfm/defines.h"
17#include "sfm/ba_dense_vector.h"
18
21
23{
24public:
25 struct Options
26 {
27 Options (void);
28
32 };
33
34 struct Status
35 {
36 Status (void);
37
40 bool success;
41 };
42
45
46public:
47 LinearSolver (Options const& options);
48
56 Status solve (SparseMatrixType const& jac_cams,
57 SparseMatrixType const& jac_points,
58 DenseVectorType const& vector_f,
59 DenseVectorType* delta_x);
60
61private:
66 Status solve_schur (SparseMatrixType const& jac_cams,
67 SparseMatrixType const& jac_points,
68 DenseVectorType const& values,
69 DenseVectorType* delta_x);
70
78 Status solve (SparseMatrixType const& J,
79 DenseVectorType const& vector_f,
80 DenseVectorType* delta_x,
81 std::size_t block_size = 0);
82
83private:
84 Options opts;
85};
86
87/* ------------------------ Implementation ------------------------ */
88
89inline
90LinearSolver::Options::Options (void)
91 : trust_region_radius(1.0)
92 , cg_max_iterations(1000)
93{
94}
95
96inline
98 : predicted_error_decrease(0.0)
99 , num_cg_iterations(0)
100 , success(false)
101{
102}
103
104inline
106 : opts(options)
107{
108}
109
112
113#endif // SFM_BA_LINEAR_SOLVER_HEADER
114
DenseVector< double > DenseVectorType
LinearSolver(Options const &options)
SparseMatrix< double > SparseMatrixType
Sparse matrix class in Yale format for column-major matrices.
#define SFM_BA_NAMESPACE_BEGIN
Definition defines.h:22
#define SFM_NAMESPACE_END
Definition defines.h:14
#define SFM_NAMESPACE_BEGIN
Definition defines.h:13
#define SFM_BA_NAMESPACE_END
Definition defines.h:23