Fuzzy MInimal Distence index for ellipsoidal clusters

Input: The set 𝒜 ⊂ (ℝ^n), centers (Subscript[c, 1]),⃛,(Subscript[c, k]) ∈ (ℝ^n), Membership matrix U,
covariance matrices (∑_j)∈(ℝ^(n\[Cross]n)), j=1⃛k;
Output: FMMD -index;

Submodules:  MMD[],IntersectTest[],MinR[]
The variable prag∈[0,1]  comes from MFINC[].

(* If u_{ij} ≥ prag, element (Subscript[a, i]) stays in cluster (Subscript[π, j]) *)
MFNew1[A_,Cen_,U_,Cov_,Ind_:0]:=Module[{m=Length[A],k=Length[Cen],n=Length[A[[1]]]},
PI=Table[{},{j,k}]; Res={};
Do[
max=Ordering[U[[i]],-1]; 
If[U[[i,max[[1]]]]>prag,
PI[[max[[1]]]]=Append[PI[[max[[1]]]],A[[i]]],
Res=Append[Res,A[[i]]]
]
,{i,m}];
						(* New centers *)
Cen2=Table[Mean[PI[[j]]],{j,k}];
Print["|PI[[j]]|: ",Table[Length[PI[[j]]],{j,k}],", |Res|=",Length[Res]];
				(* New covariance matrices *)
Cov2=Table[0,{j,k}];
Do[
Cov2[[j]]= Sum[KroneckerProduct[(PI[[j,i]]-Cen2[[j]]),(PI[[j,i]]-Cen2[[j]])],{i,Length[PI[[j]]]}]/Length[PI[[j]]]
,{j,k}];
					(* Call MMD index *)
MMD[PI,Cen2,Cov2,Ind]
]