From a23519ca258a86bd1d2dd8823358f63b10f3080e Mon Sep 17 00:00:00 2001 From: cate-to Date: Thu, 7 Nov 2024 10:45:04 +0100 Subject: [PATCH] cleanup --- interpolation/interpolation.cpp | 16 ++++++++-------- mathFunctions/furtherMathFunctions.cpp | 6 ++---- mathFunctions/furtherMathFunctions.h | 8 ++------ 3 files changed, 12 insertions(+), 18 deletions(-) diff --git a/interpolation/interpolation.cpp b/interpolation/interpolation.cpp index 60cf172a5..0b2360b1b 100644 --- a/interpolation/interpolation.cpp +++ b/interpolation/interpolation.cpp @@ -1093,12 +1093,12 @@ void localSelection(vector &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)) @@ -1514,7 +1514,7 @@ void calculateFirstGuessCombinations(Crit3DProxy* myProxy) std::vector tempFirstGuess; int numSteps = 15; std::vector stepSize; - int nrParam = int(tempParam.size()/2); + unsigned nrParam = int(tempParam.size()/2); double min_,max_; for (unsigned j=0; j < nrParam; j++) @@ -1801,13 +1801,13 @@ bool multipleDetrendingElevationFitting(int elevationPos, std::vector &)>()), 400, 4, parametersMin, parametersMax, parameters, parametersDelta, - stepSize, numSteps, 1000, 0.002, 0.005, predictors, predictands, weights,firstGuessCombinations); + R2 = interpolation::bestFittingMarquardt_nDimension_singleFunction(*(myFunc.target&)>()), 4, parametersMin, parametersMax, parameters, parametersDelta, + 1000, 0.002, 0.005, predictors, predictands, weights,firstGuessCombinations); else - R2 = interpolation::bestFittingMarquardt_nDimension_singleFunction(*(myFunc.target&)>()), 400, 4, parametersMin, parametersMax, parameters, parametersDelta, - stepSize, numSteps, 1000, 0.002, 0.005, predictors, predictands,firstGuessCombinations); + R2 = interpolation::bestFittingMarquardt_nDimension_singleFunction(*(myFunc.target&)>()), 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> newParameters; newParameters.push_back(parameters); diff --git a/mathFunctions/furtherMathFunctions.cpp b/mathFunctions/furtherMathFunctions.cpp index bb1456450..bd13c1d19 100644 --- a/mathFunctions/furtherMathFunctions.cpp +++ b/mathFunctions/furtherMathFunctions.cpp @@ -2477,10 +2477,9 @@ namespace interpolation return norm; } double bestFittingMarquardt_nDimension_singleFunction(double (*func)(double, std::vector&), - int nrTrials, int nrMinima, + int nrMinima, std::vector & parametersMin, std::vector & parametersMax, std::vector & parameters, std::vector & parametersDelta, - std::vector & stepSize, int numSteps, int maxIterationsNr, double myEpsilon, double deltaR2, std::vector & x ,std::vector& y, std::vector& weights, std::vector> firstGuessCombinations) @@ -2547,10 +2546,9 @@ namespace interpolation } double bestFittingMarquardt_nDimension_singleFunction(double (*func)(double, std::vector&), - int nrTrials, int nrMinima, + int nrMinima, std::vector & parametersMin, std::vector & parametersMax, std::vector & parameters, std::vector & parametersDelta, - std::vector & stepSize, int numSteps, int maxIterationsNr, double myEpsilon, double deltaR2, std::vector & x ,std::vector& y, std::vector> firstGuessCombinations) diff --git a/mathFunctions/furtherMathFunctions.h b/mathFunctions/furtherMathFunctions.h index 9092fa2e1..9ed70cbfc 100644 --- a/mathFunctions/furtherMathFunctions.h +++ b/mathFunctions/furtherMathFunctions.h @@ -165,19 +165,15 @@ enum estimatedFunction {FUNCTION_CODE_SPHERICAL, FUNCTION_CODE_LINEAR, FUNCTION_ std::vector ¶meters, std::vector ¶metersDelta, int maxIterationsNr, double myEpsilon, std::vector & x, std::vector& y); - double bestFittingMarquardt_nDimension_singleFunction(double (*func)(double, std::vector&), - int nrTrials, int nrMinima, + double bestFittingMarquardt_nDimension_singleFunction(double (*func)(double, std::vector&), int nrMinima, std::vector & parametersMin, std::vector & parametersMax, std::vector & parameters, std::vector & parametersDelta, - std::vector &stepSize, int numSteps, int maxIterationsNr, double myEpsilon, double deltaR2, std::vector & x , std::vector& y, std::vector& weights, std::vector > firstGuessCombinations); - double bestFittingMarquardt_nDimension_singleFunction(double (*func)(double, std::vector&), - int nrTrials, int nrMinima, + double bestFittingMarquardt_nDimension_singleFunction(double (*func)(double, std::vector&), int nrMinima, std::vector & parametersMin, std::vector & parametersMax, std::vector & parameters, std::vector & parametersDelta, - std::vector &stepSize, int numSteps, int maxIterationsNr, double myEpsilon, double deltaR2, std::vector & x , std::vector& y, std::vector > firstGuessCombinations);