BayesTree.cpp
Go to the documentation of this file.
1 /* ----------------------------------------------------------------------------
2 
3  * GTSAM Copyright 2010, Georgia Tech Research Corporation,
4  * Atlanta, Georgia 30332-0415
5  * All Rights Reserved
6  * Authors: Frank Dellaert, et al. (see THANKS for the full author list)
7 
8  * See LICENSE for the license information
9 
10  * -------------------------------------------------------------------------- */
11 
22 
23 #include <iostream>
24 
25 namespace gtsam {
26 
27 /* ************************************************************************* */
28 void BayesTreeCliqueStats::print(const std::string& s) const {
29  std::cout << s
30  << "avg Conditional Size: " << avgConditionalSize << std::endl
31  << "max Conditional Size: " << maxConditionalSize << std::endl
32  << "avg Separator Size: " << avgSeparatorSize << std::endl
33  << "max Separator Size: " << maxSeparatorSize << std::endl;
34 }
35 
36 /* ************************************************************************* */
38 {
40 
41  double sum = 0.0;
42  size_t max = 0;
43  for(size_t s: conditionalSizes) {
44  sum += (double)s;
45  if(s > max) max = s;
46  }
47  stats.avgConditionalSize = sum / (double)conditionalSizes.size();
48  stats.maxConditionalSize = max;
49 
50  sum = 0.0;
51  max = 1;
52  for(size_t s: separatorSizes) {
53  sum += (double)s;
54  if(s > max) max = s;
55  }
56  stats.avgSeparatorSize = sum / (double)separatorSizes.size();
57  stats.maxSeparatorSize = max;
58 
59  return stats;
60 }
61 
62 }
gtsam::BayesTreeCliqueStats::maxSeparatorSize
std::size_t maxSeparatorSize
Definition: BayesTree.h:43
s
RealScalar s
Definition: level1_cplx_impl.h:126
BayesTree.h
Bayes Tree is a tree of cliques of a Bayes Chain.
gtsam::BayesTreeCliqueData::getStats
BayesTreeCliqueStats getStats() const
Definition: BayesTree.cpp:37
gtsam::BayesTreeCliqueStats
Definition: BayesTree.h:39
gtsam::BayesTreeCliqueStats::maxConditionalSize
std::size_t maxConditionalSize
Definition: BayesTree.h:41
gtsam::BayesTreeCliqueData::conditionalSizes
FastVector< std::size_t > conditionalSizes
Definition: BayesTree.h:49
gtsam::BayesTreeCliqueStats::avgConditionalSize
double avgConditionalSize
Definition: BayesTree.h:40
gtsam::BayesTreeCliqueStats::print
void print(const std::string &s="") const
Definition: BayesTree.cpp:28
stats
bool stats
Definition: SolverComparer.cpp:100
gtsam::BayesTreeCliqueData::separatorSizes
FastVector< std::size_t > separatorSizes
Definition: BayesTree.h:50
gtsam::BayesTreeCliqueStats::avgSeparatorSize
double avgSeparatorSize
Definition: BayesTree.h:42
gtsam
traits
Definition: SFMdata.h:40
max
#define max(a, b)
Definition: datatypes.h:20


gtsam
Author(s):
autogenerated on Sat Nov 16 2024 04:01:54