matrix: checkIfPowerOfTwo added