|
@@ -284,6 +284,35 @@ struct convert<Lemma::Vector3r> {
|
284
|
284
|
}
|
285
|
285
|
};
|
286
|
286
|
|
|
287
|
+template<>
|
|
288
|
+struct convert<Lemma::MatrixXr> {
|
|
289
|
+ static Node encode(const Lemma::MatrixXr& rhs) {
|
|
290
|
+ Node node;
|
|
291
|
+ node["rows"] = rhs.rows();
|
|
292
|
+ node["cols"] = rhs.cols();
|
|
293
|
+ for (int ir=0; ir<rhs.rows(); ++ir) {
|
|
294
|
+ for (int ic=0; ic<rhs.cols(); ++ic) {
|
|
295
|
+ node["data"].push_back( rhs(ir,ic) );
|
|
296
|
+ }
|
|
297
|
+ }
|
|
298
|
+ node.SetTag( "MatrixXr" );
|
|
299
|
+ return node;
|
|
300
|
+ }
|
|
301
|
+
|
|
302
|
+// static bool decode(const Node& node, Lemma::Vector3r& rhs) {
|
|
303
|
+// if( node.Tag() != "Vector3r" ) {
|
|
304
|
+// return false;
|
|
305
|
+// }
|
|
306
|
+// int ir=0;
|
|
307
|
+// for(YAML::const_iterator it=node[0].begin(); it!=node[0].end(); ++it) {
|
|
308
|
+// rhs(ir) = it->as<Lemma::Real>();
|
|
309
|
+// ++ir;
|
|
310
|
+// }
|
|
311
|
+// return true;
|
|
312
|
+// }
|
|
313
|
+
|
|
314
|
+};
|
|
315
|
+
|
287
|
316
|
}
|
288
|
317
|
|
289
|
318
|
#endif // ----- #ifndef HELPER_INC -----
|