Browse Source

MatrixXr serialisation now compatible with PyYaml and more consistent with Vectors.

submodule
T-bone 6 years ago
parent
commit
eaadc7aba0
1 changed files with 3 additions and 3 deletions
  1. 3
    3
      Modules/LemmaCore/include/helper.h

+ 3
- 3
Modules/LemmaCore/include/helper.h View File

@@ -293,9 +293,9 @@ struct convert<Lemma::MatrixXr> {
293 293
     node["cols"] = rhs.cols();
294 294
     for (int ir=0; ir<rhs.rows(); ++ir) {
295 295
         for (int ic=0; ic<rhs.cols(); ++ic) {
296
-            node[ir][ic] = rhs(ir,ic);
296
+            node["data"][ir][ic] = rhs(ir,ic);
297 297
         }
298
-        node[ir].SetStyle(YAML::EmitterStyle::Flow);
298
+        node["data"][ir].SetStyle(YAML::EmitterStyle::Flow);
299 299
     }
300 300
     //node.SetStyle(YAML::EmitterStyle::Block);
301 301
     node.SetTag( "MatrixXr" );
@@ -311,7 +311,7 @@ struct convert<Lemma::MatrixXr> {
311 311
     rhs.resize(nr, nc);
312 312
     for (int ir=0; ir<nr; ++ir) {
313 313
         int ic=0;
314
-        for(YAML::const_iterator it=node[ir].begin(); it!=node[ir].end(); ++it) {
314
+        for(YAML::const_iterator it=node["data"][ir].begin(); it!=node["data"][ir].end(); ++it) {
315 315
             rhs(ir,ic) = it->as<Lemma::Real>();
316 316
             ++ic;
317 317
         }

Loading…
Cancel
Save