Reorder columns of a square matrix so that the first nonzero elements are in decreasing order
Reorder columns of a square matrix so that the first nonzero elements are in decreasing order
order_B takes a square matrix B as input and reorders its columns so that the diagonal entries of B are in decreasing order. The function is designed to be computationally efficient and ensures that the input is a square matrix.
order_B(B)
Arguments
B: A square numeric matrix.
Returns
A square matrix B with columns reordered so that its diagonal entries are in a decreasing order.