Define a matrix function with a specific property

Let $S$ be the set of all positive semidefinite Hermitian matrices of order $mn$ over $\mathbb{C}$. Any matrix $H$ can be partitioned into blocks $H_{ij}$ of order $n$ that is $H_{mn \times mn} = (H_{ij})_{m \times m}$.

Is there a function $f: S \rightarrow \mathbb{R}$ which may be defined as follws? $$f(H) = \begin{cases} & 0 ~\text{when}~ \{H_{ij}\} ~\text{forms a family of commutating normal matrices,} \\ & \text{a positive number otherwise.} \end{cases}$$.

Can you give an example? Thank you.

Why not just take the sum of the norms of the commutators $[H_{ij}, H_{kl}]$ and $[H_{ij}, H^*_{ij}]$?