For a given matrix, form a new matrix by cumulatively summing over its columns. Reorder the row contents in this matrix by the corresponding indices in the given priority matrix. Then cumulatively sum over each row, yielding a new matrix of the same size as the input matrix.
sum_reorder_sum(A, priority_indices)
A numeric or integer matrix.
An integer matrix as output by
prioritize_cols
.