14 #include <Eigen/Dense>
23 inline static std::string
vec_to_csv(
const Eigen::VectorXd& a)
26 for (
int k = 0; k < a.size(); k++)
39 if (cov.rows() != cov.cols())
41 std::cout <<
"Cov Mat to CSV: Cov matrix non-squared. No line written." << std::endl;
42 return std::string(
"");
46 const int num_cov_state =
static_cast<int>(cov.rows());
48 for (
int k = 0; k < num_cov_state; k++)
50 int row_count = k * num_cov_state + k;
51 int col_count = num_cov_state - k;
52 os << vec_to_csv(Eigen::Map<const Eigen::VectorXd>(cov.data() + row_count, col_count));
62 const std::string var(
"p_");
63 for (
int row = 1; row <= num_states; row++)
65 for (
int col = row; col <= num_states; col++)
67 os <<
", " << var << row <<
"_" << col;
Definition: write_csv.h:21
static std::string vec_to_csv(const Eigen::VectorXd &a)
Definition: write_csv.h:23
static std::string cov_mat_to_csv(const Eigen::MatrixXd &cov)
get_csv_state_with_cov_header_string generate string with state and upper triangular covariance
Definition: write_csv.h:37
static std::string get_cov_header_string(const int &num_states)
Definition: write_csv.h:58