def matrix_power(M, n):
 result = 1
 for i in xrange(n):
  result = theano.dot(result, M)
 return result

def matrix_power ( M , n ) : result = 1 for i in xrange ( n ) : result = theano . dot ( result , M ) return result
raise a square matrix to the power n .