in reply to decomposing binary matrices
Have you take a look at Graph? If that does not help then you can get Mastering Algorithms with Perl. I got it recently and I found that it very accessible to someone who did not have much math knowledge (that would be me! :) ).
In Section
Seekers of Perl Wisdom