Mahalanobis Calinski–Harabasz index for optimal Mahalanobis partitions

Input: partition Π={(Subscript[π, 1]),⃛,(Subscript[π, k])} of the weighted set 𝒜 ⊂ (ℝ^n), centers (Subscript[c, 1]),⃛,(Subscript[c, k]) ∈ (ℝ^n), covariance matrices (∑_j)∈(ℝ^(n×n)), j=1⃛k;
Output: MCH index for the partition Π;
Submodules: dM[], MWF[]

Clear[MCH]
MCH[PI_,z_,Scov_]:=Module[{k=Length[z],F,G},
m=Sum[Length[PI[[j]]],{j,k}];
F=MWF[PI,z,Scov];  (* or *)F=n Sum[Total[PI[[j,All,1]]] (Det[Scov[[j]]])^(1/n),{j,Length[PI]}];
G=Sum[Sum[PI[[j,s,1]],{s,Length[PI[[j]]]}]*dM[z[[j]],cc,Scov[[j]]],{j,k}];
(m-k)*G/((k-1)F)
                                     ]