Signature.h
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 
19 #pragma once
20 #include <string>
21 #include <vector>
22 #include <optional>
24 
25 namespace gtsam {
26 
54  class GTSAM_EXPORT Signature {
55 
56  public:
57 
59  typedef std::vector<double> Row;
60  typedef std::vector<Row> Table;
61 
62  private:
63 
66 
69 
70  // the given CPT specification string
71  std::optional<std::string> spec_;
72 
73  // the CPT as parsed, if successful
74  std::optional<Table> table_;
75 
76  public:
88  Signature(const DiscreteKey& key, const DiscreteKeys& parents,
89  const Table& table);
90 
102  Signature(const DiscreteKey& key, const DiscreteKeys& parents,
103  const std::string& spec);
104 
112  Signature(const DiscreteKey& key);
113 
115  const DiscreteKey& key() const { return key_; }
116 
118  const DiscreteKeys& parents() const { return parents_; }
119 
121  DiscreteKeys discreteKeys() const;
122 
124  KeyVector indices() const;
125 
126  // the CPT as parsed, if successful
127  const std::optional<Table>& table() const { return table_; }
128 
129  // the CPT as a vector of doubles, with key's values most rapidly changing
130  std::vector<double> cpt() const;
131 
133  Signature& operator,(const DiscreteKey& parent);
134 
136  Signature& operator=(const std::string& spec);
137 
139  Signature& operator=(const Table& table);
140 
142  GTSAM_EXPORT friend std::ostream& operator<<(std::ostream& os,
143  const Signature& s);
144  };
145 
150  GTSAM_EXPORT Signature operator|(const DiscreteKey& key, const DiscreteKey& parent);
151 
156  GTSAM_EXPORT Signature operator%(const DiscreteKey& key, const std::string& parent);
157 
162  GTSAM_EXPORT Signature operator%(const DiscreteKey& key, const Signature::Table& parent);
163 
164 }
const gtsam::Symbol key('X', 0)
Eigen::CommaInitializer< XprType > & operator,(Eigen::CommaInitializer< XprType > &ci, double v)
std::ostream & operator<<(std::ostream &os, const Dih6 &m)
Definition: testGroup.cpp:109
DiscreteKey key_
Definition: Signature.h:65
const DiscreteKey & key() const
Definition: Signature.h:115
DiscreteKeys parents_
Definition: Signature.h:68
std::vector< Row > Table
Definition: Signature.h:60
const DiscreteKeys & parents() const
Definition: Signature.h:118
std::optional< std::string > spec_
Definition: Signature.h:71
RealScalar s
const std::optional< Table > & table() const
Definition: Signature.h:127
Signature operator%(const DiscreteKey &key, const string &parent)
Definition: Signature.cpp:134
std::vector< double > Row
Definition: Signature.h:59
std::optional< Table > table_
Definition: Signature.h:74
traits
Definition: chartTesting.h:28
specialized key for discrete variables
ofstream os("timeSchurFactors.csv")
ArrayXXf table(10, 4)
std::pair< Key, size_t > DiscreteKey
Definition: DiscreteKey.h:38
Signature operator|(const DiscreteKey &key, const DiscreteKey &parent)
Definition: Signature.cpp:129
FastVector< Key > KeyVector
Define collection type once and for all - also used in wrappers.
Definition: Key.h:86
DiscreteKeys is a set of keys that can be assembled using the & operator.
Definition: DiscreteKey.h:41


gtsam
Author(s):
autogenerated on Tue Jul 4 2023 02:35:43