Skip to content

Commit

Permalink
cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
cate-to committed Nov 7, 2024
1 parent 6223807 commit 185a330
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 18 deletions.
16 changes: 8 additions & 8 deletions agrolib/interpolation/interpolation.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1093,12 +1093,12 @@ void localSelection(vector <Crit3DInterpolationDataPoint> &inputPoints, vector <
for (unsigned long i = 0; i < inputPoints.size() ; i++)
inputPoints[i].distance = gis::computeDistance(x, y, float((inputPoints[i]).point->utm.x), float((inputPoints[i]).point->utm.y));

unsigned int nrValid = 0;
int nrValid = 0;
float stepRadius = 7500; // [m]
float r0 = 0; // [m]
float r1 = stepRadius; // [m]
unsigned int i;
unsigned int nrPrimaries = 0;
int nrPrimaries = 0;

int maxDistance = 0;
while ((!mySettings.getUseLapseRateCode() && nrValid < minPoints) || (mySettings.getUseLapseRateCode() && nrPrimaries < minPoints))
Expand Down Expand Up @@ -1514,7 +1514,7 @@ void calculateFirstGuessCombinations(Crit3DProxy* myProxy)
std::vector <double> tempFirstGuess;
int numSteps = 15;
std::vector <double> stepSize;
int nrParam = int(tempParam.size()/2);
unsigned nrParam = int(tempParam.size()/2);

double min_,max_;
for (unsigned j=0; j < nrParam; j++)
Expand Down Expand Up @@ -1801,13 +1801,13 @@ bool multipleDetrendingElevationFitting(int elevationPos, std::vector <Crit3DInt
// multiple non linear fitting
double R2 = NODATA;
if (isWeighted)
R2 = interpolation::bestFittingMarquardt_nDimension_singleFunction(*(myFunc.target<double(*)(double, std::vector<double>&)>()), 400, 4, parametersMin, parametersMax, parameters, parametersDelta,
stepSize, numSteps, 1000, 0.002, 0.005, predictors, predictands, weights,firstGuessCombinations);
R2 = interpolation::bestFittingMarquardt_nDimension_singleFunction(*(myFunc.target<double(*)(double, std::vector<double>&)>()), 4, parametersMin, parametersMax, parameters, parametersDelta,
1000, 0.002, 0.005, predictors, predictands, weights,firstGuessCombinations);
else
R2 = interpolation::bestFittingMarquardt_nDimension_singleFunction(*(myFunc.target<double(*)(double, std::vector<double>&)>()), 400, 4, parametersMin, parametersMax, parameters, parametersDelta,
stepSize, numSteps, 1000, 0.002, 0.005, predictors, predictands,firstGuessCombinations);
R2 = interpolation::bestFittingMarquardt_nDimension_singleFunction(*(myFunc.target<double(*)(double, std::vector<double>&)>()), 4, parametersMin, parametersMax, parameters, parametersDelta,
1000, 0.002, 0.005, predictors, predictands,firstGuessCombinations);

mySettings->getProxy(elevationPos)->setRegressionR2(R2);
mySettings->getProxy(elevationPos)->setRegressionR2(float(R2));

std::vector<std::vector<double>> newParameters;
newParameters.push_back(parameters);
Expand Down
6 changes: 2 additions & 4 deletions agrolib/mathFunctions/furtherMathFunctions.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2477,10 +2477,9 @@ namespace interpolation
return norm;
}
double bestFittingMarquardt_nDimension_singleFunction(double (*func)(double, std::vector<double>&),
int nrTrials, int nrMinima,
int nrMinima,
std::vector <double>& parametersMin, std::vector <double>& parametersMax,
std::vector <double>& parameters, std::vector <double>& parametersDelta,
std::vector <double>& stepSize, int numSteps,
int maxIterationsNr, double myEpsilon, double deltaR2,
std::vector <double>& x ,std::vector<double>& y,
std::vector<double>& weights, std::vector<std::vector<double>> firstGuessCombinations)
Expand Down Expand Up @@ -2547,10 +2546,9 @@ namespace interpolation
}

double bestFittingMarquardt_nDimension_singleFunction(double (*func)(double, std::vector<double>&),
int nrTrials, int nrMinima,
int nrMinima,
std::vector <double>& parametersMin, std::vector <double>& parametersMax,
std::vector <double>& parameters, std::vector <double>& parametersDelta,
std::vector <double>& stepSize, int numSteps,
int maxIterationsNr, double myEpsilon, double deltaR2,
std::vector <double>& x ,std::vector<double>& y,
std::vector<std::vector<double>> firstGuessCombinations)
Expand Down
8 changes: 2 additions & 6 deletions agrolib/mathFunctions/furtherMathFunctions.h
Original file line number Diff line number Diff line change
Expand Up @@ -165,19 +165,15 @@ enum estimatedFunction {FUNCTION_CODE_SPHERICAL, FUNCTION_CODE_LINEAR, FUNCTION_
std::vector<double> &parameters, std::vector<double> &parametersDelta,
int maxIterationsNr, double myEpsilon,
std::vector <double>& x, std::vector<double>& y);
double bestFittingMarquardt_nDimension_singleFunction(double (*func)(double, std::vector<double>&),
int nrTrials, int nrMinima,
double bestFittingMarquardt_nDimension_singleFunction(double (*func)(double, std::vector<double>&), int nrMinima,
std::vector <double>& parametersMin, std::vector <double>& parametersMax,
std::vector <double>& parameters, std::vector <double>& parametersDelta,
std::vector<double> &stepSize, int numSteps,
int maxIterationsNr, double myEpsilon, double deltaR2,
std::vector <double>& x , std::vector<double>& y,
std::vector<double>& weights, std::vector<std::vector<double> > firstGuessCombinations);
double bestFittingMarquardt_nDimension_singleFunction(double (*func)(double, std::vector<double>&),
int nrTrials, int nrMinima,
double bestFittingMarquardt_nDimension_singleFunction(double (*func)(double, std::vector<double>&), int nrMinima,
std::vector <double>& parametersMin, std::vector <double>& parametersMax,
std::vector <double>& parameters, std::vector <double>& parametersDelta,
std::vector<double> &stepSize, int numSteps,
int maxIterationsNr, double myEpsilon, double deltaR2,
std::vector <double>& x , std::vector<double>& y,
std::vector<std::vector<double> > firstGuessCombinations);
Expand Down

0 comments on commit 185a330

Please sign in to comment.