From d2c9ba4baa213683dacd63589d9589e6eaff4e7d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?L=C3=A9a=20Saviot?= Date: Thu, 1 Aug 2019 16:09:50 +0200 Subject: [PATCH] [poincare/matrix_inverse] Remove duplicate check if matrix is square Also done in Matrix::createInverse --- poincare/src/matrix_inverse.cpp | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) 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);