in ReplicaSDK/src/MirrorSurface.cpp [5:24]
inline Eigen::MatrixXd EigenMatrixFromJson(const picojson::value& json) {
const int rows = int(json.size());
if (rows > 0 && json[0].is<picojson::array>()) {
// matrix
const int cols = int(json[0].size());
Eigen::MatrixXd mat(rows, cols);
for (size_t r = 0; r < json.size(); ++r) {
for (size_t c = 0; c < json[0].size(); ++c) {
mat(r, c) = json[r][c].get<double>();
}
}
return mat;
} else {
Eigen::MatrixXd arr(json.size(), 1);
for (size_t r = 0; r < json.size(); ++r) {
arr(r, 0) = json[r].get<double>();
}
return arr;
}
}