22 #include <gtsam/dllexport.h> 24 #ifdef GTSAM_ENABLE_BOOST_SERIALIZATION 25 #include <boost/serialization/version.hpp> 26 #include <boost/serialization/nvp.hpp> 33 namespace serialization {
41 class GaussianFactorGraph;
42 struct PreconditionerParameters;
54 #ifdef GTSAM_ENABLE_BOOST_SERIALIZATION 55 friend class boost::serialization::access;
56 template <
class Archive>
57 void serialize(Archive &ar,
const unsigned int ) {
58 ar &BOOST_SERIALIZATION_NVP(index);
59 ar &BOOST_SERIALIZATION_NVP(weight);
64 typedef std::vector<Edge>
Edges;
76 Subgraph(
const std::vector<size_t> &indices);
78 inline const Edges &
edges()
const {
return edges_; }
79 inline size_t size()
const {
return edges_.size(); }
80 EdgeIndices edgeIndices()
const;
82 iterator
begin() {
return edges_.begin(); }
83 const_iterator
begin()
const {
return edges_.begin(); }
84 iterator
end() {
return edges_.end(); }
85 const_iterator
end()
const {
return edges_.end(); }
90 #ifdef GTSAM_ENABLE_BOOST_SERIALIZATION 91 friend class boost::serialization::access;
92 template <
class Archive>
93 void serialize(Archive &ar,
const unsigned int ) {
94 ar &BOOST_SERIALIZATION_NVP(edges_);
96 void save(
const std::string &fn)
const;
97 static Subgraph load(
const std::string &fn);
103 typedef std::shared_ptr<SubgraphBuilderParameters>
shared_ptr;
126 } augmentationWeight;
132 : skeletonType(KRUSKAL),
133 skeletonWeight(RANDOM),
134 augmentationWeight(SKELETON),
135 augmentationFactor(1.0) {}
140 virtual void print(std::ostream &
os)
const;
141 friend std::ostream &
operator<<(std::ostream &os,
144 static Skeleton skeletonTranslator(
const std::string &
s);
145 static std::string skeletonTranslator(
Skeleton s);
146 static SkeletonWeight skeletonWeightTranslator(
const std::string &s);
166 const std::vector<double> &weights)
const;
171 const std::vector<double> &weights)
const;
172 std::vector<size_t> sample(
const std::vector<double> &weights,
173 const size_t t)
const;
vector< MFAS::KeyPair > edges
const Edges & edges() const
Typedefs for easier changing of types.
std::string serialize(const T &input)
serializes to a string
const_iterator end() const
virtual ~SubgraphBuilder()
bool isUnitWeight() const
EIGEN_STRONG_INLINE Packet4f print(const Packet4f &a)
std::shared_ptr< SubgraphBuilderParameters > shared_ptr
std::vector< size_t > kruskal(const FactorGraph< FACTOR > &fg, const std::vector< double > &weights)
Subgraph(const Edges &edges)
std::vector< Edge > Edges
std::vector< size_t > EdgeIndices
std::ostream & operator<<(std::ostream &s, const Jet< T, N > &z)
double augmentationFactor
factor multiplied with n, yields number of extra edges.
std::vector< double > Weights
SubgraphBuilder(const SubgraphBuilderParameters &p=SubgraphBuilderParameters())
Subgraph(const Subgraph &subgraph)
Edges::const_iterator const_iterator
const_iterator begin() const
GaussianFactorGraph buildFactorSubgraph(const GaussianFactorGraph &gfg, const Subgraph &subgraph, const bool clone)
SubgraphBuilderParameters()
A thin wrapper around std::map that uses boost's fast_pool_allocator.
ofstream os("timeSchurFactors.csv")
std::pair< GaussianFactorGraph, GaussianFactorGraph > splitFactorGraph(const GaussianFactorGraph &factorGraph, const Subgraph &subgraph)
SubgraphBuilderParameters parameters_
virtual ~SubgraphBuilderParameters()
internal::enable_if< internal::valid_indexed_view_overload< RowIndices, ColIndices >::value &&internal::traits< typename EIGEN_INDEXED_VIEW_METHOD_TYPE< RowIndices, ColIndices >::type >::ReturnAsIndexedView, typename EIGEN_INDEXED_VIEW_METHOD_TYPE< RowIndices, ColIndices >::type >::type operator()(const RowIndices &rowIndices, const ColIndices &colIndices) EIGEN_INDEXED_VIEW_METHOD_CONST