(* Here is a matrix that is block diagonalized: *)

dd = 
{{2,1,0},
{0,2,0},
{0,0,3}}

MatrixForm[dd]

(* Now I want to disguise it. *)

ss = Table[RandomInteger[{-2,2}],{3},{3}]

MatrixForm[ss]

Det[ss]

xx=ss.dd.Inverse[ss]

MatrixForm[xx]

CharacteristicPolynomial[xx,t]

Factor[12-16 t+7 (t^2)-(t^3)]

(* The characteristic polynomial factors as (t-2)^2 (t-3). *)

(* So we should be able to block diagonalize xx so that one block has char. poly (t-2)^2 and the other has char. poly t-3. *)