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 }
gtsam::Signature::Table
std::vector< Row > Table
Definition: Signature.h:60
operator,
Eigen::CommaInitializer< XprType > & operator,(Eigen::CommaInitializer< XprType > &ci, double v)
Definition: special_functions.cpp:21
gtsam::Signature::key
const DiscreteKey & key() const
Definition: Signature.h:115
s
RealScalar s
Definition: level1_cplx_impl.h:126
gtsam::operator<<
std::ostream & operator<<(std::ostream &os, const Dih6 &m)
Definition: testGroup.cpp:109
gtsam::Signature::table_
std::optional< Table > table_
Definition: Signature.h:74
gtsam::operator%
Signature operator%(const DiscreteKey &key, const string &parent)
Definition: Signature.cpp:134
gtsam::Signature::spec_
std::optional< std::string > spec_
Definition: Signature.h:71
gtsam::Signature::Row
std::vector< double > Row
Definition: Signature.h:59
gtsam::DiscreteKeys
DiscreteKeys is a set of keys that can be assembled using the & operator.
Definition: DiscreteKey.h:41
os
ofstream os("timeSchurFactors.csv")
gtsam::KeyVector
FastVector< Key > KeyVector
Define collection type once and for all - also used in wrappers.
Definition: Key.h:92
test_eigen_tensor.indices
indices
Definition: test_eigen_tensor.py:33
table
ArrayXXf table(10, 4)
gtsam::Table
std::vector< Row > Table
Definition: SignatureParser.cpp:10
DiscreteKey.h
specialized key for discrete variables
key
const gtsam::Symbol key('X', 0)
gtsam::Signature::key_
DiscreteKey key_
Definition: Signature.h:65
gtsam
traits
Definition: SFMdata.h:40
gtsam::operator|
Signature operator|(const DiscreteKey &key, const DiscreteKey &parent)
Definition: Signature.cpp:129
gtsam::DiscreteKey
std::pair< Key, size_t > DiscreteKey
Definition: DiscreteKey.h:38
gtsam::Signature::parents_
DiscreteKeys parents_
Definition: Signature.h:68
gtsam::Signature::parents
const DiscreteKeys & parents() const
Definition: Signature.h:118
gtsam::Signature
Definition: Signature.h:54
gtsam::Signature::table
const std::optional< Table > & table() const
Definition: Signature.h:127


gtsam
Author(s):
autogenerated on Fri Nov 1 2024 03:35:16