Sort:  

When you iterate you only have to compute D^m D is a diagonal matrix so that is pretty easy to compute. X and invX stay the same. More specifically B^m=invX D^m X

Posted using Partiko Android