g2o
Loading...
Searching...
No Matches
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
29#include <cstring>
30
31namespace g2o {
32using namespace std;
33
34G2OBatchStatistics* G2OBatchStatistics::_globalStats = 0;
35
36#ifndef PTHING
37#define PTHING(s) #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
48std::ostream& operator<<(std::ostream& os, const G2OBatchStatistics& st) {
49 os << PTHING(iteration);
50
51 os << PTHING(numVertices); // how many vertices are involved
52 os << PTHING(numEdges); // hoe many edges
53 os << PTHING(chi2); // total chi2
54
56 // nonlinear part
57 os << PTHING(timeResiduals);
58 os << PTHING(timeLinearize); // jacobians
59 os << PTHING(timeQuadraticForm); // construct the quadratic form in the graph
60
61 // block_solver (constructs Ax=b, plus maybe schur);
62 os << PTHING(
63 timeSchurComplement); // compute schur complement (0 if not done);
64
65 // linear solver (computes Ax=b); );
66 os << PTHING(
67 timeSymbolicDecomposition); // symbolic decomposition (0 if not done);
68 os << PTHING(
69 timeNumericDecomposition); // numeric decomposition (0 if not done);
70 os << PTHING(timeLinearSolution); // total time for solving Ax=b
71 os << PTHING(iterationsLinearSolver); // iterations of PCG
72 os << PTHING(timeUpdate); // oplus
73 os << PTHING(timeIteration); // total time );
74
75 os << PTHING(levenbergIterations);
76 os << PTHING(timeLinearSolver);
77
78 os << PTHING(hessianDimension);
79 os << PTHING(hessianPoseDimension);
80 os << PTHING(hessianLandmarkDimension);
81 os << PTHING(choleskyNNZ);
82 os << PTHING(timeMarginals);
83
84 return os;
85};
86
90
91} // namespace g2o
#define PTHING(s)
std::ostream & operator<<(std::ostream &os, const G2OBatchStatistics &st)
Definition jet.h:876
statistics about the optimization
Definition batch_stats.h:40
int iteration
which iteration
Definition batch_stats.h:42
static void setGlobalStats(G2OBatchStatistics *b)
static G2OBatchStatistics * _globalStats
Definition batch_stats.h:81