Skip to content

Deep copy LALpars when caching waveform

Description

LALSimulation's waveform caching functions are used by LALInference to avoid recomputing the waveform if only the extrinsic parameters change. The caching function compare the values of the parameters for the previously generated waveform and check if the same values are used in the next call. Unfortunately, for parameters stored in the LALPars structure (specifically the lambda parameters for tidal deformability), there is an issue because LALPars is a pointer, and the pointer itself is copied rather than its contents. So when the code goes to check that the cached parameters are equal to the new parameters it will always find that they are, since the pointer is the same.

LALInferenceMCMC was encountering this problem when changing the lambda parameters and none of the other intrinsic parameters. Other non-GR parameters are potentially affected unless they are included in this list. LALInferenceNest should be immune to this issue because (a) it runs hundreds of parallel chains so subsequent samples are not coming from subsequent steps in a markov chain and (b) it only uses jump proposals which vary all the instrinsic parameters simultaneously.

This merge request solves the problem by deep-copying the LALpars to the cache. It also introduces a new convenience function XLALCopyDict() to perform the deep copy.

API Changes and Justification

Backwards Compatible Changes

  • This change introduces no API changes
  • This change adds new API calls

Backwards Incompatible Changes

  • This change modifies an existing API
  • This change removes an existing API

If any of the Backwards Incompatible check boxes are ticked please provide a justification why this change is necessary and why it needs to be done in a backwards incompatible way.

Review Status

Please provide details on any reviews related to this change and and the associated reviewers.

Merge request reports