Fuzzy Rand and Jaccard indexes

Input: membership matrices of partitions (Π^((1))) and (Π^((2))) of the set 𝒜 ⊂ (ℝ^n); 
Output: fuzzy Rand FR and fuzzy Jaccard FJ indexes;
Submodules: none needed

RandFrigue[A_,B_]:=Module[{m=Dimensions[A][[1]],PsiA,PsiB,a,b,c,d},
PsiA=PsiB=Table[0,{i,m},{j,m}];
Do[
PsiA[[i,j]]=A[[i]].A[[j]];PsiB[[i,j]]=B[[i]].B[[j]];
,{i,m-1},{j,i+1,m}];
a=Sum[PsiA[[i,j]]*PsiB[[i,j]],{i,m-1},{j,i+1,m}];
b=Sum[PsiA[[i,j]]*(1-PsiB[[i,j]]),{i,m-1},{j,i+1,m}];
c=Sum[(1-PsiA[[i,j]])*PsiB[[i,j]],{i,m-1},{j,i+1,m}];
d=Sum[(1-PsiA[[i,j]])*(1-PsiB[[i,j]]),{i,m-1},{j,i+1,m}];
{(a+d)/(a+b+c+d),a/(a+b+c)}
]