Fixed bug with squaring matrix test and impl