anderkve / FYS3150

https://anderkve.github.io/FYS3150
26 stars 14 forks source link

Armadillo version and Ubuntu version #98

Closed jgjonsson closed 1 year ago

jgjonsson commented 1 year ago

Hello!

This question started with me exploring how to best export data from the cx_cube Armadillo object. I see it has save-functions for CSV which looks promising, but found out they are only available in later versions of Armadillo.

I currently have Armadillo 9.8. In order to upgrade it looks like I need to upgrade my whole Ubuntu installation (on WSL2) from 20 to 22.

I can not find in the course pages what version of Armadillo is actually the recommended one. Apparently I've been fine until now with the slightly old 9.8. And I wonder if it is wise to risk breaking development environment now by upgrading lots of stuff, nearing the end of the last assignment of the course.

What's your recommendation?

anderkve commented 1 year ago

Hi @jgjonsson!

For this project you will probably end up storing quite large data sets (at least if you are producing animations), so I would recommend using a binary format rather than text files like CSV. The easiest is probably just to use Armadillo's built-in binary format, via the .save(...) functionality (https://arma.sourceforge.net/docs.html#save_load_mat), and then read the binary file from Python using the pyarma module. See our quick description here: https://anderkve.github.io/FYS3150/book/introduction_to_cpp/intro_to_armadillo.html#saving-and-loading-vectors-and-matrices

We don't really have a special recommended Armadillo version, as we've so far not encountered the problem with too old versions. I'm pretty sure the ability to save a cx_cube as an Armadillo binary file with .save(...) should be available in version 9.8. But let me know if that's not the case.

jgjonsson commented 1 year ago

Thanks, that's very helpful. Indeed the older Armadillo supports binary format.

For pyarma I must have overlooked this information, and until now also mostly used Python pandas for reading input, so wasn't aware that would be an easy option.

Hi @jgjonsson! The easiest is probably just to use Armadillo's built-in binary format, via the .save(...) functionality (https://arma.sourceforge.net/docs.html#save_load_mat), and then read the binary file from Python using the pyarma module. See our quick description here: https://anderkve.github.io/FYS3150/book/introduction_to_cpp/intro_to_armadillo.html#saving-and-loading-vectors-and-matrices

anderkve commented 1 year ago

Indeed the older Armadillo supports binary format.

Great, good to know!