# File lib/backports/1.9.2/stdlib/matrix.rb, line 973 def ** (other) case other when Integer x = self if other <= 0 x = self.inverse return self.class.identity(self.column_size) if other == 0 other = -other end z = nil loop do z = z ? z * x : x if other[0] == 1 return z if (other >>= 1).zero? x *= x end when Numeric v, d, v_inv = eigensystem v * self.class.diagonal(*d.each(:diagonal).map{|e| e ** other}) * v_inv else Matrix.Raise ErrOperationNotDefined, "**", self.class, other.class end end