mercredi 23 septembre 2015

Create a relation matrix from a sequence

I have a sequence S :

  S= 'ABCD' % which means A<B<C<D

I want to convert S into a matrix M[i,j] which have to satisfy those conditions :

   M[i,j] , M[j,i] are random
   M[i,i] =0.5
   M[i,j] + M[j,i] = 1
   M[i,j] < M[j,i] % For example: if A<B then M[A,B] < M[B,A]

For example: if we have S = 'ABCD', the M matrix will be expected as follows:

      A      B    C    D
   A  o.5  0.25  0.2   0.1
   B  0.75 0.5   0.35  0.15
   C  0.8  0.65  0.5   0.4
   D  0.9  0.85  0.6   0.5




Aucun commentaire:

Enregistrer un commentaire