@@ -347,7 +347,8 @@ inline void npy_save(const std::string & fname,
347
347
unsigned int rows = static_cast <unsigned int >(obj.rows ());
348
348
unsigned int cols = static_cast <unsigned int >(obj.cols ());
349
349
const unsigned int shape[] = {rows, cols};
350
- cnpy::npy_save (fname, obj.data (), shape, 2 , " w" , obj.IsRowMajor );
350
+ bool colMajor = obj.IsRowMajor ? false : true ;
351
+ cnpy::npy_save (fname, obj.data (), shape, 2 , " w" , colMajor);
351
352
}
352
353
353
354
/* ! \brief Save Eigen object to a compressed NumPy file
@@ -366,8 +367,9 @@ inline void npz_save(const std::string & fname, const std::string & name,
366
367
unsigned int rows = static_cast <unsigned int >(obj.rows ());
367
368
unsigned int cols = static_cast <unsigned int >(obj.cols ());
368
369
const unsigned int shape[] = {rows, cols};
370
+ bool colMajor = obj.IsRowMajor ? false : true ;
369
371
std::string mode = overwrite ? " w" : " a" ;
370
- cnpy::npz_save (fname, name, obj.data (), shape, 2 , mode, obj. IsRowMajor );
372
+ cnpy::npz_save (fname, name, obj.data (), shape, 2 , mode, colMajor );
371
373
}
372
374
373
375
/* ! \brief Load NpyArray object into Eigen object
0 commit comments