|
@@ -13,6 +13,7 @@
|
13
|
13
|
* @version $Id$
|
14
|
14
|
* @author Trevor Irons (ti)
|
15
|
15
|
* @email Trevor.Irons@xri-geo.com
|
|
16
|
+ * @copyright Copyright (c) 2017, University of Utah
|
16
|
17
|
* @copyright Copyright (c) 2014, XRI Geophysics, LLC
|
17
|
18
|
* @copyright Copyright (c) 2014, Trevor Irons
|
18
|
19
|
*/
|
|
@@ -292,24 +293,27 @@ struct convert<Lemma::MatrixXr> {
|
292
|
293
|
node["cols"] = rhs.cols();
|
293
|
294
|
for (int ir=0; ir<rhs.rows(); ++ir) {
|
294
|
295
|
for (int ic=0; ic<rhs.cols(); ++ic) {
|
295
|
|
- node["data"].push_back( rhs(ir,ic) );
|
|
296
|
+ node[ir][ic] = rhs(ir,ic);
|
296
|
297
|
}
|
|
298
|
+ node[ir].SetStyle(YAML::EmitterStyle::Flow);
|
297
|
299
|
}
|
|
300
|
+ //node.SetStyle(YAML::EmitterStyle::Block);
|
298
|
301
|
node.SetTag( "MatrixXr" );
|
299
|
302
|
return node;
|
300
|
303
|
}
|
301
|
304
|
|
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
|
|
-// }
|
|
305
|
+ static bool decode(const Node& node, Lemma::MatrixXr& rhs) {
|
|
306
|
+ if( node.Tag() != "MatrixXr" ) {
|
|
307
|
+ return false;
|
|
308
|
+ }
|
|
309
|
+ rhs.resize( node["rows"].as<int>(), node["cols"].as<int>() );
|
|
310
|
+ int ir=0;
|
|
311
|
+ for(YAML::const_iterator it=node[0].begin(); it!=node[0].end(); ++it) {
|
|
312
|
+ rhs(ir) = it->as<Lemma::Real>();
|
|
313
|
+ ++ir;
|
|
314
|
+ }
|
|
315
|
+ return true;
|
|
316
|
+ }
|
313
|
317
|
|
314
|
318
|
};
|
315
|
319
|
|