gtsam  4.1.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 }
gtsam::Conditional
TODO: Update comments.
Definition: Conditional.h:41
gtsam::Key
std::uint64_t Key
Integer nonlinear key type.
Definition: types.h:61
gtsam::Conditional::print
void print(const std::string &s="Conditional", const KeyFormatter &formatter=DefaultKeyFormatter) const
print with optional formatter
Definition: Conditional-inst.h:29
gtsam
Global functions in a separate testing namespace.
Definition: chartTesting.h:28
gtsam::Conditional::equals
bool equals(const This &c, double tol=1e-9) const
check equality
Definition: Conditional-inst.h:42
gtsam::KeyFormatter
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:35
Conditional.h
Base class for conditional densities.
gtsam::Conditional::nrFrontals_
size_t nrFrontals_
The first nrFrontal variables are frontal and the rest are parents.
Definition: Conditional.h:44