diff --git a/poincare/src/matrix_inverse.cpp b/poincare/src/matrix_inverse.cpp index 2590626ff..506fea1bb 100644 --- a/poincare/src/matrix_inverse.cpp +++ b/poincare/src/matrix_inverse.cpp @@ -51,14 +51,10 @@ Expression MatrixInverse::shallowReduce(ExpressionNode::ReductionContext reducti } Expression c = childAtIndex(0); if (c.type() == ExpressionNode::Type::Matrix) { - Matrix matrixChild = static_cast(c); - if (matrixChild.numberOfRows() != matrixChild.numberOfColumns()) { - return replaceWithUndefinedInPlace(); - } /* Power(matrix, -n) creates a matrixInverse, so the simplification must be * done here and not in power. */ bool couldComputeInverse = false; - Expression result = matrixChild.createInverse(reductionContext, &couldComputeInverse); + Expression result = static_cast(c).createInverse(reductionContext, &couldComputeInverse); if (couldComputeInverse) { replaceWithInPlace(result); return result.shallowReduce(reductionContext);