A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://github.com/garrison/eigen3-hdf5 below:

garrison/eigen3-hdf5: Bare-bones hdf5 serialization of Eigen matrices and vectors

Easy serialization of C++ Eigen matrices using HDF5.

The library is meant to be bare-bones (at least for now). It gets me 90% of what I want/need in a few hundred lines of code. It may also get you 90% (or even 100%) of what you need.

Because eigen3-hdf5 is a template library, there is nothing to link against (besides the HDF5 libraries).

Supports saving and restoring Eigen matrices and vectors of float, double, long double, int, unsigned int, and std::complex<>.

#include <eigen3-hdf5.hpp>

void save_matrix()
{
    Eigen::Matrix3d mat;
    mat << 1, 2, 3, 4, 5, 6, 7, 8, 9;
    H5::H5File file("filename1.h5", H5F_ACC_TRUNC);
    EigenHDF5::save(file, "MatrixDataSetName", mat);
}

void load_vector()
{
    Eigen::Vector4i vec;
    H5::H5File file("filename2.h5", H5F_ACC_RDONLY);
    EigenHDF5::load(file, "VectorDataSetName", vec);
}

See the unittests directory for more examples.

I am using premake4 and googletest because I am familiar with them.

The unit tests currently write to specific files in the current directory. This could change, eventually.

The GitHub Action can be approximated locally by installing act and running:

act -P ubuntu-20.04=ghcr.io/catthehacker/ubuntu:act-20.04

MIT license.


RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4