gtsam  4.0.0
gtsam
Conditional-inst.h
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 
18 // \callgraph
19 #pragma once
20 
21 #include <iostream>
22 
24 
25 namespace gtsam {
26 
27  /* ************************************************************************* */
28  template<class FACTOR, class DERIVEDFACTOR>
29  void Conditional<FACTOR,DERIVEDFACTOR>::print(const std::string& s, const KeyFormatter& formatter) const {
30  std::cout << s << " P(";
31  for(Key key: frontals())
32  std::cout << " " << formatter(key);
33  if (nrParents() > 0)
34  std::cout << " |";
35  for(Key parent: parents())
36  std::cout << " " << formatter(parent);
37  std::cout << ")" << std::endl;
38  }
39 
40  /* ************************************************************************* */
41  template<class FACTOR, class DERIVEDFACTOR>
42  bool Conditional<FACTOR,DERIVEDFACTOR>::equals(const This& c, double tol) const
43  {
44  return nrFrontals_ == c.nrFrontals_;
45  }
46 
47 }
std::uint64_t Key
Integer nonlinear key type.
Definition: types.h:57
void print(const std::string &s="Conditional", const KeyFormatter &formatter=DefaultKeyFormatter) const
print with optional formatter
Definition: Conditional-inst.h:29
boost::function< std::string(Key)> KeyFormatter
Typedef for a function to format a key, i.e. to convert it to a string.
Definition: Key.h:33
bool equals(const This &c, double tol=1e-9) const
check equality
Definition: Conditional-inst.h:42
Global functions in a separate testing namespace.
Definition: chartTesting.h:28
size_t nrFrontals_
The first nrFrontal variables are frontal and the rest are parents.
Definition: Conditional.h:44
Base class for conditional densities.