def __pow__( self, exp ):
        assert NPRE or exp==int(exp) and exp>0, 'Matrix powers only defined for positive integers not %s' % exp
        if exp == 1: return self
        if exp&1: return self.mmul(self ** (exp-1))
        sqrme = self ** (exp/2)
        return sqrme.mmul(sqrme)
Raise a square matrix to an integer power (i.e. A**3 is the same as A.mmul(A.mmul(A))
dataset/ETHPy150Open sunlightlabs/clearspending/completeness/statlib/matfunc.py/Square.__pow__