in reply to Re: constructing a matrix with perl
in thread constructing a matrix with perl

yeah it should be a 39 by 39 square. there are 1,400 odd numbers - in my data - i suppose its symetrical accross a diagonal line of zeros, AAvAA, AEvAE.... ZHvZH.

I havent included all the values here.

I haven't actually got data for XvX pairs, where the values are zero - but it will be zero for the matrix. I do have all cases of YvX for any XvY.

hope that clears things up - any more questions ask away! -thanks

Replies are listed 'Best First'.
Re^3: constructing a matrix with perl
by chas (Priest) on Feb 28, 2005 at 18:03 UTC
    In that case, I would probably first create the square "matrix" with all entries initialized to 0. Then I would read in the data you have as in my previous reply. Finally, I would loop over the entries making them symmetric. To do this, you could make an array @A with entries AA,...,ZH and then do the symmetrizing over the matrix entries $M{$A[i]}{$A[j]} where i<j.
    AA,...,ZH includes 208 values, doesn't it? So it seems like your matrix is much bigger than 39 by 39. But I may be misunderstanding something still.
    It is probably possible to do all this in fewer steps, but there probably isn't much change in efficiency.
    (I am getting disconnected a lot, so I may stop posting till later.)
    chas
      there are 39 values (phonemes) between AA and ZH; AA AE AH AO AW AY B CH D DH EH ER EY F G HH IH IY JH K L M N NG OW OY P R S SH T TH UH UW V W Y Z ZH - thanks for the help its great stuff!