28 lines
608 B
Markdown
28 lines
608 B
Markdown
|
# Конвертер Eigen3 <-> HDF5
|
||
|
|
||
|
Основан на:
|
||
|
[1](https://github.com/SebastianRiedel/eigen3-hdf5),
|
||
|
[2](https://github.com/garrison/eigen3-hdf5),
|
||
|
[3](https://github.com/UM-A2SRL/eigen3-hdf5)
|
||
|
|
||
|
## Пример
|
||
|
|
||
|
```cpp
|
||
|
#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);
|
||
|
Eigen3HDF5::save(file, "MatrixDataSetName", mat);
|
||
|
}
|
||
|
|
||
|
void load_vector()
|
||
|
{
|
||
|
Eigen::Vector4i vec;
|
||
|
H5::H5File file("filename2.h5", H5F_ACC_RDONLY);
|
||
|
Eigen3HDF5::load(file, "VectorDataSetName", vec);
|
||
|
}
|
||
|
```
|