An algorithm for computing a companion block diagonal form for a system of linear differential equations