62 const int nValues = data->sample().gradients.size();
64 for (
const auto &stample : data->stamples()) {
65 const Eigen::VectorXd &slice = Eigen::VectorXd::Map(stample.sample.gradients.data(), stample.sample.gradients.rows() * stample.sample.gradients.cols());
67 for (
int valueId = 0; valueId < slice.size(); valueId++) {
78 data->timeStepsStorage().clear();
80 const auto dataDims = data->getDimensions();
82 for (
int timeId = 0; timeId < timeStamps.size(); timeId++) {
83 const double time = timeStamps(timeId);
85 Eigen::VectorXd slice(data->getSize());
86 for (
int valueId = 0; valueId < slice.size(); valueId++) {
87 slice(valueId) =
_values(valueId * timeStamps.size() + timeId);
90 if (!data->hasGradient()) {
91 data->setSampleAtTime(time,
time::Sample{dataDims, std::move(slice)});
95 Eigen::MatrixXd gradientSlice(data->sample().gradients.rows(), data->sample().gradients.cols());
96 auto gradientView = Eigen::VectorXd::Map(gradientSlice.data(), gradientSlice.rows() * gradientSlice.cols());
97 for (
int gradientId = 0; gradientId < gradientView.size(); gradientId++) {
98 gradientView(gradientId) =
_gradients(gradientId * timeStamps.size() + timeId);
100 data->setSampleAtTime(time,
time::Sample{dataDims, std::move(slice), std::move(gradientSlice)});