This is an implementation of Optimal Partitioning Algorithm as described here: https://ieeexplore.ieee.org/abstract/document/1381461
op(): Return a vector with the optimal changepoints.
backtracking(): Return the segments to plot, based on a vector built by op().
plot_segments(): Compute the mean of each segment and plot them.