Update:
This code expands the dataset very fast, but then the optimization on the expanded dataset takes days.
_______________________________________________________________
DATA = zeros(sum(weights), size(data,2));
cumsum_weights = [0; cumsum(weights)];
for i = 1:length(weights)
DATA(cumsum_weights(i)+1:cumsum_weights(i+1),:) = repmat(data(i,:),weights(i),1);
end
This code expands the dataset very fast, but then the optimization on the expanded dataset takes days.
_______________________________________________________________
DATA = zeros(sum(weights), size(data,2));
cumsum_weights = [0; cumsum(weights)];
for i = 1:length(weights)
DATA(cumsum_weights(i)+1:cumsum_weights(i+1),:) = repmat(data(i,:),weights(i),1);
end