function _powArray (x, y) {
    if (!isInteger(y)) {
      throw new TypeError('For A^b, b must be an integer (value is ' + y + ')')
    }
    // verify that A is a 2 dimensional square matrix
    const s = size(x)
    if (s.length !== 2) {
      throw new Error('For A^b, A must be 2 dimensional (A has ' + s.length + ' dimensions)')
    }
    if (s[0] !== s[1]) {
      throw new Error('For A^b, A must be square (size is ' + s[0] + 'x' + s[1] + ')')
    }
    if (y < 0) {
      try {
        return _powArray(inv(x), -y)
      } catch (error) {
        if (error.message === 'Cannot calculate inverse, determinant is zero') {
          throw new TypeError('For A^b, when A is not invertible, b must be a positive integer (value is ' + y + ')')
        }
        throw error
      }
    }

    let res = identity(s[0]).valueOf()
    let px = x
    while (y >= 1) {
      if ((y & 1) === 1) {
        res = multiply(px, res)
      }
      y >>= 1
      px = multiply(px, px)
    }
    return res
  }
Calculate the power of a 2d array
@param {Array} x     must be a 2 dimensional, square matrix
@param {number} y    a integer value (positive if `x` is not invertible)
@returns {Array}
@private