diff --git a/apps/regression/model/model.cpp b/apps/regression/model/model.cpp index 3b287687d..eb90bb77e 100644 --- a/apps/regression/model/model.cpp +++ b/apps/regression/model/model.cpp @@ -170,6 +170,7 @@ int Model::solveLinearSystem(double * solutions, double * coefficients, double * for (int i = 0; i < n * n; i++) { coefficientsSave[i] = coefficients[i]; } + assert(k_maxNumberOfCoefficients < Matrix::k_maxNumberOfCoefficients); int inverseResult = Matrix::ArrayInverse(coefficients, n, n); int numberOfMatrixModifications = 0; while (inverseResult < 0 && numberOfMatrixModifications < k_maxMatrixInversionFixIterations) { diff --git a/poincare/include/poincare/matrix.h b/poincare/include/poincare/matrix.h index b015b81de..d042bc939 100644 --- a/poincare/include/poincare/matrix.h +++ b/poincare/include/poincare/matrix.h @@ -84,10 +84,9 @@ public: /* createInverse can be called on any matrix reduce or not, approximate or not. */ Expression inverse(Context & context, Preferences::ComplexFormat complexFormat, Preferences::AngleUnit angleUnit) const; #endif -private: // TODO: find another solution for inverse and determinant (avoid capping the matrix) static constexpr int k_maxNumberOfCoefficients = 100; - +private: MatrixNode * node() const { return static_cast(Expression::node()); } void setNumberOfRows(int rows) { assert(rows >= 0); node()->setNumberOfRows(rows); } void setNumberOfColumns(int columns) { assert(columns >= 0); node()->setNumberOfColumns(columns); }