The rearrange_mat function rearranges the column elements of a given 'a_matrix'.
rearrange_mat(a_matrix, treatments)A a_matrix of the first design (D1)
The number of treatments of the second design (D2)
It returns new 'a_matrix' (A) with each row containing all the treatments of D2 exaclty once.
This function reads an 'a_matrix' (A) generated from two designs (D1 and D2) and rearranges the column elements based on the treatments numbers in the second design (D2). It iteratively rearrange the items row-wise until the new A is generated with each row containing all the treatments of D2 exaclty once.