Mahalanobis Davies - Bouldin 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: MDB index for the partition Π;
Submodules: dM[]

Clear[MDB]
MDB[PI_,z_,Scov_]:=Module[{k=Length[z],FF,VV,mj,sum=0},
FF=VV=Table[0,{j,k}];
Do[
mj=Length[PI[[j]]];
FF[[j]]=Sum[PI[[j,i,1]]*dM[PI[[j,i,2]],z[[j]],Scov[[j]]],{i,mj}];
VV[[j]]=FF[[j]]/Sum[PI[[j,i,1]],{i,mj}]
   ,{j,k}];
Do[
max={};
Do[
If[i≠j,max=Append[max,(VV[[i]]+VV[[j]])/dM[z[[i]],z[[j]],Scov[[j]]] ]]
,{i,k}];
sum=sum+Max[max]
,{j,k}];
sum/k
            ]