in reply to Help with Matrix math!

This sounds a lot like a homework problem, but I'll give you the following pointers:
  1. This is equivalent to finding the largest eigenvalue of D.
  2. A standard way of solving this problem is to use the "power method" which is documented here: wikipedia entry
  3. The perl module PDL is useful for performing matrix operations.