mirror of
https://github.com/UpsilonNumworks/Upsilon.git
synced 2026-03-18 21:30:38 +01:00
[regression] Add an assertion on the number of entries of matrices used
in models
This commit is contained in:
@@ -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) {
|
||||
|
||||
@@ -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<MatrixNode *>(Expression::node()); }
|
||||
void setNumberOfRows(int rows) { assert(rows >= 0); node()->setNumberOfRows(rows); }
|
||||
void setNumberOfColumns(int columns) { assert(columns >= 0); node()->setNumberOfColumns(columns); }
|
||||
|
||||
Reference in New Issue
Block a user