Import Geant4 11.3.0 source tree
This commit is contained in:
@@ -73,7 +73,7 @@ class G4ConvergenceTester
|
||||
|
||||
inline G4double GetValueOfMinimizingFunction(std::vector<G4double> x)
|
||||
{
|
||||
return slope_fitting_function(x);
|
||||
return slope_fitting_function(std::move(x));
|
||||
}
|
||||
|
||||
void ComputeStatistics() { calStat(); }
|
||||
|
||||
@@ -64,7 +64,7 @@ class G4SimplexDownhill
|
||||
private:
|
||||
G4double getValue(std::vector<G4double> x)
|
||||
{
|
||||
return target->GetValueOfMinimizingFunction(x);
|
||||
return target->GetValueOfMinimizingFunction(std::move(x));
|
||||
}
|
||||
|
||||
void initialize();
|
||||
|
||||
@@ -113,12 +113,12 @@ void G4SimplexDownhill<T>::initialize()
|
||||
{
|
||||
std::vector<G4double> avec(numberOfVariable, 0.0);
|
||||
avec[i] = 1.0;
|
||||
currentSimplex[i] = avec;
|
||||
currentSimplex[i] = std::move(avec);
|
||||
}
|
||||
|
||||
// std::vector< G4double > avec ( numberOfVariable , 0.0 );
|
||||
std::vector<G4double> avec(numberOfVariable, 1);
|
||||
currentSimplex[numberOfVariable] = avec;
|
||||
currentSimplex[numberOfVariable] = std::move(avec);
|
||||
}
|
||||
|
||||
template <class T>
|
||||
@@ -200,8 +200,6 @@ std::vector<G4double> G4SimplexDownhill<T>::getContractionPoint(
|
||||
template <class T>
|
||||
G4bool G4SimplexDownhill<T>::isItGoodEnough()
|
||||
{
|
||||
G4bool result = false;
|
||||
|
||||
G4double sum =
|
||||
std::accumulate(currentHeights.begin(), currentHeights.end(), 0.0);
|
||||
G4double average = sum / (numberOfVariable + 1);
|
||||
@@ -212,11 +210,11 @@ G4bool G4SimplexDownhill<T>::isItGoodEnough()
|
||||
delta += std::abs(currentHeights[i] - average);
|
||||
}
|
||||
|
||||
if(delta / (numberOfVariable + 1) / average < max_ratio)
|
||||
G4bool result = false;
|
||||
if (average > 0.0)
|
||||
{
|
||||
result = true;
|
||||
result = ((delta / (numberOfVariable + 1) / average) < max_ratio);
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
@@ -274,19 +272,19 @@ void G4SimplexDownhill<T>::doDownhill()
|
||||
{
|
||||
// EXPANSION
|
||||
std::vector<G4double> expansionPoint =
|
||||
getExpansionPoint(reflectionPoint, centroidPoint);
|
||||
getExpansionPoint(reflectionPoint, std::move(centroidPoint));
|
||||
G4double hh = getValue(expansionPoint);
|
||||
|
||||
if(hh <= h_L)
|
||||
{
|
||||
// Replace
|
||||
currentSimplex[ih] = expansionPoint;
|
||||
currentSimplex[ih] = std::move(expansionPoint);
|
||||
// G4cout << "A" << G4endl;
|
||||
}
|
||||
else
|
||||
{
|
||||
// Replace
|
||||
currentSimplex[ih] = reflectionPoint;
|
||||
currentSimplex[ih] = std::move(reflectionPoint);
|
||||
// G4cout << "B1" << G4endl;
|
||||
}
|
||||
}
|
||||
@@ -295,7 +293,7 @@ void G4SimplexDownhill<T>::doDownhill()
|
||||
if(h <= h_H2)
|
||||
{
|
||||
// Replace
|
||||
currentSimplex[ih] = reflectionPoint;
|
||||
currentSimplex[ih] = std::move(reflectionPoint);
|
||||
// G4cout << "B2" << G4endl;
|
||||
}
|
||||
else
|
||||
@@ -303,17 +301,17 @@ void G4SimplexDownhill<T>::doDownhill()
|
||||
if(h <= h_H)
|
||||
{
|
||||
// Replace
|
||||
currentSimplex[ih] = reflectionPoint;
|
||||
currentSimplex[ih] = std::move(reflectionPoint);
|
||||
// G4cout << "BC" << G4endl;
|
||||
}
|
||||
// CONTRACTION
|
||||
std::vector<G4double> contractionPoint =
|
||||
getContractionPoint(currentSimplex[ih], centroidPoint);
|
||||
getContractionPoint(currentSimplex[ih], std::move(centroidPoint));
|
||||
G4double hh = getValue(contractionPoint);
|
||||
if(hh <= h_H)
|
||||
{
|
||||
// Replace
|
||||
currentSimplex[ih] = contractionPoint;
|
||||
currentSimplex[ih] = std::move(contractionPoint);
|
||||
// G4cout << "C" << G4endl;
|
||||
}
|
||||
else
|
||||
@@ -326,7 +324,7 @@ void G4SimplexDownhill<T>::doDownhill()
|
||||
{
|
||||
vec[k] = (currentSimplex[j][k] + currentSimplex[il][k]) / 2.0;
|
||||
}
|
||||
currentSimplex[j] = vec;
|
||||
currentSimplex[j] = std::move(vec);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user