Line |
Branch |
Exec |
Source |
1 |
|
|
// |
2 |
|
|
// Copyright (c) 2024 INRIA |
3 |
|
|
// |
4 |
|
|
|
5 |
|
|
#ifndef __pinocchio_serialization_csv_hpp__ |
6 |
|
|
#define __pinocchio_serialization_csv_hpp__ |
7 |
|
|
|
8 |
|
|
#include "pinocchio/serialization/fwd.hpp" |
9 |
|
|
|
10 |
|
|
#include <Eigen/Core> |
11 |
|
|
#include <fstream> |
12 |
|
|
|
13 |
|
|
namespace pinocchio |
14 |
|
|
{ |
15 |
|
|
|
16 |
|
|
template<typename Derived> |
17 |
|
✗ |
void toCSVfile(const std::string & filename, const Eigen::MatrixBase<Derived> & matrix) |
18 |
|
|
{ |
19 |
|
✗ |
const Eigen::IOFormat CSVFormat(Eigen::StreamPrecision, Eigen::DontAlignCols, ", ", "\n"); |
20 |
|
✗ |
std::ofstream file(filename.c_str()); |
21 |
|
✗ |
file << matrix.format(CSVFormat); |
22 |
|
|
} |
23 |
|
|
} // namespace pinocchio |
24 |
|
|
|
25 |
|
|
#endif // ifndef __pinocchio_serialization_csv_hpp__ |
26 |
|
|
|