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 }
#define max(a, b)
Definition: datatypes.h:20
BayesTreeCliqueStats getStats() const
Definition: BayesTree.cpp:37
std::size_t maxSeparatorSize
Definition: BayesTree.h:41
bool stats
void print(const std::string &s="") const
Definition: BayesTree.cpp:28
const mpreal sum(const mpreal tab[], const unsigned long int n, int &status, mp_rnd_t mode=mpreal::get_default_rnd())
Definition: mpreal.h:2381
RealScalar s
Bayes Tree is a tree of cliques of a Bayes Chain.
traits
Definition: chartTesting.h:28
std::size_t maxConditionalSize
Definition: BayesTree.h:39


gtsam
Author(s):
autogenerated on Sat May 8 2021 02:41:41