mirror of
https://github.com/UpsilonNumworks/Upsilon.git
synced 2026-03-25 16:50:50 +01:00
[apps/reg] Prevent fitting when data not suitable
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
#include "power_model.h"
|
||||
#include "../store.h"
|
||||
#include <math.h>
|
||||
#include <assert.h>
|
||||
#include "../../poincare/include/poincare_layouts.h"
|
||||
@@ -66,4 +67,18 @@ double PowerModel::partialDerivate(double * modelCoefficients, int derivateCoeff
|
||||
return 0.0;
|
||||
}
|
||||
|
||||
bool PowerModel::dataSuitableForFit(Store * store, int series) const {
|
||||
if (!Model::dataSuitableForFit(store, series)) {
|
||||
return false;
|
||||
}
|
||||
int numberOfPairs = store->numberOfPairsOfSeries(series);
|
||||
for (int j = 0; j < numberOfPairs; j++) {
|
||||
if (store->get(series, 0, j) < 0) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user