Skip to content

Define and correctly spell SabrParametricVolatility calibration-grid axis accessors - #348

Open
mattmenefee wants to merge 1 commit into
OpenSourceRisk:masterfrom
mattmenefee:sabr-calibration-grid-accessors
Open

Define and correctly spell SabrParametricVolatility calibration-grid axis accessors#348
mattmenefee wants to merge 1 commit into
OpenSourceRisk:masterfrom
mattmenefee:sabr-calibration-grid-accessors

Conversation

@mattmenefee

Copy link
Copy Markdown
Contributor

Summary

SabrParametricVolatility declares two accessors for its calibration-grid axes in qle/termstructures/sabrparametricvolatility.hpp:

// the calculated grid of option expiries and the underlying lenghts
const std::vector<Real>& timeToEpiries() const;
const std::vector<Real>& underlyingLenghts() const;

Neither is defined in sabrparametricvolatility.cpp or anywhere else in the tree, so calling either one fails at link time with an undefined symbol. This PR:

  • Defines both accessors to return the existing timeToExpiries_ / underlyingLengths_ members.
  • Corrects the misspelled names — timeToEpiriestimeToExpiries, underlyingLenghtsunderlyingLengths — along with the lenghts typos in the two adjacent comments.

Why this matters

The class publicly exposes its calibration results as matrices — alpha(), beta(), nu(), rho(), lognormalShift(), numberOfCalibrationAttempts(), calibrationError(), isInterpolated() — laid out as rows = underlying lengths, cols = option expiries. Without the axis vectors, a caller cannot map a matrix cell back to the (timeToExpiry, underlyingLength) node it was calibrated at, which makes the matrices unusable for per-pillar calibration diagnostics or reporting.

On the rename

Renaming a public accessor would normally be a source-breaking change. It is not one here: since neither function was ever defined, no code could have linked against the old spellings. Correcting them now is free; after the definitions ship it stops being free.

Happy to drop the rename and keep the original spellings if you would rather preserve the declared names verbatim — the definitions are the substantive part of the change.

Test plan

  • QuantExt compiles and links cleanly with the change
  • Both symbols are present in the resulting libQuantExt binary
  • Repo-wide grep confirms no other references to the old spellings existed

The accessors exposing the calibration grid axes were declared on
SabrParametricVolatility but never defined, so any call to them failed to
link. Without them the public alpha(), beta(), nu(), rho() and
calibrationError() matrices - stored as rows = underlying lengths, cols =
option expiries - cannot be mapped back to the (timeToExpiry,
underlyingLength) grid nodes they describe.

Define both accessors to return the existing timeToExpiries_ and
underlyingLengths_ members, and correct their misspelled names while they
are still uncallable:

- timeToEpiries() becomes timeToExpiries()
- underlyingLenghts() becomes underlyingLengths()

Because neither function was ever defined, no caller could have linked
against the old spellings, so the rename breaks no existing code.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant