Skip to content

Newton-Raphson method used in Curve adaptation#7

Open
teensp1rit wants to merge 1 commit intocedra-library:mainfrom
teensp1rit:irs-newton-raphson
Open

Newton-Raphson method used in Curve adaptation#7
teensp1rit wants to merge 1 commit intocedra-library:mainfrom
teensp1rit:irs-newton-raphson

Conversation

@teensp1rit
Copy link
Contributor

@teensp1rit teensp1rit commented Feb 22, 2026

Issue: #5

  • Some target function derivation attempts left as deprecated as it might get useful in future
  • HolidayStorage CountBusinessDays between two dates

- Some target function derivation attempts left as deprecated as it
  might get useful in future
- HolidayStorage CountBusinessDays between two dates

Signed-off-by: ilya <iliya.alimov@gmail.com>
@teensp1rit teensp1rit requested a review from bersen66 February 22, 2026 14:16
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

В будущем может понадобиться PUBLIC, если код пользователя будет использовать компонент библиотеки:

cdr_cpp_library(
  NAME math
  HDRS
    "newton_raphson/newton_raphson.h"
  SRCS
    "newton_raphson/newton_raphson.cc"
  DEPS
    cdr::base
    cdr::types
  PUBLIC # TO MAKE VISIBLE AFTER INSTALLING
)

auto dpv_fixed = dPVFixed(curve, date, rate);
auto dpv_float = dPVFloat(curve, date, rate);
if (!dpv_fixed.has_value() || !dpv_float.has_value()) [[unlikely]] {
return std::nullopt;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Мб Expect-ом сделать? Чтобы яснее было в чем проблема на стороне юзера

[[nodiscard]] std::optional<f64> IrsContract::dPVFixed(Curve *curve, const DateType& date, Percent rate) const noexcept {
const auto& pillars = curve->Pillars();
auto node = pillars.find(date);
CDR_CHECK(node != pillars.end()) << "date should be present";
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Тут тоже, чтобы не дернулся std::terminate

HolidayStorage* calendar_;
};

class CurveBuilder {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

TODO, получается

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.

2 participants