rank2order function

Given a rank, it is transformed to a ordering