batch_stats.cpp
Go to the documentation of this file.
1 // g2o - General Graph Optimization
2 // Copyright (C) 2011 R. Kuemmerle, G. Grisetti, W. Burgard
3 // All rights reserved.
4 //
5 // Redistribution and use in source and binary forms, with or without
6 // modification, are permitted provided that the following conditions are
7 // met:
8 //
9 // * Redistributions of source code must retain the above copyright notice,
10 // this list of conditions and the following disclaimer.
11 // * Redistributions in binary form must reproduce the above copyright
12 // notice, this list of conditions and the following disclaimer in the
13 // documentation and/or other materials provided with the distribution.
14 //
15 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
16 // IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
17 // TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
18 // PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
19 // HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
20 // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
21 // TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
22 // PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
23 // LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
24 // NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25 // SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 
27 #include "batch_stats.h"
28 #include <cstring>
29 
30 namespace g2o {
31  using namespace std;
32 
33  G2OBatchStatistics* G2OBatchStatistics::_globalStats=0;
34 
35  #ifndef PTHING
36  #define PTHING(s) \
37  #s << "= " << (st.s) << "\t "
38  #endif
39 
41  // zero all.
42  memset (this, 0, sizeof(G2OBatchStatistics));
43 
44  // set the iteration to -1 to show that it isn't valid
45  iteration = -1;
46  }
47 
48  std::ostream& operator << (std::ostream& os , const G2OBatchStatistics& st)
49  {
50  os << PTHING(iteration);
51 
52  os << PTHING( numVertices ); // how many vertices are involved
53  os << PTHING( numEdges ); // hoe many edges
54  os << PTHING( chi2 ); // total chi2
55 
57  // nonlinear part
58  os << PTHING( timeResiduals );
59  os << PTHING( timeLinearize ); // jacobians
60  os << PTHING( timeQuadraticForm ); // construct the quadratic form in the graph
61 
62  // block_solver (constructs Ax=b, plus maybe schur);
63  os << PTHING( timeSchurComplement ); // compute schur complement (0 if not done);
64 
65  // linear solver (computes Ax=b); );
66  os << PTHING( timeSymbolicDecomposition ); // symbolic decomposition (0 if not done);
67  os << PTHING( timeNumericDecomposition ); // numeric decomposition (0 if not done);
68  os << PTHING( timeLinearSolution ); // total time for solving Ax=b
69  os << PTHING( iterationsLinearSolver ); // iterations of PCG
70  os << PTHING( timeUpdate ); // oplus
71  os << PTHING( timeIteration ); // total time );
72 
73  os << PTHING( levenbergIterations );
74  os << PTHING( timeLinearSolver);
75 
76  os << PTHING(hessianDimension);
77  os << PTHING(hessianPoseDimension);
78  os << PTHING(hessianLandmarkDimension);
79  os << PTHING(choleskyNNZ);
80  os << PTHING(timeMarginals);
81 
82  return os;
83  };
84 
86  {
87  _globalStats = b;
88  }
89 
90 } // end namespace
statistics about the optimization
Definition: batch_stats.h:39
static G2OBatchStatistics * _globalStats
Definition: batch_stats.h:75
#define PTHING(s)
Definition: batch_stats.cpp:36
std::ostream & operator<<(std::ostream &os, const G2OBatchStatistics &st)
Definition: batch_stats.cpp:48
static void setGlobalStats(G2OBatchStatistics *b)
Definition: batch_stats.cpp:85


orb_slam2_ros
Author(s):
autogenerated on Wed Apr 21 2021 02:53:05