Added exponentiating the matrix
fixed a bug where d=0 for all vertices.
A