discrete folder
parent
18562e97ae
commit
3ebada2dc4
|
@ -26,6 +26,7 @@
|
|||
#include <string>
|
||||
#include <typeinfo>
|
||||
#include <exception>
|
||||
#include <optional>
|
||||
|
||||
#ifdef GTSAM_USE_TBB
|
||||
#include <tbb/tbb_allocator.h>
|
||||
|
@ -53,7 +54,7 @@ protected:
|
|||
|
||||
protected:
|
||||
bool dynamic_; ///< Whether this object was moved
|
||||
mutable boost::optional<String> description_; ///< Optional description
|
||||
mutable std::optional<String> description_; ///< Optional description
|
||||
|
||||
/// Default constructor is protected - may only be created from derived classes
|
||||
ThreadsafeException() :
|
||||
|
|
|
@ -24,7 +24,6 @@
|
|||
#include <algorithm>
|
||||
#include <boost/format.hpp>
|
||||
#include <boost/make_shared.hpp>
|
||||
#include <boost/optional.hpp>
|
||||
|
||||
#include <cmath>
|
||||
#include <fstream>
|
||||
|
@ -34,6 +33,7 @@
|
|||
#include <sstream>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
#include <optional>
|
||||
|
||||
namespace gtsam {
|
||||
|
||||
|
@ -563,7 +563,7 @@ namespace gtsam {
|
|||
typename DecisionTree<L, Y>::NodePtr DecisionTree<L, Y>::compose(
|
||||
Iterator begin, Iterator end, const L& label) const {
|
||||
// find highest label among branches
|
||||
boost::optional<L> highestLabel;
|
||||
std::optional<L> highestLabel;
|
||||
size_t nrChoices = 0;
|
||||
for (Iterator it = begin; it != end; it++) {
|
||||
if (it->root_->isLeaf())
|
||||
|
@ -571,7 +571,7 @@ namespace gtsam {
|
|||
boost::shared_ptr<const Choice> c =
|
||||
boost::dynamic_pointer_cast<const Choice>(it->root_);
|
||||
if (!highestLabel || c->label() > *highestLabel) {
|
||||
highestLabel.reset(c->label());
|
||||
highestLabel = c->label();
|
||||
nrChoices = c->nrChoices();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -137,14 +137,14 @@ namespace gtsam {
|
|||
}
|
||||
|
||||
Signature& Signature::operator=(const string& spec) {
|
||||
spec_.reset(spec);
|
||||
spec_ = spec;
|
||||
Table table;
|
||||
parser::It f = spec.begin(), l = spec.end();
|
||||
bool success =
|
||||
qi::phrase_parse(f, l, parser::grammar.table, qi::space, table);
|
||||
if (success) {
|
||||
for (Row& row : table) normalize(row);
|
||||
table_.reset(table);
|
||||
table_ = table;
|
||||
}
|
||||
return *this;
|
||||
}
|
||||
|
@ -153,7 +153,7 @@ namespace gtsam {
|
|||
Table table = t;
|
||||
for(Row& row: table)
|
||||
normalize(row);
|
||||
table_.reset(table);
|
||||
table_ = table;
|
||||
return *this;
|
||||
}
|
||||
|
||||
|
|
|
@ -19,7 +19,7 @@
|
|||
#pragma once
|
||||
#include <string>
|
||||
#include <vector>
|
||||
#include <boost/optional.hpp>
|
||||
#include <optional>
|
||||
#include <gtsam/discrete/DiscreteKey.h>
|
||||
|
||||
namespace gtsam {
|
||||
|
@ -68,10 +68,10 @@ namespace gtsam {
|
|||
DiscreteKeys parents_;
|
||||
|
||||
// the given CPT specification string
|
||||
boost::optional<std::string> spec_;
|
||||
std::optional<std::string> spec_;
|
||||
|
||||
// the CPT as parsed, if successful
|
||||
boost::optional<Table> table_;
|
||||
std::optional<Table> table_;
|
||||
|
||||
public:
|
||||
/**
|
||||
|
@ -124,7 +124,7 @@ namespace gtsam {
|
|||
KeyVector indices() const;
|
||||
|
||||
// the CPT as parsed, if successful
|
||||
const boost::optional<Table>& table() const { return table_; }
|
||||
const std::optional<Table>& table() const { return table_; }
|
||||
|
||||
// the CPT as a vector of doubles, with key's values most rapidly changing
|
||||
std::vector<double> cpt() const;
|
||||
|
|
Loading…
Reference in New Issue