Skip to content

Commit

Permalink
PERF: Let ComputeDisplacementDistribution do JGG_k.reserve
Browse files Browse the repository at this point in the history
May improve runtime performance.
  • Loading branch information
N-Dekker committed Jul 1, 2024
1 parent 13e78bf commit 5259688
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions Common/itkComputeDisplacementDistribution.hxx
Original file line number Diff line number Diff line change
Expand Up @@ -143,10 +143,13 @@ ComputeDisplacementDistribution<TFixedImage, TTransform>::ComputeSingleThreaded(
*/
DerivativeType Jgg(outdim);
Jgg.Fill(0.0);

std::vector<double> JGG_k;
double globalDeformation = 0.0;
const double sqrt2 = std::sqrt(static_cast<double>(2.0));
JacobianType jacjjacj(outdim, outdim);
JGG_k.reserve(nrofsamples);

double globalDeformation = 0.0;
const double sqrt2 = std::sqrt(static_cast<double>(2.0));
JacobianType jacjjacj(outdim, outdim);

samplenr = 0;
for (const auto & sample : *sampleContainer)
Expand Down Expand Up @@ -511,8 +514,11 @@ ComputeDisplacementDistribution<TFixedImage, TTransform>::ComputeUsingSearchDire
*/
DerivativeType Jgg(outdim);
Jgg.Fill(0.0);

std::vector<double> JGG_k;
double globalDeformation = 0.0;
JGG_k.reserve(nrofsamples);

double globalDeformation = 0.0;

samplenr = 0;
for (const auto & sample : *sampleContainer)
Expand Down

0 comments on commit 5259688

Please sign in to comment.