Browse Source

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

submodule
T-bone 7 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
     node["cols"] = rhs.cols();
293
     node["cols"] = rhs.cols();
294
     for (int ir=0; ir<rhs.rows(); ++ir) {
294
     for (int ir=0; ir<rhs.rows(); ++ir) {
295
         for (int ic=0; ic<rhs.cols(); ++ic) {
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
     //node.SetStyle(YAML::EmitterStyle::Block);
300
     //node.SetStyle(YAML::EmitterStyle::Block);
301
     node.SetTag( "MatrixXr" );
301
     node.SetTag( "MatrixXr" );
311
     rhs.resize(nr, nc);
311
     rhs.resize(nr, nc);
312
     for (int ir=0; ir<nr; ++ir) {
312
     for (int ir=0; ir<nr; ++ir) {
313
         int ic=0;
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
             rhs(ir,ic) = it->as<Lemma::Real>();
315
             rhs(ir,ic) = it->as<Lemma::Real>();
316
             ++ic;
316
             ++ic;
317
         }
317
         }

Loading…
Cancel
Save