diff --git a/.appveyor.yml b/.appveyor.yml index dfce3321421..172d40e1d12 100644 --- a/.appveyor.yml +++ b/.appveyor.yml @@ -8,7 +8,7 @@ configuration: Release version: ci.{build} build: - parallel: true + parallel: false project: QuantLib.sln verbosity: normal diff --git a/.clang-tidy b/.clang-tidy index bbd6dfac185..44a451c22f7 100644 --- a/.clang-tidy +++ b/.clang-tidy @@ -5,9 +5,12 @@ Checks: > -bugprone-assignment-in-if-condition, -bugprone-branch-clone, -bugprone-easily-swappable-parameters, + -bugprone-empty-catch, -bugprone-implicit-widening-of-multiplication-result, -bugprone-macro-parentheses, + -bugprone-multiple-new-in-one-expression, -bugprone-narrowing-conversions, + -bugprone-non-zero-enum-to-bool-conversion, -bugprone-suspicious-include, clang-analyzer-*, -clang-analyzer-core.UndefinedBinaryOperatorResult, @@ -34,10 +37,10 @@ Checks: > -cppcoreguidelines-pro-type-const-cast, -cppcoreguidelines-pro-type-member-init, -cppcoreguidelines-pro-type-vararg, - -cppcoreguidelines-special-member-functions, misc-*, -misc-confusable-identifiers, -misc-const-correctness, + -misc-include-cleaner, -misc-no-recursion, -misc-non-private-member-variables-in-classes, -misc-use-anonymous-namespace, @@ -51,6 +54,8 @@ Checks: > -modernize-use-trailing-return-type, -modernize-use-using, performance-*, + -performance-avoid-endl, + -performance-enum-size, readability-*, -readability-braces-around-statements, -readability-const-return-type, @@ -70,6 +75,8 @@ Checks: > HeaderFilterRegex: '.*' FormatStyle: file CheckOptions: + - key: cppcoreguidelines-special-member-functions.AllowSoleDefaultDtor + value: 1 - key: modernize-use-default-member-init.UseAssignment value: 1 ... diff --git a/.github/workflows/cmake.yml b/.github/workflows/cmake.yml index 1d65d2356bb..74bb7ae7978 100644 --- a/.github/workflows/cmake.yml +++ b/.github/workflows/cmake.yml @@ -21,12 +21,13 @@ jobs: run: | mkdir build cd build - cmake .. -GNinja -DBOOST_ROOT=/usr -DCMAKE_BUILD_TYPE=Release -DCMAKE_CXX_COMPILER_LAUNCHER=ccache - cmake --build . + cmake .. -GNinja -DBOOST_ROOT=/usr -DCMAKE_BUILD_TYPE=Release -DQL_COMPILE_WARNING_AS_ERROR=ON -DCMAKE_CXX_COMPILER_LAUNCHER=ccache -L + cmake --build . --verbose + sudo cmake --install . + sudo ldconfig - name: Test run: | - cd build - ./test-suite/quantlib-test-suite --log_level=message + quantlib-test-suite --log_level=message cmake-linux-with-options: runs-on: ubuntu-latest steps: @@ -45,12 +46,13 @@ jobs: cmake-linux-ci-opts- - name: Compile run: | - cmake --preset linux-ci-build-with-nonstandard-options - cmake --build --preset linux-ci-build-with-nonstandard-options + cmake --preset linux-ci-build-with-nonstandard-options -L + cd build/linux-ci-build-with-nonstandard-options + cmake --build . --verbose + sudo cmake --build . --target install - name: Test run: | - cd build - ./test-suite/quantlib-test-suite --log_level=message + quantlib-test-suite --log_level=message cmake-win: runs-on: windows-2022 steps: @@ -66,7 +68,7 @@ jobs: variant: sccache - name: Setup run: | - $Url = "https://boostorg.jfrog.io/artifactory/main/release/1.81.0/binaries/boost_1_81_0-msvc-14.3-64.exe" + $Url = "https://boostorg.jfrog.io/artifactory/main/release/1.82.0/binaries/boost_1_82_0-msvc-14.3-64.exe" (New-Object System.Net.WebClient).DownloadFile($Url, "$env:TEMP\boost.exe") Start-Process -Wait -FilePath "$env:TEMP\boost.exe" "/SILENT","/SP-","/SUPPRESSMSGBOXES","/DIR=C:\local\boost" choco install -y ninja @@ -78,13 +80,13 @@ jobs: mkdir build cd build call "C:\Program Files\Microsoft Visual Studio\2022\Enterprise\Vc\Auxiliary\Build\vcvarsall.bat" amd64 -vcvars_ver=14.3 || exit 1 - cmake .. -GNinja -DCMAKE_BUILD_TYPE=Release -DCMAKE_CXX_COMPILER_LAUNCHER=sccache + cmake .. -GNinja -DCMAKE_BUILD_TYPE=Release -DQL_COMPILE_WARNING_AS_ERROR=ON -DCMAKE_CXX_COMPILER_LAUNCHER=sccache -L cmake --build . --verbose + cmake --install . dir ql\*.lib - name: Test run: | - cd build - .\test-suite\quantlib-test-suite --log_level=message + & "C:\Program Files (x86)\QuantLib\bin\quantlib-test-suite" --log_level=message cmake-win-dynamic-runtime: runs-on: windows-2022 steps: @@ -100,7 +102,7 @@ jobs: variant: sccache - name: Setup run: | - $Url = "https://boostorg.jfrog.io/artifactory/main/release/1.81.0/binaries/boost_1_81_0-msvc-14.3-64.exe" + $Url = "https://boostorg.jfrog.io/artifactory/main/release/1.82.0/binaries/boost_1_82_0-msvc-14.3-64.exe" (New-Object System.Net.WebClient).DownloadFile($Url, "$env:TEMP\boost.exe") Start-Process -Wait -FilePath "$env:TEMP\boost.exe" "/SILENT","/SP-","/SUPPRESSMSGBOXES","/DIR=C:\local\boost" choco install -y ninja @@ -112,13 +114,13 @@ jobs: mkdir build cd build call "C:\Program Files\Microsoft Visual Studio\2022\Enterprise\Vc\Auxiliary\Build\vcvarsall.bat" amd64 -vcvars_ver=14.3 || exit 1 - cmake .. -GNinja -DCMAKE_MSVC_RUNTIME_LIBRARY=MultiThreadedDLL -DCMAKE_BUILD_TYPE=Release -DCMAKE_CXX_COMPILER_LAUNCHER=sccache + cmake .. -GNinja -DCMAKE_MSVC_RUNTIME_LIBRARY=MultiThreadedDLL -DCMAKE_BUILD_TYPE=Release -DQL_COMPILE_WARNING_AS_ERROR=ON -DCMAKE_CXX_COMPILER_LAUNCHER=sccache -L cmake --build . --verbose + cmake --install . dir ql\*.lib - name: Test run: | - cd build - .\test-suite\quantlib-test-suite --log_level=message + & "C:\Program Files (x86)\QuantLib\bin\quantlib-test-suite" --log_level=message cmake-win-with-options: runs-on: windows-2022 steps: @@ -134,7 +136,7 @@ jobs: variant: sccache - name: Setup run: | - $Url = "https://boostorg.jfrog.io/artifactory/main/release/1.81.0/binaries/boost_1_81_0-msvc-14.3-64.exe" + $Url = "https://boostorg.jfrog.io/artifactory/main/release/1.82.0/binaries/boost_1_82_0-msvc-14.3-64.exe" (New-Object System.Net.WebClient).DownloadFile($Url, "$env:TEMP\boost.exe") Start-Process -Wait -FilePath "$env:TEMP\boost.exe" "/SILENT","/SP-","/SUPPRESSMSGBOXES","/DIR=C:\local\boost" choco install -y ninja @@ -144,12 +146,13 @@ jobs: shell: cmd run: | call "C:\Program Files\Microsoft Visual Studio\2022\Enterprise\Vc\Auxiliary\Build\vcvarsall.bat" amd64 -vcvars_ver=14.3 || exit 1 - cmake --preset windows-ci-build-with-nonstandard-options - cmake --build --preset windows-ci-build-with-nonstandard-options + cmake --preset windows-ci-build-with-nonstandard-options -L + cd build/windows-ci-build-with-nonstandard-options + cmake --build . --verbose + cmake --build . --target install - name: Test run: | - cd build - .\test-suite\quantlib-test-suite --log_level=message + & "C:\Program Files (x86)\QuantLib\bin\quantlib-test-suite" --log_level=message cmake-macos: runs-on: macos-latest steps: @@ -171,9 +174,9 @@ jobs: run: | mkdir build cd build - cmake .. -DCMAKE_BUILD_TYPE=Release -DCMAKE_CXX_COMPILER_LAUNCHER=ccache -GNinja - cmake --build . + cmake .. -DCMAKE_BUILD_TYPE=Release -DQL_COMPILE_WARNING_AS_ERROR=ON -DCMAKE_CXX_COMPILER_LAUNCHER=ccache -GNinja -L + cmake --build . --verbose + cmake --install . - name: Test run: | - cd build - ./test-suite/quantlib-test-suite --log_level=message + quantlib-test-suite --log_level=message diff --git a/.github/workflows/copyrights.yml b/.github/workflows/copyrights.yml index 758d57d8a84..6c8b4b94069 100644 --- a/.github/workflows/copyrights.yml +++ b/.github/workflows/copyrights.yml @@ -11,10 +11,10 @@ jobs: - name: Check run: | ./tools/check_copyrights.sh - - uses: peter-evans/create-pull-request@v4 + - uses: peter-evans/create-pull-request@v5 with: token: ${{ secrets.GITHUB_TOKEN }} - branch: update-copyright-list-${{ github.ref }} + branch: update-copyright-list-${{ github.ref_name }} delete-branch: true commit-message: 'Update copyright list in license' title: 'Update copyright list in license' diff --git a/.github/workflows/generated-headers.yml b/.github/workflows/generated-headers.yml index 98792e4296b..b078946af70 100644 --- a/.github/workflows/generated-headers.yml +++ b/.github/workflows/generated-headers.yml @@ -21,10 +21,10 @@ jobs: find ql -name *.am | xargs touch make dist rm QuantLib-*.tar.gz - - uses: peter-evans/create-pull-request@v4 + - uses: peter-evans/create-pull-request@v5 with: token: ${{ secrets.GITHUB_TOKEN }} - branch: update-generated-headers-${{ github.ref }} + branch: update-generated-headers-${{ github.ref_name }} delete-branch: true commit-message: 'Update generated headers' title: 'Update generated headers' diff --git a/.github/workflows/linux-full-tests.yml b/.github/workflows/linux-full-tests.yml index 874d3ffcfa2..d220a6b5566 100644 --- a/.github/workflows/linux-full-tests.yml +++ b/.github/workflows/linux-full-tests.yml @@ -47,7 +47,7 @@ jobs: cxx: g++ - name: "gcc 12.x" shortname: gcc12 - tag: kinetic + tag: lunar cc: gcc cxx: g++ - name: "Clang 6 (Boost 1.72)" @@ -97,7 +97,7 @@ jobs: cxx: clang++ - name: "Clang 15" shortname: clang15 - tag: kinetic + tag: lunar cc: clang cxx: clang++ - name: "C++14 mode" @@ -130,18 +130,24 @@ jobs: cc: gcc cxx: g++ configureflags: --enable-intraday + - name: "Throwing in cycles enabled" + shortname: cycles + tag: rolling + cc: gcc + cxx: g++ + configureflags: --enable-throwing-in-cycles --disable-faster-lazy-objects - name: "Indexed coupons enabled" shortname: indexed tag: rolling cc: gcc cxx: g++ configureflags: --enable-indexed-coupons - - name: "Standard Library classes enabled" + - name: "Standard Library classes enabled/disabled" shortname: stdclasses tag: rolling cc: gcc cxx: g++ - configureflags: --enable-std-classes + configureflags: --disable-std-function --disable-std-tuple --enable-std-pointers --enable-std-any --enable-std-optional - name: "Thread-safe observer enabled" shortname: threadsafe tag: rolling diff --git a/.github/workflows/linux-nondefault.yml b/.github/workflows/linux-nondefault.yml index fa2ec78ab50..81efd95976c 100644 --- a/.github/workflows/linux-nondefault.yml +++ b/.github/workflows/linux-nondefault.yml @@ -47,7 +47,7 @@ jobs: cxx: g++ - name: "gcc 12.x" shortname: gcc12 - tag: kinetic + tag: lunar cc: gcc cxx: g++ - name: "Clang 6 (Boost 1.72)" @@ -97,7 +97,7 @@ jobs: cxx: clang++ - name: "Clang 15" shortname: clang15 - tag: kinetic + tag: lunar cc: clang cxx: clang++ - name: "C++14 mode" @@ -124,13 +124,13 @@ jobs: cc: gcc cxx: g++ configureflags: --enable-unity-build - - name: "Standard Library classes enabled" + - name: "Standard Library classes enabled/disabled" shortname: stdclasses tag: rolling cc: gcc cxx: g++ cxxflags: "-std=c++17" - configureflags: --enable-std-classes + configureflags: --disable-std-function --disable-std-tuple --enable-std-pointers --enable-std-any --enable-std-optional - name: "OpenMP enabled" shortname: openmp tag: rolling @@ -146,7 +146,7 @@ jobs: - name: Build run: | ./autogen.sh - ./configure --disable-static --enable-error-lines --enable-error-functions --enable-tracing --enable-indexed-coupons --enable-extra-safety-checks --enable-sessions --enable-thread-safe-observer-pattern --enable-intraday --enable-null-as-functions ${{ matrix.configureflags }} CC="${{ matrix.cc }}" CXX="${{ matrix.cxx }}" CXXFLAGS="-O2 -g0 -Wall -Wno-unknown-pragmas -Werror ${{ matrix.cxxflags }}" + ./configure --disable-static --enable-error-lines --enable-error-functions --enable-tracing --enable-indexed-coupons --enable-extra-safety-checks --enable-sessions --enable-thread-safe-observer-pattern --enable-intraday --disable-faster-lazy-objects --enable-throwing-in-cycles --enable-null-as-functions ${{ matrix.configureflags }} CC="${{ matrix.cc }}" CXX="${{ matrix.cxx }}" CXXFLAGS="-O2 -g0 -Wall -Wno-unknown-pragmas -Werror ${{ matrix.cxxflags }}" make -j 2 - name: Run tests run: | diff --git a/.github/workflows/linux.yml b/.github/workflows/linux.yml index e92e667d923..7ed2fc088ee 100644 --- a/.github/workflows/linux.yml +++ b/.github/workflows/linux.yml @@ -45,7 +45,7 @@ jobs: tests: true - name: "gcc 12.x" shortname: gcc12 - tag: kinetic + tag: lunar cc: gcc cxx: g++ tests: true @@ -97,7 +97,7 @@ jobs: tests: true - name: "Clang 15" shortname: clang15 - tag: kinetic + tag: lunar cc: clang cxx: clang++ tests: true @@ -132,6 +132,13 @@ jobs: cxx: g++ configureflags: --enable-intraday tests: true + - name: "Throwing in cycles enabled" + shortname: cycles + tag: rolling + cc: gcc + cxx: g++ + configureflags: --enable-throwing-in-cycles --disable-faster-lazy-objects + tests: true - name: "Indexed coupons enabled" shortname: indexed tag: rolling @@ -139,12 +146,12 @@ jobs: cxx: g++ configureflags: --enable-indexed-coupons tests: true - - name: "Standard Library classes enabled" + - name: "Standard Library classes enabled/disabled" shortname: stdclasses tag: rolling cc: gcc cxx: g++ - configureflags: --enable-std-classes + configureflags: --disable-std-function --disable-std-tuple --enable-std-pointers --enable-std-any --enable-std-optional tests: true - name: "Thread-safe observer enabled" shortname: threadsafe diff --git a/.github/workflows/macos-nondefault.yml b/.github/workflows/macos-nondefault.yml index 6b6a57e31cb..fb91168678b 100644 --- a/.github/workflows/macos-nondefault.yml +++ b/.github/workflows/macos-nondefault.yml @@ -15,13 +15,13 @@ jobs: - os: [macos-11] shortname: stdclasses-11 cxxflags: "-std=c++17" - configureflags: --enable-std-classes + configureflags: --disable-std-function --disable-std-tuple --enable-std-pointers --enable-std-optional - os: [macos-12] shortname: default-12 - os: [macos-12] shortname: stdclasses-12 cxxflags: "-std=c++17" - configureflags: --enable-std-classes + configureflags: --disable-std-function --disable-std-tuple --enable-std-pointers --enable-std-optional steps: - uses: actions/checkout@v3 - name: Setup @@ -30,7 +30,7 @@ jobs: - name: Build run: | ./autogen.sh - ./configure --disable-shared --enable-error-lines --enable-error-functions --enable-tracing --enable-indexed-coupons --enable-extra-safety-checks --enable-sessions --enable-thread-safe-observer-pattern --enable-intraday --enable-null-as-functions ${{ matrix.configureflags }} CC="clang" CXX="clang++" CXXFLAGS="-O2 -g0 -Wall -Werror -stdlib=libc++ -mmacosx-version-min=10.9 ${{ matrix.cxxflags }}" LDFLAGS="-stdlib=libc++ -mmacosx-version-min=10.9" + ./configure --disable-shared --enable-error-lines --enable-error-functions --enable-tracing --enable-indexed-coupons --enable-extra-safety-checks --enable-sessions --enable-thread-safe-observer-pattern --enable-intraday --disable-faster-lazy-objects --enable-throwing-in-cycles --enable-null-as-functions ${{ matrix.configureflags }} CC="clang" CXX="clang++" CXXFLAGS="-O2 -g0 -Wall -Werror -stdlib=libc++ -mmacosx-version-min=10.9 ${{ matrix.cxxflags }}" LDFLAGS="-stdlib=libc++ -mmacosx-version-min=10.9" make -j 3 - name: Run tests run: | diff --git a/.github/workflows/misspell.yml b/.github/workflows/misspell.yml index 8168bad0e29..45e3f4d3f18 100644 --- a/.github/workflows/misspell.yml +++ b/.github/workflows/misspell.yml @@ -9,10 +9,10 @@ jobs: steps: - uses: actions/checkout@v3 - uses: sobolevn/misspell-fixer-action@master - - uses: peter-evans/create-pull-request@v4 + - uses: peter-evans/create-pull-request@v5 with: token: ${{ secrets.GITHUB_TOKEN }} - branch: misspell-fixes-${{ github.ref }} + branch: misspell-fixes-${{ github.ref_name }} delete-branch: true commit-message: 'Fixes by misspell-fixer' title: 'Typos fixed by misspell-fixer' diff --git a/.github/workflows/sanitizer.yml b/.github/workflows/sanitizer.yml index 488b4cd535d..85270c91af0 100644 --- a/.github/workflows/sanitizer.yml +++ b/.github/workflows/sanitizer.yml @@ -4,7 +4,7 @@ on: - cron: '0 0 * * 0' workflow_dispatch: jobs: - sanitize: + sanitize-address-undefined: runs-on: ubuntu-latest container: ghcr.io/lballabio/quantlib-devenv:rolling steps: @@ -17,6 +17,25 @@ jobs: ./autogen.sh ./configure --disable-static CC="gcc" CXX="g++" CXXFLAGS="-O2 -g0 -fsanitize=address,undefined -fno-sanitize-recover=all -fno-omit-frame-pointer -Wall -Wno-unknown-pragmas -Werror" make -j 2 + - name: Run tests + run: | + LSAN_OPTIONS=suppressions=.lsan.txt ./test-suite/quantlib-test-suite --log_level=message + - name: Run examples + run: | + make check-examples + sanitize-thread: + runs-on: ubuntu-latest + container: ghcr.io/lballabio/quantlib-devenv:rolling + steps: + - uses: actions/checkout@v3 + - name: Compiler version + run: | + gcc --version + - name: Build + run: | + ./autogen.sh + ./configure --disable-static --enable-sessions --enable-thread-safe-observer-pattern CC="gcc" CXX="g++" CXXFLAGS="-O2 -g0 -fsanitize=thread -fno-sanitize-recover=all -Wall -Wno-unknown-pragmas -Werror" + make -j 2 - name: Run tests run: | ./test-suite/quantlib-test-suite --log_level=message diff --git a/.github/workflows/stale.yml b/.github/workflows/stale.yml index aa734cbc9a0..d09494439aa 100644 --- a/.github/workflows/stale.yml +++ b/.github/workflows/stale.yml @@ -6,7 +6,7 @@ jobs: staleness-check: runs-on: ubuntu-latest steps: - - uses: actions/stale@v7 + - uses: actions/stale@v8 with: repo-token: ${{ secrets.GITHUB_TOKEN }} stale-issue-message: 'This issue was automatically marked as stale because it has been open 60 days with no activity. Remove stale label or comment, or this will be closed in two weeks.' diff --git a/.github/workflows/test-times.yml b/.github/workflows/test-times.yml index 38529e18160..837fbe329af 100644 --- a/.github/workflows/test-times.yml +++ b/.github/workflows/test-times.yml @@ -22,16 +22,20 @@ jobs: ./autogen.sh ./configure --disable-static CC="ccache gcc" CXX="ccache g++" CXXFLAGS="-O2 -g0" make -j 2 - - name: Run tests + - name: Run faster tests run: | ./test-suite/quantlib-test-suite --logger=JUNIT,warning,faster.xml:HRF,message -- --faster + - name: Run fast tests + run: | ./test-suite/quantlib-test-suite --logger=JUNIT,warning,fast.xml:HRF,message -- --fast + - name: Run all tests + run: | ./test-suite/quantlib-test-suite --logger=JUNIT,warning,all.xml:HRF,message - name: Save test times uses: actions/upload-artifact@v3 with: name: test-reports - path: ./all.xml + path: ./*.xml - name: Check test times run: | python ./tools/check_test_times.py diff --git a/.github/workflows/tidy.yml b/.github/workflows/tidy.yml index c67c456ee19..dd4bb05f30e 100644 --- a/.github/workflows/tidy.yml +++ b/.github/workflows/tidy.yml @@ -15,11 +15,12 @@ jobs: - name: Check run: | cmake --preset linux-ci-build-with-clang-tidy - cmake --build --preset linux-ci-build-with-clang-tidy -j1 - - uses: peter-evans/create-pull-request@v4 + cd build/linux-ci-build-with-clang-tidy + cmake --build . -j1 + - uses: peter-evans/create-pull-request@v5 with: token: ${{ secrets.GITHUB_TOKEN }} - branch: clang-tidy-fixes-${{ github.ref }} + branch: clang-tidy-fixes-${{ github.ref_name }} delete-branch: true commit-message: 'Automated fixes by clang-tidy' title: 'Automated fixes by clang-tidy' diff --git a/.lsan.txt b/.lsan.txt new file mode 100644 index 00000000000..8b137891791 --- /dev/null +++ b/.lsan.txt @@ -0,0 +1 @@ + diff --git a/CMakeLists.txt b/CMakeLists.txt index 878c4d6b39b..b310d59f902 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -5,14 +5,14 @@ cmake_policy(SET CMP0091 NEW) # Version info set(QUANTLIB_VERSION_MAJOR 1) -set(QUANTLIB_VERSION_MINOR 30) +set(QUANTLIB_VERSION_MINOR 32) set(QUANTLIB_VERSION_PATCH 0) set(QUANTLIB_VERSION ${QUANTLIB_VERSION_MAJOR}.${QUANTLIB_VERSION_MINOR}.${QUANTLIB_VERSION_PATCH}) # Project Info set(PACKAGE_NAME "QuantLib") set(PACKAGE_VERSION "${QUANTLIB_VERSION}-dev") -set(PACKAGE_VERSION_HEX "0x01300000") +set(PACKAGE_VERSION_HEX "0x01320000") set(PACKAGE_STRING "${PACKAGE_NAME} ${PACKAGE_VERSION}") set(PACKAGE_TARNAME "${PACKAGE_NAME}-${PACKAGE_VERSION}") set(PACKAGE_BUGREPORT "https://github.com/lballabio/QuantLib/issues/") @@ -47,10 +47,14 @@ option(QL_ENABLE_PARALLEL_UNIT_TEST_RUNNER "Enable the parallel unit test runner option(QL_ENABLE_SESSIONS "Singletons return different instances for different sessions" OFF) option(QL_ENABLE_THREAD_SAFE_OBSERVER_PATTERN "Enable the thread-safe observer pattern" OFF) option(QL_ENABLE_TRACING "Tracing messages should be allowed" OFF) +option(QL_ENABLE_DEFAULT_WARNING_LEVEL "Enable the default warning level to pass the ci pipeline" ON) +option(QL_COMPILE_WARNING_AS_ERROR "Specify whether to treat warnings on compile as errors." OFF) option(QL_ERROR_FUNCTIONS "Error messages should include current function information" OFF) option(QL_ERROR_LINES "Error messages should include file and line information" OFF) option(QL_EXTRA_SAFETY_CHECKS "Extra safety checks should be performed" OFF) option(QL_HIGH_RESOLUTION_DATE "Enable date resolution down to microseconds" OFF) +option(QL_THROW_IN_CYCLES "Throw an exception when a notification loop is detected" OFF) +option(QL_FASTER_LAZY_OBJECTS "Cause lazy objects to forward just the first notification instead of every one" ON) option(QL_NULL_AS_FUNCTIONS "Enable the implementation of Null as template functions" OFF) option(QL_INSTALL_BENCHMARK "Install benchmark" ON) option(QL_INSTALL_EXAMPLES "Install examples" ON) @@ -58,20 +62,77 @@ option(QL_INSTALL_TEST_SUITE "Install test suite" ON) option(QL_TAGGED_LAYOUT "Library names use layout tags" ${MSVC}) option(QL_USE_CLANG_TIDY "Use clang-tidy when building" OFF) option(QL_USE_INDEXED_COUPON "Use indexed coupons instead of par coupons" OFF) +option(QL_USE_STD_ANY "Use std::any instead of boost::any" OFF) option(QL_USE_STD_CLASSES "Enable all QL_USE_STD_ options" OFF) +option(QL_USE_STD_FUNCTION "Use std::function and std::bind instead of Boost ones" ON) +option(QL_USE_STD_OPTIONAL "Use std::optional instead of boost::optional" OFF) option(QL_USE_STD_SHARED_PTR "Use standard smart pointers instead of Boost ones" OFF) -option(QL_USE_STD_FUNCTION "Use std::function and std::bind instead of Boost ones" OFF) -option(QL_USE_STD_TUPLE "Use std::tuple instead of boost::tuple" OFF) +option(QL_USE_STD_TUPLE "Use std::tuple instead of boost::tuple" ON) set(QL_EXTERNAL_SUBDIRECTORIES "" CACHE STRING "Optional list of external source directories to be added to the build (semicolon-separated)") set(QL_EXTRA_LINK_LIBRARIES "" CACHE STRING "Optional extra link libraries to add to QuantLib") +# Require C++14 or higher +if (NOT DEFINED CMAKE_CXX_STANDARD) + set(CMAKE_CXX_STANDARD 14) +elseif(CMAKE_CXX_STANDARD LESS 14) + message(FATAL_ERROR "Please specify CMAKE_CXX_STANDARD of 14 or higher") +endif() +if (NOT DEFINED CMAKE_CXX_STANDARD_REQUIRED) + set(CMAKE_CXX_STANDARD_REQUIRED ON) +endif() +# Avoid use of compiler language extensions, i.e. -std=c++14 not -std=gnu++14 +if (NOT DEFINED CMAKE_CXX_EXTENSIONS) + set(CMAKE_CXX_EXTENSIONS FALSE) +endif() + # Convenience option to activate all STD options if (QL_USE_STD_CLASSES) - set(QL_USE_STD_SHARED_PTR ON) + if (CMAKE_CXX_STANDARD GREATER_EQUAL 17) + set(QL_USE_STD_ANY ON) + set(QL_USE_STD_OPTIONAL ON) + endif() set(QL_USE_STD_FUNCTION ON) + set(QL_USE_STD_SHARED_PTR ON) set(QL_USE_STD_TUPLE ON) endif() +if (CMAKE_CXX_STANDARD LESS 17) + if (QL_USE_STD_ANY) + message(FATAL_ERROR "QL_USE_STD_ANY requires at least C++17") + endif() + if (QL_USE_STD_OPTIONAL) + message(FATAL_ERROR "QL_USE_STD_OPTIONAL requires at least C++17") + endif() +endif () + +# Set the default warning level we use to pass the GitHub workflows +if (QL_ENABLE_DEFAULT_WARNING_LEVEL) + if (MSVC) + # warning level 3 + # There are also specific warnings disabled for MSCV in cmake/Platform.cmake. + add_compile_options(-W3) + elseif (CMAKE_CXX_COMPILER_ID STREQUAL "GNU" OR CMAKE_CXX_COMPILER_ID STREQUAL "Clang" OR CMAKE_CXX_COMPILER_ID STREQUAL "AppleClang") + # lots of warnings + add_compile_options(-Wall -Wno-unknown-pragmas) + endif() +endif() + +# Treat warnings on compile as errors +if (QL_COMPILE_WARNING_AS_ERROR) + # all compiler warnings as errors + if (CMAKE_VERSION VERSION_GREATER_EQUAL "3.24.0") + # since v3.24 cmake can set all compiler warnings as errors itself + set(CMAKE_COMPILE_WARNING_AS_ERROR ON) + else() + # or set them manually + if (MSVC) + add_compile_options(-WX) + elseif (CMAKE_CXX_COMPILER_ID STREQUAL "GNU" OR CMAKE_CXX_COMPILER_ID STREQUAL "Clang" OR CMAKE_CXX_COMPILER_ID STREQUAL "AppleClang") + add_compile_options(-Werror) + endif() + endif() +endif() + if (QL_USE_CLANG_TIDY) if (NOT DEFINED QL_CLANG_TIDY) set(QL_CLANG_TIDY clang-tidy) @@ -101,20 +162,6 @@ if (NOT DEFINED Boost_USE_STATIC_RUNTIME) set(Boost_USE_STATIC_RUNTIME ${MSVC}) endif() -# Require C++14 or higher -if (NOT DEFINED CMAKE_CXX_STANDARD) - set(CMAKE_CXX_STANDARD 14) -elseif(CMAKE_CXX_STANDARD LESS 14) - message(FATAL_ERROR "Please specify CMAKE_CXX_STANDARD of 14 or higher") -endif() -if (NOT DEFINED CMAKE_CXX_STANDARD_REQUIRED) - set(CMAKE_CXX_STANDARD_REQUIRED ON) -endif() -# Avoid use of compiler language extensions, i.e. -std=c++14 not -std=gnu++14 -if (NOT DEFINED CMAKE_CXX_EXTENSIONS) - set(CMAKE_CXX_EXTENSIONS FALSE) -endif() - if (NOT DEFINED QL_BOOST_VERSION) # Boost 1.75.0 or greater required for compiling with C++20 if (CMAKE_CXX_STANDARD GREATER_EQUAL 20) @@ -174,6 +221,15 @@ set(QL_HEX_VERSION ${PACKAGE_VERSION_HEX}) configure_file(ql/config.hpp.cfg ql/config.hpp @ONLY) configure_file(ql/qldefines.hpp.cfg ql/qldefines.hpp @ONLY) + +# Generate quantlib-config +# Define the variables to be substituted in the input file +set(prefix ${CMAKE_INSTALL_PREFIX}) +set(exec_prefix "\${prefix}") +set(includedir "\${prefix}/include") +set(libdir "\${exec_prefix}/lib") +configure_file(quantlib-config.in quantlib-config @ONLY) + include(Platform) # Check for library name layout tagging diff --git a/CMakePresets.json b/CMakePresets.json index c3d473953be..3b0a6d9a837 100644 --- a/CMakePresets.json +++ b/CMakePresets.json @@ -1,207 +1,332 @@ { - "version": 2, + "version": 3, "configurePresets": [ { - "name": "linux-clang-debug", - "binaryDir": "${sourceDir}/build", - "generator": "Unix Makefiles", - "cacheVariables": { - "CMAKE_BUILD_TYPE": "Debug", - "CMAKE_CXX_COMPILER": "clang++" - } - }, - { - "name": "linux-clang-release", - "binaryDir": "${sourceDir}/build", - "generator": "Unix Makefiles", - "cacheVariables": { - "CMAKE_BUILD_TYPE": "Release", - "CMAKE_CXX_COMPILER": "clang++" - } - }, - { - "name": "linux-gcc-debug", - "binaryDir": "${sourceDir}/build", - "generator": "Unix Makefiles", - "cacheVariables": { - "CMAKE_BUILD_TYPE": "Debug", - "CMAKE_CXX_COMPILER": "g++" + "name": "windows-base", + "hidden": true, + "binaryDir": "${sourceDir}/build/${presetName}", + "architecture": { + "value": "x64", + "strategy": "external" + }, + "condition": { + "type": "equals", + "lhs": "${hostSystemName}", + "rhs": "Windows" } }, { - "name": "linux-gcc-release", - "binaryDir": "${sourceDir}/build", - "generator": "Unix Makefiles", + "name": "windows-msvc-base", + "hidden": true, + "inherits": "windows-base", "cacheVariables": { - "CMAKE_BUILD_TYPE": "Release", - "CMAKE_CXX_COMPILER": "g++" + "CMAKE_CXX_COMPILER": "cl.exe" + }, + "vendor": { + "microsoft.com/VisualStudioSettings/CMake/1.0": { + "intelliSenseMode": "windows-msvc-x64" + } } }, { - "name": "windows-clang-x64", - "binaryDir": "${sourceDir}/build", - "generator": "Ninja", + "name": "windows-clang-base", + "hidden": true, + "inherits": "windows-base", "cacheVariables": { - "CMAKE_CXX_COMPILER": "clang-cl", - "CMAKE_C_COMPILER": "clang-cl" - }, - "architecture": { - "value": "x64", - "strategy": "external" + "CMAKE_CXX_COMPILER": "clang-cl.exe" }, "vendor": { "microsoft.com/VisualStudioSettings/CMake/1.0": { - "intelliSenseMode": "windows-clang-x64", - "hostOS": [ - "Windows" - ] + "intelliSenseMode": "windows-clang-x64" } } }, { - "name": "windows-msvc-x64", - "binaryDir": "${sourceDir}/build", - "generator": "Ninja", - "architecture": { - "value": "x64", - "strategy": "external" + "name": "linux-base", + "hidden": true, + "binaryDir": "${sourceDir}/build/${presetName}", + "condition": { + "type": "equals", + "lhs": "${hostSystemName}", + "rhs": "Linux" }, "vendor": { + "microsoft.com/VisualStudioRemoteSettings/CMake/1.0": { + "sourceDir": "$env{HOME}/.vs/$ms{projectDirName}" + }, "microsoft.com/VisualStudioSettings/CMake/1.0": { - "intelliSenseMode": "windows-msvc-x64", + "intelliSenseMode": "linux-gcc-x64", "hostOS": [ - "Windows" + "Linux" ] } } }, { - "name": "linux-gcc-debug-with-clang-tidy", - "binaryDir": "${sourceDir}/build", - "generator": "Unix Makefiles", + "name": "linux-gcc-base", + "hidden": true, + "inherits": "linux-base", "cacheVariables": { - "CMAKE_BUILD_TYPE": "Debug", - "CMAKE_CXX_COMPILER": "g++", - "QL_CLANG_TIDY_OPTIONS": "-warnings-as-errors=*", - "QL_USE_CLANG_TIDY": "ON" + "CMAKE_CXX_COMPILER": "g++" } }, { - "name": "linux-ci-build-with-clang-tidy", - "binaryDir": "${sourceDir}/build", - "generator": "Unix Makefiles", + "name": "linux-clang-base", + "hidden": true, + "inherits": "linux-base", "cacheVariables": { - "BOOST_ROOT": "/usr", - "CMAKE_BUILD_TYPE": "Debug", - "CMAKE_CXX_COMPILER": "g++", - "CMAKE_UNITY_BUILD": "ON", - "QL_CLANG_TIDY": "clang-tidy-15", - "QL_CLANG_TIDY_OPTIONS": "-quiet;-fix", - "QL_USE_CLANG_TIDY": "ON", - "QL_USE_STD_CLASSES": "ON" + "CMAKE_CXX_COMPILER": "clang++" } }, { - "name": "linux-ci-build-with-nonstandard-options", - "binaryDir": "${sourceDir}/build", - "generator": "Ninja", + "name": "ninja", + "hidden": true, + "generator": "Ninja" + }, + { + "name": "make", + "hidden": true, + "generator": "Unix Makefiles" + }, + { + "name": "_release", + "hidden": true, "cacheVariables": { - "BOOST_ROOT": "/usr", - "CMAKE_BUILD_TYPE": "Release", - "CMAKE_CXX_COMPILER": "g++", - "CMAKE_CXX_STANDARD": "17", - "CMAKE_CXX_COMPILER_LAUNCHER": "ccache", - "QL_ENABLE_SESSIONS": "ON", - "QL_ENABLE_THREAD_SAFE_OBSERVER_PATTERN": "ON", - "QL_HIGH_RESOLUTION_DATE": "ON", - "QL_NULL_AS_FUNCTIONS": "ON", - "QL_USE_INDEXED_COUPON": "ON", - "QL_USE_STD_CLASSES": "ON" + "CMAKE_BUILD_TYPE": "Release" } }, { - "name": "windows-ci-build-with-nonstandard-options", - "binaryDir": "${sourceDir}/build", - "generator": "Ninja", - "architecture": { - "value": "x64", - "strategy": "external" - }, + "name": "_debug", + "hidden": true, "cacheVariables": { - "CMAKE_BUILD_TYPE": "Release", - "CMAKE_CXX_STANDARD": "17", - "CMAKE_UNITY_BUILD": "ON", - "QL_ENABLE_SESSIONS": "ON", - "QL_ENABLE_THREAD_SAFE_OBSERVER_PATTERN": "ON", - "QL_HIGH_RESOLUTION_DATE": "ON", - "QL_NULL_AS_FUNCTIONS": "ON", - "QL_USE_INDEXED_COUPON": "ON", - "QL_USE_STD_CLASSES": "ON", - "CMAKE_CXX_COMPILER_LAUNCHER": "sccache" - }, - "vendor": { - "microsoft.com/VisualStudioSettings/CMake/1.0": { - "intelliSenseMode": "windows-msvc-x64", - "hostOS": [ - "Windows" - ] - } + "CMAKE_BUILD_TYPE": "Debug" } - } - ], - "buildPresets": [ + }, + { + "name": "_relwithdebinfo", + "hidden": true, + "cacheVariables": { + "CMAKE_BUILD_TYPE": "RelWithDebInfo" + } + }, { "name": "linux-clang-debug", - "configurePreset": "linux-clang-debug" + "inherits": [ + "linux-clang-base", + "make", + "_debug" + ] }, { "name": "linux-clang-release", - "configurePreset": "linux-clang-release" + "inherits": [ + "linux-clang-base", + "make", + "_release" + ] + }, + { + "name": "linux-clang-relwithdebinfo", + "inherits": [ + "linux-clang-base", + "make", + "_relwithdebinfo" + ] }, { "name": "linux-gcc-debug", - "configurePreset": "linux-gcc-debug" + "inherits": [ + "linux-gcc-base", + "make", + "_debug" + ] }, { "name": "linux-gcc-release", - "configurePreset": "linux-gcc-release" + "inherits": [ + "linux-gcc-base", + "make", + "_release" + ] + }, + { + "name": "linux-gcc-relwithdebinfo", + "inherits": [ + "linux-gcc-base", + "make", + "_relwithdebinfo" + ] + }, + { + "name": "linux-clang-ninja-debug", + "inherits": [ + "linux-clang-debug", + "ninja" + ] + }, + { + "name": "linux-clang-ninja-release", + "inherits": [ + "linux-clang-release", + "ninja" + ] + }, + { + "name": "linux-clang-ninja-relwithdebinfo", + "inherits": [ + "linux-clang-relwithdebinfo", + "ninja" + ] + }, + { + "name": "linux-gcc-ninja-debug", + "inherits": [ + "linux-gcc-debug", + "ninja" + ] + }, + { + "name": "linux-gcc-ninja-release", + "inherits": [ + "linux-gcc-release", + "ninja" + ] + }, + { + "name": "linux-gcc-ninja-relwithdebinfo", + "inherits": [ + "linux-gcc-relwithdebinfo", + "ninja" + ] }, { "name": "linux-gcc-debug-with-clang-tidy", - "configurePreset": "linux-gcc-debug-with-clang-tidy" + "inherits": [ + "linux-gcc-base", + "make", + "_debug" + ], + "cacheVariables": { + "QL_CLANG_TIDY_OPTIONS": "-warnings-as-errors=*", + "QL_USE_CLANG_TIDY": "ON" + } }, { - "name": "windows-clang-x64-debug", - "configurePreset": "windows-clang-x64", - "configuration": "Debug" + "name": "windows-clang-release", + "inherits": [ + "windows-clang-base", + "ninja", + "_release" + ] }, { - "name": "windows-clang-x64-release", - "configurePreset": "windows-clang-x64", - "configuration": "Release" + "name": "windows-clang-debug", + "inherits": [ + "windows-clang-base", + "ninja", + "_debug" + ] }, { - "name": "windows-msvc-x64-debug", - "configurePreset": "windows-msvc-x64", - "configuration": "Debug" + "name": "windows-clang-relwithdebinfo", + "inherits": [ + "windows-clang-base", + "ninja", + "_relwithdebinfo" + ] }, { - "name": "windows-msvc-x64-release", - "configurePreset": "windows-msvc-x64", - "configuration": "Release" + "name": "windows-msvc-release", + "inherits": [ + "windows-msvc-base", + "ninja", + "_release" + ] + }, + { + "name": "windows-msvc-debug", + "inherits": [ + "windows-msvc-base", + "ninja", + "_debug" + ] + }, + { + "name": "windows-msvc-relwithdebinfo", + "inherits": [ + "windows-msvc-base", + "ninja", + "_relwithdebinfo" + ] }, { "name": "linux-ci-build-with-clang-tidy", - "configurePreset": "linux-ci-build-with-clang-tidy" + "inherits": [ + "linux-gcc-base", + "make", + "_debug" + ], + "cacheVariables": { + "BOOST_ROOT": "/usr", + "CMAKE_UNITY_BUILD": "ON", + "QL_CLANG_TIDY": "clang-tidy-15", + "QL_CLANG_TIDY_OPTIONS": "-quiet;-fix", + "QL_USE_CLANG_TIDY": "ON", + "QL_USE_STD_CLASSES": "ON" + } }, { "name": "linux-ci-build-with-nonstandard-options", - "configurePreset": "linux-ci-build-with-nonstandard-options" + "inherits": [ + "linux-gcc-base", + "ninja", + "_release" + ], + "cacheVariables": { + "BOOST_ROOT": "/usr", + "BUILD_SHARED_LIBS": false, + "CMAKE_CXX_STANDARD": "17", + "CMAKE_CXX_COMPILER_LAUNCHER": "ccache", + "QL_ENABLE_SESSIONS": "ON", + "QL_ENABLE_THREAD_SAFE_OBSERVER_PATTERN": "ON", + "QL_HIGH_RESOLUTION_DATE": "ON", + "QL_FASTER_LAZY_OBJECTS": "OFF", + "QL_THROW_IN_CYCLES": "ON", + "QL_NULL_AS_FUNCTIONS": "ON", + "QL_USE_INDEXED_COUPON": "ON", + "QL_USE_STD_SHARED_PTR": "ON", + "QL_USE_STD_ANY": "ON", + "QL_USE_STD_OPTIONAL": "ON", + "QL_USE_STD_FUNCTION": "OFF", + "QL_USE_STD_TUPLE": "OFF", + "QL_COMPILE_WARNING_AS_ERROR": "ON" + } }, { "name": "windows-ci-build-with-nonstandard-options", - "configurePreset": "windows-ci-build-with-nonstandard-options", - "configuration": "Release" + "inherits": [ + "windows-msvc-base", + "ninja", + "_release" + ], + "cacheVariables": { + "CMAKE_CXX_STANDARD": "17", + "CMAKE_UNITY_BUILD": "ON", + "QL_ENABLE_SESSIONS": "ON", + "QL_ENABLE_THREAD_SAFE_OBSERVER_PATTERN": "ON", + "QL_HIGH_RESOLUTION_DATE": "ON", + "QL_FASTER_LAZY_OBJECTS": "OFF", + "QL_THROW_IN_CYCLES": "ON", + "QL_NULL_AS_FUNCTIONS": "ON", + "QL_USE_INDEXED_COUPON": "ON", + "QL_USE_STD_SHARED_PTR": "ON", + "QL_USE_STD_ANY": "ON", + "QL_USE_STD_OPTIONAL": "ON", + "QL_USE_STD_FUNCTION": "OFF", + "QL_USE_STD_TUPLE": "OFF", + "QL_COMPILE_WARNING_AS_ERROR": "ON", + "CMAKE_CXX_COMPILER_LAUNCHER": "sccache" + } } ] } diff --git a/ChangeLog.txt b/ChangeLog.txt index d1832a6e3cf..7cf04c009e3 100644 --- a/ChangeLog.txt +++ b/ChangeLog.txt @@ -1,2899 +1,2971 @@ -commit 051afbcd73dd8b11165449b1f905e4c964e74aec +commit 98bae5a726ad87113aceb815d180bda65b71beed Author: Luigi Ballabio -Date: Mon, 12 Jul 2021 09:46:54 +0200 +Date: Sat, 22 Jul 2023 22:41:59 +0200 - Set version to 1.29 final. + Set version to 1.31.1 CMakeLists.txt | 4 ++-- configure.ac | 2 +- ql/version.hpp | 4 ++-- 3 files changed, 5 insertions(+), 5 deletions(-) -commit 0305de0259df6902d268060ae251c0d951ca637b +commit e00d91410e9b7de58cb3698250f44170c89c2b04 Author: Luigi Ballabio -Date: Fri, 13 Jan 2023 09:22:08 +0100 +Date: Sat, 22 Jul 2023 22:24:51 +0200 - Avoid weird error on 32-bit VC++2015 + Update news - test-suite/inflation.cpp | 7 +++++-- - 1 file changed, 5 insertions(+), 2 deletions(-) + Docs/pages/history.docs | 9 +- + News.md | 231 ++---------------------------------------------- + 2 files changed, 15 insertions(+), 225 deletions(-) -commit df7eeb4ecc450fd63ffe244e8a7a2ad6be8f4b18 +commit db507bff47da33842abea9646996f72eadabd9ce +Merge: 38551644c 4eda1bb8b Author: Luigi Ballabio -Date: Wed, 11 Jan 2023 11:49:29 +0100 +Date: Sat, 22 Jul 2023 21:10:43 +0200 - Avoid some deprecation warnings on VC++15 + Avoid possible segfault when bootstrapping over OIS rates (#1738) - ql/math/functional.hpp | 32 +++++++++++++++++++++++++++++++- - 1 file changed, 31 insertions(+), 1 deletion(-) - -commit c95610040ef9337b99ce34320476dff9458a56bd +commit 4eda1bb8b8dadcb7eba018844b31a59060b16b4b Author: Luigi Ballabio -Date: Thu, 1 Apr 2021 11:28:16 +0200 +Date: Sat, 22 Jul 2023 17:13:20 +0200 - Set version to 1.29 rc + Fix possible circular notification - CMakeLists.txt | 4 ++-- - configure.ac | 2 +- - ql/version.hpp | 4 ++-- - 3 files changed, 5 insertions(+), 5 deletions(-) + ql/termstructures/yield/oisratehelper.cpp | 8 ++++++++ + 1 file changed, 8 insertions(+) -commit 5c4605be3d5e217092e58776fd09964a42737f3b +commit bb355ea1cb78fd7a73ef08710192bc96b7a7980e Author: Luigi Ballabio -Date: Mon, 9 Jan 2023 18:07:02 +0100 +Date: Sat, 22 Jul 2023 17:13:03 +0200 - Update news and changelog + Update test - ChangeLog.txt | 3694 +++++++++++++++++++++++++++++++---------------- - Contributors.txt | 2 + - Docs/pages/history.docs | 100 +- - News.md | 201 +-- - 4 files changed, 2643 insertions(+), 1354 deletions(-) + test-suite/overnightindexedswap.cpp | 1 + + 1 file changed, 1 insertion(+) -commit 87be46e7c5a59d25eb0bb691174caccf296252f3 +commit 9fbffc09b1e416b0c863605dc6872788cda1f429 Author: Luigi Ballabio -Date: Mon, 9 Jan 2023 14:56:29 +0100 +Date: Sat, 22 Jul 2023 12:46:32 +0200 - Cosmetic changes to a few test messages + Add regression test case - test-suite/americanoption.cpp | 10 +++++----- - test-suite/fdheston.cpp | 6 +++--- - 2 files changed, 8 insertions(+), 8 deletions(-) + test-suite/overnightindexedswap.cpp | 24 ++++++++++++++++++++---- + test-suite/overnightindexedswap.hpp | 1 + + 2 files changed, 21 insertions(+), 4 deletions(-) -commit 75cbaf6d86b3e658e9fc6262f2da2cd9b871419c -Author: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> -Date: Mon, 9 Jan 2023 09:33:57 +0000 +commit 38551644cb8b9b6b794f443225e522296ce08331 +Author: Luigi Ballabio +Date: Mon, 17 Jul 2023 10:30:14 +0200 - Fixes by misspell-fixer + Update changelog - ql/experimental/termstructures/crosscurrencyratehelpers.cpp | 2 +- - ql/termstructures/credit/defaultprobabilityhelpers.hpp | 2 +- - 2 files changed, 2 insertions(+), 2 deletions(-) + ChangeLog.txt | 71 ++++++++++++++++++++++++++++++++++++++++++++++++++++++----- + 1 file changed, 66 insertions(+), 5 deletions(-) -commit c7d81455809e1055643cd80e7a1e206bce5cae12 +commit 62661ecb9fa15ac98d9e9c37de87bba825d0247c Author: Luigi Ballabio -Date: Mon, 9 Jan 2023 09:51:18 +0100 +Date: Mon, 12 Jul 2021 09:46:54 +0200 - Avoid a couple of clang-tidy warnings + Set version to 1.31 final. - ql/math/matrix.hpp | 2 +- - ql/pricingengines/vanilla/qdplusamericanengine.cpp | 2 +- - 2 files changed, 2 insertions(+), 2 deletions(-) + CMakeLists.txt | 4 ++-- + configure.ac | 2 +- + ql/version.hpp | 4 ++-- + 3 files changed, 5 insertions(+), 5 deletions(-) -commit 3261d7c5d056da571086c36c096dae30eb9be4b5 +commit 2a020a2296b84d7070ee19222571b7ee9aca9ddc Author: Luigi Ballabio -Date: Thu, 5 Jan 2023 16:08:11 +0100 +Date: Thu, 13 Jul 2023 17:40:23 +0200 - Update qldefines.hpp.cfg + Avoid overloading processors in AppVeyor builds + + Projects already compile C++ files in parallel. + At times, building examples in parallel seems to overwhelm the + agent when linking. - ql/qldefines.hpp.cfg | 15 ++++++++++++++- - 1 file changed, 14 insertions(+), 1 deletion(-) + .appveyor.yml | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) -commit b1b89051548404b65ad2726c07bc9cf092b93fd4 +commit a32a18f191c53f70a9f3add413e75250f27f8120 Author: Luigi Ballabio -Date: Thu, 5 Jan 2023 15:23:05 +0100 +Date: Thu, 13 Jul 2023 17:16:31 +0200 - Don't configure version.hpp in cmake + Update news - CMakeLists.txt | 1 - - ql/CMakeLists.txt | 4 ++-- - ql/Makefile.am | 3 +-- - ql/version.hpp.cfg | 51 --------------------------------------------------- - 4 files changed, 3 insertions(+), 56 deletions(-) + Docs/pages/history.docs | 5 +++-- + News.md | 6 +++--- + 2 files changed, 6 insertions(+), 5 deletions(-) -commit 86f51dd912ff80ef64f1f657d5c2117d3797948f -Merge: d0d00b372 65b59c403 +commit 73bde3c8d379166debc2451f294843a4d4c4e4ee +Merge: 5f5e5e87e 5a82d825d Author: Luigi Ballabio -Date: Thu, 5 Jan 2023 17:24:56 +0100 +Date: Thu, 13 Jul 2023 17:11:02 +0200 - Enable usage of MSVC dynamic runtime in cmake build (#1553) + Initialise a vector of bool in a way which does not make GCC 13.1 irrationally upset (#1733) -commit 65b59c403adf7d518b006d0d6d43830c1911c4dd -Author: Luigi Ballabio -Date: Thu, 5 Jan 2023 09:32:57 +0100 +commit 5a82d825d5f29c15492095c716db9eac10989e37 +Author: Tom Anderson +Date: Thu, 13 Jul 2023 14:12:35 +0100 - Enable dynamic runtime on Windows with cmake + Initialise a vector of bool in a way which does not make GCC 13.1 irrationally upset - .github/workflows/cmake.yml | 37 ++++++++++++++++++++++++++++++++++++- - CMakeLists.txt | 9 +++++---- - cmake/Platform.cmake | 6 ++++-- - 3 files changed, 45 insertions(+), 7 deletions(-) + test-suite/rangeaccrual.cpp | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) -commit d0d00b3721e1f0ce2070599354d1ba8f0cec251e -Merge: 13179807b 7ceb42941 +commit 5f5e5e87e62d60e402aacd598c183cd87c425961 Author: Luigi Ballabio -Date: Tue, 3 Jan 2023 22:25:43 +0100 +Date: Wed, 12 Jul 2023 15:56:02 +0200 - Avoid null-pointer access (#1551) + Set version to 1.31rc2 -commit 7ceb42941eef07a9cbf63fb1dc4ebd693607594e + CMakeLists.txt | 4 ++-- + configure.ac | 2 +- + ql/version.hpp | 4 ++-- + 3 files changed, 5 insertions(+), 5 deletions(-) + +commit 80d351a118d4bb57fc34effc3ffd46a85729bebf Author: Luigi Ballabio -Date: Tue, 3 Jan 2023 17:35:38 +0100 +Date: Tue, 11 Jul 2023 11:24:27 +0200 - Avoid null-pointer access + Update news and changelog - ql/processes/merton76process.cpp | 2 +- - ql/processes/merton76process.hpp | 6 +++--- - 2 files changed, 4 insertions(+), 4 deletions(-) + ChangeLog.txt | 144 ++++++++++++++++++++++++++++++++++++++++++++++++ + Docs/pages/history.docs | 40 +++++++++----- + News.md | 41 +++++++++----- + 3 files changed, 199 insertions(+), 26 deletions(-) -commit 13179807b592d0aac855815f60673b0afe809c39 -Merge: 83468a248 ad62af2cd +commit d8fbe2889533c781effadc1876352af284671fe2 +Merge: e964a67c4 cea11f68f Author: Luigi Ballabio -Date: Tue, 3 Jan 2023 17:15:00 +0100 +Date: Wed, 12 Jul 2023 15:32:30 +0200 - Reorder header for European currencies. (#1549) + Register instruments with evaluation date (#1729) -commit ad62af2cd9de2ec6ed6a030cada586d5a68a0003 +commit cea11f68f706bdb142ea6be9c2c09348e2a1714e Author: Luigi Ballabio -Date: Tue, 3 Jan 2023 14:28:44 +0100 +Date: Wed, 12 Jul 2023 09:41:18 +0200 - Reorder header for European currencies. - - The alphabetical order was restored, and the entrance of Croatia - into Eurozone in 2023 was documented. + Register instruments with evaluation date - ql/currencies/europe.hpp | 108 +++++++++++++++++++++++++---------------------- - 1 file changed, 57 insertions(+), 51 deletions(-) + QuantLib.vcxproj | 1 + + QuantLib.vcxproj.filters | 1 + + ql/CMakeLists.txt | 1 + + ql/Makefile.am | 1 + + ql/instrument.cpp | 49 ++++++++++++++++++++++++++++++++++++++++++++++++ + ql/instrument.hpp | 17 ----------------- + 6 files changed, 53 insertions(+), 17 deletions(-) -commit 83468a24885a81563eb9cce916a2e79968636c7a -Merge: a372709ae f7773e8bd +commit e964a67c40079889df18d6ddf676f5b47a2e4331 +Merge: 343ee92a3 7362bcca0 Author: Luigi Ballabio -Date: Tue, 3 Jan 2023 09:40:57 +0100 +Date: Wed, 12 Jul 2023 09:39:32 +0200 - added china calendar for the year 2023 (#1547) + Break ring of shared_ptr dependencies (#1727) -commit a372709ae082f73b445d1520b16a66159019b2f5 -Merge: 8f3f010f2 48c3689d5 -Author: Luigi Ballabio -Date: Tue, 3 Jan 2023 09:40:27 +0100 +commit 7362bcca0124d87bdeccb6bd42c5af46c27a2766 +Author: Ralf Konrad <42419984+ralfkonrad@users.noreply.github.com> +Date: Wed, 12 Jul 2023 01:36:46 +0200 - Add required packages for icpx compiler (#1545) + Removed fixed leak + + .lsan.txt | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) -commit f7773e8bd4b88bd0a1430301b6e1bb8e0db98444 -Author: wegamekinglc -Date: Sun, 1 Jan 2023 17:47:40 +0800 +commit 32a48ae6f6dbeb5b68953c0594b9a20910fa1f00 +Author: Ralf Konrad <42419984+ralfkonrad@users.noreply.github.com> +Date: Tue, 11 Jul 2023 21:27:16 +0200 - added china calendar for the year 2023 + Break ring of shared_ptr - ql/time/calendars/china.cpp | 20 +++++++++++++++++--- - test-suite/calendars.cpp | 35 ++++++++++++++++++++++++++++++++--- - 2 files changed, 49 insertions(+), 6 deletions(-) + test-suite/lazyobject.cpp | 5 +++++ + 1 file changed, 5 insertions(+) -commit 8f3f010f2d9144bc3d09f2e74ab32ecd8e299a3a -Merge: 5faade57e 91feb6e07 +commit 343ee92a37f3ec405792c562949eed3200123e9e +Merge: fb7d713e2 42f30b5cb Author: Luigi Ballabio -Date: Fri, 30 Dec 2022 11:06:41 +0100 +Date: Tue, 11 Jul 2023 11:27:17 +0200 - Avoid out parameters in `npvbps` signature (#1544) + Add compile-time and run-time switch for `LazyObject` notifications (#1724) -commit 48c3689d51d81a8bfdaa7e1db9405afe10b1c13d -Author: Jonathan Sweemer -Date: Fri, 30 Dec 2022 10:17:35 +0900 +commit 42f30b5cb83125f512dcf821a2d0a08cb72f2a71 +Author: Luigi Ballabio +Date: Mon, 10 Jul 2023 19:01:49 +0200 - Add required packages for icpx compiler + Move settings to inner class + + Renamed to Default to avoid ambiguity with the top-level Settings + in the scope of derived classes. - CMakeLists.txt | 4 ++++ - 1 file changed, 4 insertions(+) + ql/patterns/lazyobject.hpp | 16 +++++++++------- + test-suite/lazyobject.cpp | 16 ++++++++-------- + 2 files changed, 17 insertions(+), 15 deletions(-) -commit 91feb6e07c0063049edc930c44d6ff90083aef96 +commit c06444e782124b6e9ea12fd9e98225a9ca78a6f9 Author: Luigi Ballabio -Date: Thu, 29 Dec 2022 17:28:19 +0100 +Date: Mon, 10 Jul 2023 12:31:59 +0200 - Avoid out parameters in npvbps signature + Add compile-time switch - ql/cashflows/cashflows.cpp | 23 +++++++++-- - ql/cashflows/cashflows.hpp | 12 +++++- - .../termstructures/crosscurrencyratehelpers.cpp | 44 +++++++++++----------- - ql/pricingengines/swap/discountingswapengine.cpp | 13 +++---- - 4 files changed, 58 insertions(+), 34 deletions(-) + .github/workflows/linux-full-tests.yml | 2 +- + .github/workflows/linux-nondefault.yml | 2 +- + .github/workflows/linux.yml | 2 +- + .github/workflows/macos-nondefault.yml | 2 +- + CMakeLists.txt | 1 + + CMakePresets.json | 2 ++ + Docs/pages/config.docs | 12 ++++++++++++ + configure.ac | 24 ++++++++++++++++++++++++ + ql/config.hpp.cfg | 1 + + ql/patterns/lazyobject.hpp | 4 ++++ + ql/userconfig.hpp | 7 +++++++ + 11 files changed, 55 insertions(+), 4 deletions(-) -commit 5faade57eb0b1f5e1d6f404f6291189b5e98d34a +commit cd6fd124ecba3cdd3d7a1375da3378fc97394d90 Author: Luigi Ballabio -Date: Thu, 29 Dec 2022 13:17:23 +0100 +Date: Mon, 10 Jul 2023 12:10:39 +0200 - Use both processors for CI header check + Restore previous default - tools/check_all_headers.sh | 2 +- - tools/check_header.py | 22 +++++++++++++--------- - 2 files changed, 14 insertions(+), 10 deletions(-) + ql/instruments/compositeinstrument.cpp | 9 +++++++++ + ql/instruments/floatfloatswaption.cpp | 9 +++++++++ + ql/instruments/nonstandardswaption.cpp | 10 ++++++++++ + ql/instruments/swaption.cpp | 9 +++++++++ + ql/patterns/lazyobject.hpp | 18 +++++++++++++----- + test-suite/lazyobject.cpp | 4 ++++ + 6 files changed, 54 insertions(+), 5 deletions(-) -commit 94e93a15aa3cc25b33804b048a6661110514435a -Merge: bf3b9ee74 5b0fc0e23 +commit fe20798efa87014ea7584564208b0d3c094cf5cb Author: Luigi Ballabio -Date: Thu, 29 Dec 2022 14:26:41 +0100 +Date: Mon, 10 Jul 2023 11:11:30 +0200 + + Add back run-time settings for LazyObject - Allow sharing engines between dividend and non-dividend options (#1543) + ql/patterns/lazyobject.hpp | 48 +++++++++++++++++++++++---- + test-suite/lazyobject.cpp | 81 +++++++++++++++++++++++++++++++++++++++++++--- + test-suite/lazyobject.hpp | 2 ++ + 3 files changed, 120 insertions(+), 11 deletions(-) -commit bf3b9ee74214f36b1b5000f3d9590deeee07cfb6 -Merge: 58e5aadb9 bef111c99 +commit fb7d713e27d4ed6b28dd234f4d3ec0dee1b49d9a Author: Luigi Ballabio -Date: Thu, 29 Dec 2022 13:19:24 +0100 +Date: Thu, 1 Apr 2021 11:28:16 +0200 + + Set version to 1.31 rc - Adds public holiday in lieu of Christmas 2022 to South Africa calendar (#1542) + CMakeLists.txt | 4 ++-- + configure.ac | 2 +- + ql/version.hpp | 4 ++-- + 3 files changed, 5 insertions(+), 5 deletions(-) -commit 5b0fc0e23a66f99e970ceff3c6c37687fff96d28 +commit 956ed6cdba813a8747e79433382be498b4bf95d0 Author: Luigi Ballabio -Date: Thu, 29 Dec 2022 10:42:51 +0100 +Date: Mon, 3 Jul 2023 17:30:53 +0200 - Allow sharing engines between dividend and non-dividend options + Update news and changelog - ql/instruments/barrieroption.cpp | 9 ++++++ - ql/instruments/vanillaoption.cpp | 12 ++++++++ - ql/instruments/vanillaoption.hpp | 2 ++ - test-suite/barrieroption.cpp | 50 +++++++++++++++++++++++++++---- - test-suite/barrieroption.hpp | 1 + - test-suite/europeanoption.cpp | 65 ++++++++++++++++++++++++++++++---------- - test-suite/europeanoption.hpp | 1 + - 7 files changed, 118 insertions(+), 22 deletions(-) + ChangeLog.txt | 3869 +++++++++++++++++++++++++---------------------- + Contributors.txt | 6 + + Docs/pages/history.docs | 143 +- + News.md | 267 ++-- + 4 files changed, 2393 insertions(+), 1892 deletions(-) -commit bef111c99120fc44cde63dd8f6c9448da845c2ed -Author: Josh Hayes -Date: Thu, 29 Dec 2022 10:33:28 +0200 +commit 0476dae92bec1db800c735ceef405945ec22fddd +Author: Luigi Ballabio +Date: Mon, 3 Jul 2023 12:26:52 +0200 - Adds note to docstring about one-off holidays + Cosmetic fixes to test messages - ql/time/calendars/southafrica.hpp | 3 +++ - 1 file changed, 3 insertions(+) + test-suite/daycounters.cpp | 2 +- + test-suite/schedule.cpp | 4 ++-- + 2 files changed, 3 insertions(+), 3 deletions(-) -commit e5184d92a016575f85d1269b2af863c37cf7c294 -Author: Josh Hayes -Date: Thu, 29 Dec 2022 10:32:30 +0200 +commit d379ffafe7bf4ec6482af9918210b7ad16ceccb7 +Author: Luigi Ballabio +Date: Mon, 3 Jul 2023 11:17:08 +0200 - Adds holiday in lieu of Christmas on Sunday + Include main definitions - ql/time/calendars/southafrica.cpp | 2 ++ + ql/utilities/null_deleter.hpp | 2 ++ 1 file changed, 2 insertions(+) -commit 58e5aadb99f8b31189ceb352e7ff85a10c24f899 -Author: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> -Date: Mon, 26 Dec 2022 11:00:28 +0000 +commit ca0c6d094df746e28d148655c3c2e941d2234700 +Author: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> +Date: Sun, 2 Jul 2023 02:56:10 +0000 - Bump actions/stale from 6 to 7 - - Bumps [actions/stale](https://github.com/actions/stale) from 6 to 7. - - [Release notes](https://github.com/actions/stale/releases) - - [Changelog](https://github.com/actions/stale/blob/main/CHANGELOG.md) - - [Commits](https://github.com/actions/stale/compare/v6...v7) - - --- - updated-dependencies: - - dependency-name: actions/stale - dependency-type: direct:production - update-type: version-update:semver-major - ... - - Signed-off-by: dependabot[bot] + Automated fixes by clang-tidy - .github/workflows/stale.yml | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) + ql/termstructures/yield/oisratehelper.cpp | 5 ++--- + ql/termstructures/yield/oisratehelper.hpp | 31 +++++++++++++++---------------- + 2 files changed, 17 insertions(+), 19 deletions(-) -commit da7292ad9123ab327024d0caac3703bd6a0f23af +commit 88395b10b0b69f11fbebf314b07314f84d3ac5d2 +Merge: cda594b59 e1a4eea04 Author: Luigi Ballabio -Date: Tue, 27 Dec 2022 09:45:06 +0100 - - Avoid brew errors during CI setup +Date: Fri, 30 Jun 2023 15:43:06 +0200 - .github/workflows/doxygen.yml | 3 ++- - 1 file changed, 2 insertions(+), 1 deletion(-) + Add separate calendar for SOFR fixing dates (#1721) -commit e4e16e7347a13272f130cc5d4bb2fd172a45771f +commit e1a4eea04cdb5f4215d08c59db6e3c09bda04ff8 Author: Luigi Ballabio -Date: Wed, 21 Dec 2022 10:37:09 +0100 +Date: Fri, 30 Jun 2023 12:15:37 +0200 - Upgrade Boost in cmake CI build + Remove obsolete, commented-out declarations - .github/workflows/cmake.yml | 12 ++++++------ - 1 file changed, 6 insertions(+), 6 deletions(-) + test-suite/calendars.cpp | 2 -- + test-suite/calendars.hpp | 2 -- + 2 files changed, 4 deletions(-) -commit 4c879d243cdb53eb7f25c87fd48f4c5e42e65054 -Merge: a2b25185b d52126369 +commit eeffcd7aad63eae6c89dab032e954e2678a25c7a Author: Luigi Ballabio -Date: Thu, 15 Dec 2022 09:12:16 +0100 +Date: Fri, 30 Jun 2023 12:13:12 +0200 - Bugfix for ZeroCouponInflationSwapHelper (#1539) - -commit d52126369d490c1cf71a8fddecc0063f11315e27 -Author: Matthias Groncki -Date: Thu, 15 Dec 2022 10:09:03 +0700 - - Bugfix ZeroCouponInflationSwapHelper + Add SOFR-specific calendar - Dont need to interpolate the maturity of the rate helper falls the on the first date of the inflation period + Some days (so far, we know about Good Friday 2023) are not holidays + for SIFMA but SOFR doesn't fix anyway. - ql/termstructures/inflation/inflationhelpers.cpp | 4 +++- - 1 file changed, 3 insertions(+), 1 deletion(-) - -commit a2b25185b597ee0d9578dd8e61a88fe31a33c043 -Author: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> -Date: Tue, 13 Dec 2022 15:28:56 +0000 + ql/indexes/ibor/sofr.cpp | 2 +- + ql/time/calendars/unitedstates.cpp | 34 ++++++++++++++++++++-------------- + ql/time/calendars/unitedstates.hpp | 10 ++++++++-- + test-suite/calendars.cpp | 18 ++++++++++++++++++ + test-suite/calendars.hpp | 1 + + 5 files changed, 48 insertions(+), 17 deletions(-) - Update copyright list in license +commit cda594b5935c04e7cb39169a9b5cd70502e5a566 +Merge: 55b35f4d5 6dfc56b34 +Author: Luigi Ballabio +Date: Fri, 30 Jun 2023 11:26:18 +0200 - LICENSE.TXT | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) + Don't normalize days to weeks in interest-rate index (#1720) -commit fcdd14c2a42d149fd7512c3665a1f27ba0924a5b -Merge: e5fa7ba6e 134d2b85e +commit 6dfc56b34bec5eb51a059744fe72e3b3c6945589 Author: Luigi Ballabio -Date: Tue, 13 Dec 2022 16:28:18 +0100 +Date: Thu, 29 Jun 2023 15:53:36 +0200 - Add indexFixing method to indexed cashflows (#1499) + Don't normalize days to weeks in interest-rate index -commit 134d2b85e1cfd05e392494f63c9283ecccd7d723 -Author: Matthias Groncki -Date: Tue, 13 Dec 2022 08:50:53 +0700 + ql/indexes/interestrateindex.cpp | 4 +++- + test-suite/indexes.cpp | 31 +++++++++++++++++++++++++++++++ + test-suite/indexes.hpp | 1 + + 3 files changed, 35 insertions(+), 1 deletion(-) - move baseFixing method to base class indexedcashflow +commit 55b35f4d5ac77fbfc749ef67781314f257485146 +Author: Luigi Ballabio +Date: Thu, 29 Jun 2023 08:05:49 +0200 - ql/cashflows/cpicoupon.cpp | 10 ---------- - ql/cashflows/cpicoupon.hpp | 7 ++----- - ql/cashflows/indexedcashflow.cpp | 4 ++-- - ql/cashflows/indexedcashflow.hpp | 1 + - 4 files changed, 5 insertions(+), 17 deletions(-) + Remove experimental workflow + + It doesn't seem to work for the time being. Reassess later. -commit 59264ca1bdc52730175b6c4dbbc9251781326f2c -Author: Matthias Groncki -Date: Thu, 8 Dec 2022 07:41:33 +0700 + .github/workflows/permissions-advisor.yml | 26 -------------------------- + 1 file changed, 26 deletions(-) - avoid code duplication +commit 46a4f212f060a1499647a4c0739c56818750d8cc +Merge: ce04ea3c5 84022c5b2 +Author: Luigi Ballabio +Date: Wed, 28 Jun 2023 09:28:12 +0200 - ql/cashflows/cpicoupon.cpp | 23 +---------------------- - 1 file changed, 1 insertion(+), 22 deletions(-) + Expose more parameters for DatedOISRateHelper (#1719) -commit e5fa7ba6e63b300eb16d54ff23b3ba893933582c -Merge: 5e5380e36 9b572ef39 +commit ce04ea3c517c933d60ebe2457ef8ca387ad2cc65 +Merge: 006634578 f6c604699 Author: Luigi Ballabio -Date: Wed, 7 Dec 2022 22:36:24 +0100 +Date: Tue, 27 Jun 2023 12:31:37 +0200 - Casts to Real to maintain AAD compatibility (#1536) + Add additional results for VV barrier engine (#1718) -commit 5e5380e36fabbd40ddea97437901d44003105edb -Merge: 1b16c6c1e c3a8da34b +commit 006634578de0c4b521f990053c4c437a51313bf1 Author: Luigi Ballabio -Date: Wed, 7 Dec 2022 22:35:52 +0100 +Date: Tue, 27 Jun 2023 10:46:24 +0200 - Deprecate unneeded typedefs (#1418) + Add permissions advisor workflow -commit 9b572ef393b587089329c97b8a7f42851e600e94 -Author: Xcelerit Dev Team -Date: Wed, 7 Dec 2022 15:15:00 +0000 + .github/workflows/permissions-advisor.yml | 26 ++++++++++++++++++++++++++ + 1 file changed, 26 insertions(+) - Casts to Real to maintain AAD compatibility +commit f6c604699fcc484d209b62ef1ffb8b48db24ff45 +Author: Fredrik Gerdin Börjesson +Date: Tue, 27 Jun 2023 08:34:23 +0200 - ql/pricingengines/vanilla/qdplusamericanengine.cpp | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) + Add additional results for VV barrier engine -commit c3a8da34b0d79ad50976e3c042c4191c89dc2cdd -Author: Jonathan Sweemer -Date: Tue, 28 Jun 2022 21:13:38 +0900 - - Deprecate unneeded typedefs - - ql/cashflow.hpp | 14 ++++++ - ql/cashflows/conundrumpricer.hpp | 9 ++++ - ql/experimental/math/convolvedstudentt.hpp | 18 ++++++++ - ql/experimental/math/latentmodel.hpp | 5 ++ - ql/math/abcdmathfunction.hpp | 9 ++++ - ql/math/comparison.hpp | 14 ++++++ - ql/math/copulas/alimikhailhaqcopula.hpp | 14 ++++++ - ql/math/copulas/claytoncopula.hpp | 14 ++++++ - ql/math/copulas/farliegumbelmorgensterncopula.hpp | 14 ++++++ - ql/math/copulas/frankcopula.hpp | 14 ++++++ - ql/math/copulas/galamboscopula.hpp | 14 ++++++ - ql/math/copulas/gaussiancopula.hpp | 14 ++++++ - ql/math/copulas/gumbelcopula.hpp | 14 ++++++ - ql/math/copulas/huslerreisscopula.hpp | 14 ++++++ - ql/math/copulas/independentcopula.hpp | 14 ++++++ - ql/math/copulas/marshallolkincopula.hpp | 14 ++++++ - ql/math/copulas/maxcopula.hpp | 14 ++++++ - ql/math/copulas/mincopula.hpp | 14 ++++++ - ql/math/copulas/plackettcopula.hpp | 14 ++++++ - ql/math/distributions/binomialdistribution.hpp | 18 ++++++++ - ql/math/distributions/chisquaredistribution.hpp | 36 +++++++++++++++ - ql/math/distributions/gammadistribution.hpp | 18 ++++++++ - ql/math/distributions/normaldistribution.hpp | 54 ++++++++++++++++++++++ - ql/math/distributions/poissondistribution.hpp | 27 +++++++++++ - ql/math/distributions/studenttdistribution.hpp | 27 +++++++++++ - ql/math/errorfunction.hpp | 9 ++++ - ql/math/interpolation.hpp | 10 ++++ - ql/math/interpolations/interpolation2d.hpp | 14 ++++++ - ql/math/linearleastsquaresregression.hpp | 9 ++++ - ql/math/polynomialmathfunction.hpp | 9 ++++ - .../randomnumbers/stochasticcollocationinvcdf.hpp | 9 ++++ - .../operators/numericaldifferentiation.hpp | 9 ++++ - ql/methods/montecarlo/pathpricer.hpp | 4 ++ - ql/payoff.hpp | 9 ++++ - ql/termstructures/volatility/abcd.hpp | 9 ++++ - 35 files changed, 522 insertions(+) - -commit 1b16c6c1e00ad136610b1d2040864cae00957e8b -Merge: 035ab3e92 559371a6b -Author: Luigi Ballabio -Date: Mon, 5 Dec 2022 23:03:06 +0100 - - Better error messages for interpolated curves (#1535) - -commit 035ab3e929b6765771c2882397d04f45b2c39894 -Merge: 4019bee67 eabb11aec -Author: Luigi Ballabio -Date: Mon, 5 Dec 2022 22:51:48 +0100 - - allow negative dividend yields for QD+ American engines (#1534) - -commit 559371a6b43b7fa2c7546d4a9f61d18abc2edbc7 -Author: Luigi Ballabio -Date: Mon, 5 Dec 2022 16:14:53 +0100 - - Better error messages for interpolated curves - - .../credit/interpolatedaffinehazardratecurve.hpp | 18 ++---------- - .../credit/interpolateddefaultdensitycurve.hpp | 33 ++++++---------------- - .../credit/interpolatedhazardratecurve.hpp | 17 ++--------- - .../interpolatedsurvivalprobabilitycurve.hpp | 16 ++--------- - .../inflation/interpolatedyoyinflationcurve.hpp | 18 ++---------- - .../inflation/interpolatedzeroinflationcurve.hpp | 17 ++--------- - ql/termstructures/interpolatedcurve.hpp | 21 ++++++++++++++ - ql/termstructures/yield/discountcurve.hpp | 16 ++--------- - ql/termstructures/yield/forwardcurve.hpp | 20 ++----------- - .../yield/interpolatedsimplezerocurve.hpp | 19 ++++--------- - ql/termstructures/yield/zerocurve.hpp | 26 ++++------------- - 11 files changed, 58 insertions(+), 163 deletions(-) - -commit eabb11aec1a3483c2bd1e8a0a7ce1a009d65202e -Author: klausspanderen -Date: Mon, 5 Dec 2022 00:21:51 +0100 + .../barrieroption/vannavolgabarrierengine.cpp | 23 ++++++++++++---------- + 1 file changed, 13 insertions(+), 10 deletions(-) - allow negative dividend yields for QD+ and QD+ fixed point American - engines +commit 84022c5b2944947b96f68086dea0f8007e660950 +Author: Eugene Toder +Date: Mon, 26 Jun 2023 19:09:36 -0400 - ql/pricingengines/vanilla/qdfpamericanengine.cpp | 2 +- - ql/pricingengines/vanilla/qdplusamericanengine.cpp | 50 ++++++++++----- - test-suite/americanoption.cpp | 74 ++++++++++++++++++++++ - test-suite/americanoption.hpp | 2 + - 4 files changed, 111 insertions(+), 17 deletions(-) + Expose more parameters for DatedOISRateHelper -commit 4019bee67ac10b8fb242648fd62e0e2525a1d597 + ql/termstructures/yield/oisratehelper.cpp | 21 +++++++++++++++++++-- + ql/termstructures/yield/oisratehelper.hpp | 9 ++++++++- + 2 files changed, 27 insertions(+), 3 deletions(-) + +commit e06d6087171ca8d988114b25a40a44d96607e12e Author: Luigi Ballabio -Date: Sun, 4 Dec 2022 13:35:39 +0100 +Date: Mon, 26 Jun 2023 09:50:46 +0200 - Add configure switch to skip test suite. - - Not advised in normal usage. Mostly for automated jobs building - wheels or other artifacts, after the code is already verified. + Avoid clang-tidy warnings - configure.ac | 12 +++++++++++- - test-suite/Makefile.am | 2 +- - 2 files changed, 12 insertions(+), 2 deletions(-) + ql/patterns/lazyobject.hpp | 2 +- + ql/utilities/steppingiterator.hpp | 2 +- + 2 files changed, 2 insertions(+), 2 deletions(-) -commit 7f69bb6fbe4ac76f0262b717cbf97c6dcd7b69d9 -Merge: 61041b0f1 bb3c5eb9b +commit e4bc0c4ae12ff485fc63ae79e9a30a4aab365b54 Author: Luigi Ballabio -Date: Wed, 23 Nov 2022 14:37:52 +0100 +Date: Mon, 26 Jun 2023 09:30:30 +0200 - Use Real instead of double in amortizingbond test (#1531) + Avoid triggering bug in clang-tidy -commit bb3c5eb9bb3dbdc3842ab0c84aff39e178736539 -Author: Xcelerit Dev Team <107129969+xcelerit-dev@users.noreply.github.com> -Date: Wed, 23 Nov 2022 09:48:43 +0000 + ql/time/calendar.cpp | 7 +++++-- + 1 file changed, 5 insertions(+), 2 deletions(-) - Fix vector -> vector in amortizingbond test +commit c74e4d17ca567ee2737d07f5abbd96f79bf695f3 +Merge: 075bd2f38 1876ee1bc +Author: Luigi Ballabio +Date: Fri, 23 Jun 2023 12:59:16 +0200 - test-suite/amortizingbond.cpp | 4 ++-- - 1 file changed, 2 insertions(+), 2 deletions(-) + Restore settings after every test (#1713) -commit 61041b0f191b8788b82443462eea62a46f56ff2d -Merge: 222bccec3 e6e5b9208 +commit 1876ee1bce7c07980e7b092bb7ed3af1081c75ba Author: Luigi Ballabio -Date: Wed, 23 Nov 2022 10:05:32 +0100 +Date: Fri, 23 Jun 2023 11:35:40 +0200 - Updated Readme (#1530) + Restrict flag change to scope -commit e6e5b92081895b31e6261a48e4a865058af51704 -Author: Nijaz Kovacevic -Date: Tue, 22 Nov 2022 19:28:40 -0800 + test-suite/defaultprobabilitycurves.cpp | 125 +++++++++++++++++--------------- + 1 file changed, 65 insertions(+), 60 deletions(-) - Updated Readme - - Added Basket losses, CVAIRS, Gaussian1dModels, Latent Models, and Market Models in the example Readme file. +commit c95e7e4248a0656799ea82a2a9a1e70d208c45ab +Author: Luigi Ballabio +Date: Fri, 23 Jun 2023 11:30:44 +0200 - Examples/README.txt | 35 +++++++++++++++++++++++++++++++++++ - 1 file changed, 35 insertions(+) + Move comment to relevant test case -commit 222bccec371dc24c29466d58b65b6569b4eb7684 -Author: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> -Date: Tue, 22 Nov 2022 15:25:45 +0000 + test-suite/defaultprobabilitycurves.cpp | 10 ++++++---- + 1 file changed, 6 insertions(+), 4 deletions(-) - Update copyright list in license +commit b3a753bd9471e4e923fb79d2bb8a6b335ae7f624 +Author: Eugene Toder +Date: Wed, 21 Jun 2023 18:59:38 -0400 - LICENSE.TXT | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) + Restore settings after every test + + Instead of adding SavedSettings into every test that changes settings, + use it in quantlib_test_case so it applies to every test. This is cheap + and makes writing tests easier. + + test-suite/americanoption.cpp | 32 ----------- + test-suite/andreasenhugevolatilityinterpl.cpp | 16 ------ + test-suite/asianoptions.cpp | 6 -- + test-suite/assetswap.cpp | 3 - + test-suite/barrieroption.cpp | 16 ------ + test-suite/batesmodel.cpp | 8 --- + test-suite/bermudanswaption.cpp | 4 -- + test-suite/blackdeltacalculator.cpp | 6 -- + test-suite/blackformula.cpp | 2 - + test-suite/bondforward.cpp | 3 - + test-suite/bonds.cpp | 8 --- + test-suite/callablebonds.cpp | 3 - + test-suite/capfloor.cpp | 4 -- + test-suite/capflooredcoupon.cpp | 3 - + test-suite/cashflows.cpp | 4 -- + test-suite/catbonds.cpp | 3 - + test-suite/cdo.cpp | 2 - + test-suite/cdsoption.cpp | 2 - + test-suite/cliquetoption.cpp | 4 -- + test-suite/cms.cpp | 3 - + test-suite/cms_normal.cpp | 3 - + test-suite/cmsspread.cpp | 1 - + test-suite/compoundoption.cpp | 4 -- + test-suite/convertiblebonds.cpp | 5 -- + test-suite/creditdefaultswap.cpp | 18 ------ + test-suite/crosscurrencyratehelpers.cpp | 2 - + test-suite/curvestates.cpp | 3 - + test-suite/defaultprobabilitycurves.cpp | 6 +- + test-suite/digitalcoupon.cpp | 3 - + test-suite/digitaloption.cpp | 4 -- + test-suite/dividendoption.cpp | 28 ---------- + test-suite/doublebarrieroption.cpp | 4 -- + test-suite/doublebinaryoption.cpp | 2 - + test-suite/equitycashflow.cpp | 2 - + test-suite/equityindex.cpp | 2 - + test-suite/equitytotalreturnswap.cpp | 2 - + test-suite/europeanoption.cpp | 48 ---------------- + test-suite/extendedtrees.cpp | 14 ----- + test-suite/fdcev.cpp | 2 - + test-suite/fdheston.cpp | 25 --------- + test-suite/fdmlinearop.cpp | 14 ----- + test-suite/fdsabr.cpp | 10 ---- + test-suite/fittedbonddiscountcurve.cpp | 2 - + test-suite/forwardoption.cpp | 8 --- + test-suite/gjrgarchmodel.cpp | 2 - + test-suite/hestonmodel.cpp | 68 ----------------------- + test-suite/hestonslvmodel.cpp | 33 ----------- + test-suite/hybridhestonhullwhiteprocess.cpp | 26 --------- + test-suite/inflation.cpp | 24 -------- + test-suite/inflationcapfloor.cpp | 4 -- + test-suite/inflationcapflooredcoupon.cpp | 4 -- + test-suite/inflationcpibond.cpp | 4 -- + test-suite/inflationcpicapfloor.cpp | 4 -- + test-suite/inflationcpiswap.cpp | 4 -- + test-suite/inflationvolatility.cpp | 4 -- + test-suite/instruments.cpp | 2 - + test-suite/jumpdiffusion.cpp | 4 -- + test-suite/libormarketmodel.cpp | 8 --- + test-suite/libormarketmodelprocess.cpp | 6 -- + test-suite/linearleastsquaresregression.cpp | 6 -- + test-suite/margrabeoption.cpp | 2 - + test-suite/mclongstaffschwartzengine.cpp | 4 -- + test-suite/normalclvmodel.cpp | 10 ---- + test-suite/nthorderderivativeop.cpp | 4 -- + test-suite/nthtodefault.cpp | 4 -- + test-suite/observable.cpp | 3 - + test-suite/optionletstripper.cpp | 3 - + test-suite/overnightindexedcoupon.cpp | 3 - + test-suite/overnightindexedswap.cpp | 5 -- + test-suite/pathgenerator.cpp | 4 -- + test-suite/piecewiseyieldcurve.cpp | 14 ----- + test-suite/piecewisezerospreadedtermstructure.cpp | 3 - + test-suite/quantooption.cpp | 20 ------- + test-suite/rangeaccrual.cpp | 3 - + test-suite/riskneutraldensitycalculator.cpp | 8 --- + test-suite/settings.cpp | 2 - + test-suite/shortratemodels.cpp | 9 --- + test-suite/sofrfutures.cpp | 2 - + test-suite/squarerootclvmodel.cpp | 6 -- + test-suite/subperiodcoupons.cpp | 2 - + test-suite/swap.cpp | 3 - + test-suite/swaption.cpp | 3 - + test-suite/swaptionvolatilitycube.cpp | 3 - + test-suite/swaptionvolatilitymatrix.cpp | 3 - + test-suite/swingoption.cpp | 12 ---- + test-suite/termstructures.cpp | 4 -- + test-suite/ultimateforwardtermstructure.cpp | 2 - + test-suite/utilities.hpp | 8 +-- + test-suite/variancegamma.cpp | 4 -- + test-suite/vpp.cpp | 12 ---- + test-suite/zerocouponswap.cpp | 2 - + 91 files changed, 4 insertions(+), 710 deletions(-) + +commit 075bd2f381e6d1684d32de613c540c5419a7a765 +Merge: b1f41c379 0413833f3 +Author: Luigi Ballabio +Date: Thu, 22 Jun 2023 11:51:28 +0200 + + Simplify Calendar::businessDaysBetween (#1714) + +commit 0413833f3215adeab4da51477b32897999f039ca +Author: Eugene Toder +Date: Wed, 21 Jun 2023 22:01:37 -0400 + + Simplify Calendar::businessDaysBetween + + Use only one loop and make fewer isBusinessDay() calls. -commit 13cc9e99872223c930de446bdd6a38a08975e8b2 -Merge: f271efd89 32cf78c60 + ql/time/calendar.cpp | 47 +++++++++++++++-------------------------------- + 1 file changed, 15 insertions(+), 32 deletions(-) + +commit b1f41c3795608941d9247f0ae8686029e45c346a +Merge: 56d6d7d5e f00e18319 Author: Luigi Ballabio -Date: Tue, 22 Nov 2022 16:23:10 +0100 +Date: Wed, 21 Jun 2023 17:19:35 +0200 - removed check for increasing notionals as there are bonds with draw down (#1437) + Fix compile error on GCC 12 (#1712) -commit 32cf78c60c322cb0d55411d1bf0d8d5c78c13a19 -Author: Luigi Ballabio -Date: Tue, 22 Nov 2022 14:59:41 +0100 +commit f00e18319c4d0df71c28f4a662474c4cc73876aa +Author: Binrui Dong +Date: Wed, 21 Jun 2023 21:19:20 +0800 - Convert example into test case + Fix compile error on GCC 12 - Examples/AmortizingBonds/AmortizingBond.cpp | 178 ---------------------------- - Examples/AmortizingBonds/CMakeLists.txt | 2 - - Examples/AmortizingBonds/ReadMe.txt | 1 - - test-suite/amortizingbond.cpp | 63 ++++++++++ - test-suite/amortizingbond.hpp | 4 +- - 5 files changed, 65 insertions(+), 183 deletions(-) + ql/currencies/exchangeratemanager.cpp | 1 + + ql/experimental/credit/basket.cpp | 1 + + ql/termstructures/volatility/smilesectionutils.cpp | 1 + + 3 files changed, 3 insertions(+) -commit f271efd89bb874612ebd69667dccf976e68f841e -Merge: 0bc43aad3 e630cd890 +commit 56d6d7d5e72ae82b76bf5196b9f2dced42ee983a +Merge: c6a0ed3a5 ad8eb17e5 Author: Luigi Ballabio -Date: Tue, 22 Nov 2022 09:03:12 +0100 +Date: Wed, 21 Jun 2023 10:04:23 +0200 - Added `MakeSwaption::withIndexedCoupons(...)` and `MakeSwaption::withAtParCoupons(...)` (#1527) + Add test cases for South Korea calendar (#1711) -commit e630cd8903d9dca3b2d7b56824a1768052ed54a2 -Author: RalfKonrad -Date: Mon, 21 Nov 2022 19:28:20 +0100 +commit ad8eb17e5e17698038966c97801b617565946ccb +Author: jonghee.lee +Date: Wed, 21 Jun 2023 14:11:27 +0900 - Added MakeSwaption::withIndexedCoupons(...) and MakeSwaption::withAtParCoupons(...) + insert empty line - ql/instruments/makeswaption.cpp | 13 ++++++++++++- - ql/instruments/makeswaption.hpp | 3 +++ - 2 files changed, 15 insertions(+), 1 deletion(-) + test-suite/calendars.cpp | 3 +++ + 1 file changed, 3 insertions(+) -commit 0bc43aad3b0964847ba07c5be3af79f4a46e3594 -Author: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> -Date: Sun, 20 Nov 2022 05:41:37 +0000 +commit 07903b09a57d66450ce1a36d0c74b23a889d924c +Author: jonghee.lee +Date: Wed, 21 Jun 2023 14:06:41 +0900 - Automated fixes by clang-tidy + edit holiday and substitute holiday - test-suite/inflation.cpp | 4 ++-- - 1 file changed, 2 insertions(+), 2 deletions(-) + ql/time/calendars/southkorea.cpp | 20 +- + ql/time/calendars/southkorea.hpp | 2 +- + test-suite/calendars.cpp | 1326 +++++++++++++++++++++++++++++++++++++- + 3 files changed, 1328 insertions(+), 20 deletions(-) -commit 8cf030858a88e6b9aef658b1b74212068151a263 -Merge: faed2ceb3 0de363d13 -Author: Luigi Ballabio -Date: Sun, 20 Nov 2022 21:14:29 +0100 +commit c6a0ed3a525e2eec7f83e8616a567cd8fe8484c3 +Author: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> +Date: Tue, 20 Jun 2023 20:46:50 +0000 - Make Option::payoff() and Option::exercise() const (#1526) + Update copyright list in license -commit 0de363d1392434986d567a3a6c51394b490bb982 -Author: RalfKonrad -Date: Sun, 20 Nov 2022 18:26:48 +0100 + LICENSE.TXT | 3 ++- + 1 file changed, 2 insertions(+), 1 deletion(-) - Option::payoff() and Option::exercise() are now const +commit 97f7a2b1287feaf940d65456bc4cf3bdd41a0fce +Merge: a0f48a8ad 7c1e0143d +Author: Luigi Ballabio +Date: Tue, 20 Jun 2023 22:46:17 +0200 - ql/option.hpp | 4 ++-- - 1 file changed, 2 insertions(+), 2 deletions(-) + Add rules for substitute holidays to South Korea calendar (#1707) -commit faed2ceb3b255d03b307bd2e459a70776a2e3778 +commit a0f48a8adfefca2a72ad93056d36fc7608e26642 +Merge: da0d08671 b9aa0661e Author: Luigi Ballabio -Date: Fri, 18 Nov 2022 22:55:11 +0100 +Date: Tue, 20 Jun 2023 21:44:08 +0200 - Try to reduce number of cache entries on actions + Add DESTR, SWESTR OIS indices (#1709) - .github/workflows/cmake.yml | 35 +++++++++++++++------------------- - .github/workflows/linux-full-tests.yml | 7 +++---- - .github/workflows/linux.yml | 7 +++---- - .github/workflows/macos.yml | 9 ++++----- - .github/workflows/test-times.yml | 9 ++++----- - 5 files changed, 29 insertions(+), 38 deletions(-) - -commit 95cc21495fa842205fbdeb0b1cd956e03b09c268 -Merge: 80874acf5 630569a16 +commit da0d086712fbd8c09cfa6912a8b5dc37c8777e90 +Merge: f97f185c9 81a30b64a Author: Luigi Ballabio -Date: Fri, 18 Nov 2022 22:45:01 +0100 +Date: Tue, 20 Jun 2023 20:47:57 +0200 - Accelerated Build via Ninja generator with CMake (#1429) + Add Hong Kong Securities Market Holidays in 2024 (#1708) -commit 630569a16ff771b0999af048208d063a0418f033 -Author: Xcelerit Dev Team -Date: Fri, 18 Nov 2022 16:02:11 +0000 +commit f97f185c9105d336660605d86355796b4624d6b7 +Merge: 0bc1e5e3b af6fe9745 +Author: Luigi Ballabio +Date: Tue, 20 Jun 2023 19:19:52 +0200 - Adds /bigobj in unity builds for benchmarks as well + Update dates correctly in upfront CDS helper when evaluation date changes (#1704) - test-suite/CMakeLists.txt | 4 ++++ - 1 file changed, 4 insertions(+) +commit b9aa0661ed60d22a2277387133c9315f7303cf01 +Author: Fredrik Gerdin Börjesson +Date: Tue, 20 Jun 2023 17:44:36 +0200 -commit 3536ad4d1ac602b0ac2d745bcbad1b6164423b1f -Author: Xcelerit Dev Team -Date: Fri, 18 Nov 2022 14:20:48 +0000 + Add missing imports destr.hpp/swestr.hpp - Sets /bigobj for MSVC unit builds + ql/indexes/ibor/destr.hpp | 2 ++ + ql/indexes/ibor/swestr.hpp | 2 ++ + 2 files changed, 4 insertions(+) - ql/CMakeLists.txt | 7 ++----- - test-suite/CMakeLists.txt | 7 ++----- - 2 files changed, 4 insertions(+), 10 deletions(-) +commit 7c1e0143d21b8af1af7f29beb6a5557c92582a32 +Author: Luigi Ballabio +Date: Tue, 20 Jun 2023 17:37:34 +0200 -commit a758f145401c1bdb3c2fc9d67c3c0d600eabc954 -Author: Xcelerit Dev Team -Date: Fri, 18 Nov 2022 12:52:59 +0000 + Associate substitute rules with original ones - Enables sccache on Windows in CI cmake builds + ql/time/calendars/southkorea.cpp | 14 ++++++-------- + 1 file changed, 6 insertions(+), 8 deletions(-) - .github/workflows/cmake.yml | 22 +++++++++++++++++++++- - CMakePresets.json | 3 ++- - 2 files changed, 23 insertions(+), 2 deletions(-) +commit fe5043bd128cc63b31b463383f5fd09df0ac2ba9 +Author: jonghee +Date: Wed, 21 Jun 2023 00:12:52 +0900 -commit 022273a7a1843975b2323aec177bc8363e897985 -Author: Xcelerit Dev Team -Date: Fri, 18 Nov 2022 12:44:10 +0000 + make space - Adds /bigobj on CMake unity builds with Ninja + ql/time/calendars/southkorea.cpp | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) - ql/CMakeLists.txt | 8 ++++++++ - test-suite/CMakeLists.txt | 7 +++++++ - 2 files changed, 15 insertions(+) +commit a801eb05dbd1fb9eff15f0ff952ba8c4c142fc33 +Author: jonghee +Date: Wed, 21 Jun 2023 00:11:23 +0900 -commit 80874acf512570ed3be7714698de1901a909a2c7 -Merge: 75602fedc 002d9e388 -Author: Luigi Ballabio -Date: Mon, 14 Nov 2022 13:23:07 +0100 + set year limit to 2053 - Consistent Real usage, testing macros, and constant initialisation (#1524) + ql/time/calendars/southkorea.cpp | 1 + + ql/time/calendars/southkorea.hpp | 2 +- + 2 files changed, 2 insertions(+), 1 deletion(-) -commit 75602fedca7b585ad8791e32a18b58e740539e36 -Merge: af69ee35a 3cfa4eb26 -Author: Luigi Ballabio -Date: Mon, 14 Nov 2022 12:25:26 +0100 +commit cecfba0c659cdff40c0c6aedecd2e1fa9e361ff8 +Author: jonghee +Date: Wed, 21 Jun 2023 00:05:58 +0900 - Deprecate internal interpolation in `InflationIndex` and `ZeroInflationIndex` (#1051) + remove some codes -commit 002d9e388d459227a4ecdbb4dcf3785518cfb6f8 -Author: Xcelerit Dev Team -Date: Mon, 14 Nov 2022 10:10:19 +0000 + ql/time/calendars/southkorea.cpp | 9 --------- + 1 file changed, 9 deletions(-) - Removes needless explicit norm template parameter +commit b22d7c9e85dc5c730ccc87954c3010f3c2822aa9 +Author: jonghee +Date: Tue, 20 Jun 2023 23:59:44 +0900 - test-suite/fastfouriertransform.cpp | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) + apply comments -commit 9b1593636d518bc131f66256f9f40fd506c817ea -Author: Xcelerit Dev Team -Date: Mon, 14 Nov 2022 10:09:46 +0000 + ql/time/calendars/southkorea.cpp | 15 ++++++++------- + ql/time/calendars/southkorea.hpp | 5 +++-- + 2 files changed, 11 insertions(+), 9 deletions(-) - Consistently use testing macros +commit af6fe9745d9f8481c35f8872c47d3938f7e7cb15 +Author: Luigi Ballabio +Date: Tue, 20 Jun 2023 16:58:55 +0200 - test-suite/americanoption.cpp | 6 +++--- - 1 file changed, 3 insertions(+), 3 deletions(-) + Reorder data member initialization, rename method -commit 46d7233bd53ecd13e2fcf30f6bf62727bbfce64e -Author: Xcelerit Dev Team -Date: Mon, 14 Nov 2022 10:08:53 +0000 + ql/termstructures/credit/defaultprobabilityhelpers.cpp | 16 +++++++--------- + ql/termstructures/credit/defaultprobabilityhelpers.hpp | 2 +- + 2 files changed, 8 insertions(+), 10 deletions(-) - Explicit casts to Real on ternary operator +commit 81a30b64afeca340d41c0e25a3afefd19a4cb8ce +Author: Binrui Dong +Date: Tue, 20 Jun 2023 22:30:43 +0800 - ql/pricingengines/vanilla/qdplusamericanengine.cpp | 6 +++--- - 1 file changed, 3 insertions(+), 3 deletions(-) + Add Hong Kong Securities Market Holidays in 2024 -commit 5826ac838c8d09d5817f128d7a3e15e4afac3f83 -Author: Xcelerit Dev Team -Date: Mon, 14 Nov 2022 10:08:10 +0000 + ql/time/calendars/hongkong.cpp | 17 +++++++++++++++++ + 1 file changed, 17 insertions(+) - Initialises large constant arrays as double, reducing compile time +commit df11f6d4bb73969dded5b097c19a3ed55988691e +Author: Fredrik Gerdin Börjesson +Date: Tue, 20 Jun 2023 15:51:31 +0200 - ql/experimental/math/zigguratrng.cpp | 2 +- - ql/math/factorial.cpp | 2 +- - ql/pricingengines/vanilla/exponentialfittinghestonengine.cpp | 4 ++-- - 3 files changed, 4 insertions(+), 4 deletions(-) + Add DESTR, SWESTR OIS indices -commit a9e30354e273df2fc676b2cca19ca4ab135d5cd9 -Author: Xcelerit Dev Team -Date: Mon, 14 Nov 2022 10:04:36 +0000 + QuantLib.vcxproj | 2 ++ + QuantLib.vcxproj.filters | 6 ++++++ + ql/CMakeLists.txt | 2 ++ + ql/indexes/ibor/Makefile.am | 2 ++ + ql/indexes/ibor/all.hpp | 2 ++ + ql/indexes/ibor/destr.hpp | 41 +++++++++++++++++++++++++++++++++++++++++ + ql/indexes/ibor/swestr.hpp | 41 +++++++++++++++++++++++++++++++++++++++++ + 7 files changed, 96 insertions(+) - Removes needless type specification for complex norm +commit c26490f58f0549cc3e08e0d423a6cd12fcbfb464 +Author: jonghee.lee +Date: Tue, 20 Jun 2023 17:22:12 +0900 - ql/math/autocovariance.hpp | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) + add copyright -commit 05d1338877fbe25ce7d15d4052085c679aff1c05 -Author: Oleg Kulkov -Date: Sun, 13 Nov 2022 20:01:32 +0100 + ql/time/calendars/southkorea.cpp | 1 + + 1 file changed, 1 insertion(+) - new example showing the bond with cahnging notional +commit 6a39e19dde1d0b498d90ccd39ff1673659752e60 +Author: jonghee.lee +Date: Tue, 20 Jun 2023 17:20:11 +0900 - Examples/AmortizingBonds/AmortizingBond.cpp | 178 ++++++++++++++++++++++++++++ - Examples/AmortizingBonds/CMakeLists.txt | 2 + - Examples/AmortizingBonds/ReadMe.txt | 1 + - ql/instruments/bond.cpp | 1 + - 4 files changed, 182 insertions(+) + apply substitute holiday to southkorea calendar -commit 3cfa4eb26085f0f65d3686fb6aa964937f64ea83 -Author: Luigi Ballabio -Date: Sun, 13 Nov 2022 14:53:58 +0100 + ql/time/calendars/southkorea.cpp | 11 +++++++---- + 1 file changed, 7 insertions(+), 4 deletions(-) - Remove custom macros +commit edba144d18939ee8fe493bda8b739ccf97ebaa16 +Author: jonghee.lee +Date: Tue, 20 Jun 2023 17:10:28 +0900 - ql/indexes/inflationindex.hpp | 10 ---------- - test-suite/inflation.cpp | 7 ------- - test-suite/inflationcapfloor.cpp | 4 ---- - test-suite/inflationcpibond.cpp | 4 ---- - test-suite/inflationcpicapfloor.cpp | 19 ++----------------- - test-suite/inflationcpiswap.cpp | 8 -------- - 6 files changed, 2 insertions(+), 50 deletions(-) - -commit 55083131193436c716eac7f7364d052bc92bff71 -Author: Luigi Ballabio -Date: Sun, 13 Nov 2022 14:36:36 +0100 - - Document deprecated data member - - ql/experimental/inflation/genericindexes.hpp | 4 ++-- - ql/indexes/inflation/aucpi.hpp | 4 ++-- - ql/indexes/inflation/euhicp.hpp | 8 +++---- - ql/indexes/inflation/frhicp.hpp | 4 ++-- - ql/indexes/inflation/ukrpi.hpp | 4 ++-- - ql/indexes/inflation/uscpi.hpp | 4 ++-- - ql/indexes/inflation/zacpi.hpp | 4 ++-- - ql/indexes/inflationindex.cpp | 32 ++++++++++++++-------------- - ql/indexes/inflationindex.hpp | 21 ++++++------------ - 9 files changed, 39 insertions(+), 46 deletions(-) - -commit 99ba217022d77679f3fa3be2789c6b4f4eb6d2d2 -Author: Luigi Ballabio -Date: Sun, 13 Nov 2022 14:16:12 +0100 - - Document deprecated method - - ql/indexes/inflationindex.cpp | 5 +++-- - ql/indexes/inflationindex.hpp | 21 +++++++-------------- - ql/instruments/zerocouponinflationswap.cpp | 2 -- - test-suite/inflation.cpp | 4 ++-- - 4 files changed, 12 insertions(+), 20 deletions(-) - -commit c2a476179454926a88ac568ab19e1a103a9a1d69 -Author: Luigi Ballabio -Date: Fri, 11 Nov 2022 23:39:08 +0100 - - Document deprecated constructors, avoid some deprecated calls - - ql/experimental/inflation/genericindexes.hpp | 30 ++++++++-------- - ql/indexes/inflation/aucpi.hpp | 23 ++++++------ - ql/indexes/inflation/euhicp.hpp | 52 +++++++++++++++------------- - ql/indexes/inflation/frhicp.hpp | 20 ++++++----- - ql/indexes/inflation/ukrpi.hpp | 20 ++++++----- - ql/indexes/inflation/uscpi.hpp | 30 ++++++++-------- - ql/indexes/inflation/zacpi.hpp | 20 ++++++----- - ql/indexes/inflationindex.hpp | 39 ++++++--------------- - test-suite/inflation.cpp | 43 ++++++++++------------- - test-suite/inflationcpibond.cpp | 7 +--- - test-suite/inflationcpicapfloor.cpp | 8 +---- - test-suite/inflationcpiswap.cpp | 8 +---- - 12 files changed, 136 insertions(+), 164 deletions(-) - -commit af69ee35a8e446072e2b7125b7af6b62c13e5776 -Merge: 0b0caf116 934764f1f -Author: Luigi Ballabio -Date: Fri, 11 Nov 2022 20:55:45 +0100 - - Make `Handle` default constructor non-explicit. (#1523) - -commit 0b0caf116cbce50e6512c1d7d91c94abb9fc0dda -Merge: 7d865a7c1 40e0adfe9 -Author: Luigi Ballabio -Date: Fri, 11 Nov 2022 19:18:49 +0100 - - Fix declaration and error message for tanh-sinh fallback (#1522) - -commit 934764f1fbd47d28253db0e4c8e74ac2d06c3271 -Author: Luigi Ballabio -Date: Fri, 11 Nov 2022 16:48:04 +0100 - - Use shorter syntax - - ql/indexes/bmaindex.hpp | 3 +- - ql/indexes/ibor/aonia.hpp | 3 +- - ql/indexes/ibor/audlibor.hpp | 3 +- - ql/indexes/ibor/bbsw.hpp | 21 ++--- - ql/indexes/ibor/bibor.hpp | 24 ++---- - ql/indexes/ibor/bkbm.hpp | 21 ++--- - ql/indexes/ibor/cadlibor.hpp | 6 +- - ql/indexes/ibor/cdor.hpp | 3 +- - ql/indexes/ibor/chflibor.hpp | 6 +- - ql/indexes/ibor/dkklibor.hpp | 3 +- - ql/indexes/ibor/eonia.hpp | 3 +- - ql/indexes/ibor/estr.hpp | 3 +- - ql/indexes/ibor/euribor.hpp | 96 ++++++++-------------- - ql/indexes/ibor/eurlibor.hpp | 51 ++++-------- - ql/indexes/ibor/fedfunds.hpp | 3 +- - ql/indexes/ibor/gbplibor.hpp | 9 +- - ql/indexes/ibor/jibar.hpp | 3 +- - ql/indexes/ibor/jpylibor.hpp | 6 +- - ql/indexes/ibor/libor.hpp | 6 +- - ql/indexes/ibor/mosprime.hpp | 3 +- - ql/indexes/ibor/nzdlibor.hpp | 3 +- - ql/indexes/ibor/nzocr.hpp | 3 +- - ql/indexes/ibor/pribor.hpp | 3 +- - ql/indexes/ibor/robor.hpp | 3 +- - ql/indexes/ibor/seklibor.hpp | 3 +- - ql/indexes/ibor/shibor.hpp | 2 +- - ql/indexes/ibor/sofr.hpp | 3 +- - ql/indexes/ibor/sonia.hpp | 3 +- - ql/indexes/ibor/thbfix.hpp | 3 +- - ql/indexes/ibor/tibor.hpp | 3 +- - ql/indexes/ibor/tona.hpp | 3 +- - ql/indexes/ibor/trlibor.hpp | 3 +- - ql/indexes/ibor/usdlibor.hpp | 9 +- - ql/indexes/ibor/wibor.hpp | 3 +- - ql/indexes/ibor/zibor.hpp | 3 +- - ql/indexes/iborindex.hpp | 5 +- - ql/indexes/swap/chfliborswap.hpp | 3 +- - ql/indexes/swap/euriborswap.hpp | 9 +- - ql/indexes/swap/eurliborswap.hpp | 9 +- - ql/indexes/swap/gbpliborswap.hpp | 3 +- - ql/indexes/swap/jpyliborswap.hpp | 10 +-- - ql/indexes/swap/usdliborswap.hpp | 6 +- - .../credit/defaultdensitystructure.hpp | 12 +-- - ql/termstructures/credit/hazardratestructure.hpp | 12 +-- - .../credit/interpolateddefaultdensitycurve.hpp | 25 +++--- - .../credit/interpolatedhazardratecurve.hpp | 25 +++--- - .../interpolatedsurvivalprobabilitycurve.hpp | 24 +++--- - ql/termstructures/credit/piecewisedefaultcurve.hpp | 37 ++++----- - .../credit/survivalprobabilitystructure.hpp | 12 +-- - ql/termstructures/defaulttermstructure.hpp | 12 +-- - .../volatility/optionlet/optionletstripper.hpp | 2 +- - .../volatility/optionlet/optionletstripper1.hpp | 2 +- - ql/termstructures/yield/discountcurve.hpp | 20 ++--- - ql/termstructures/yield/forwardcurve.hpp | 21 +++-- - ql/termstructures/yield/forwardstructure.hpp | 8 +- - .../yield/interpolatedsimplezerocurve.hpp | 20 ++--- - ql/termstructures/yield/oisratehelper.hpp | 4 +- - .../yield/overnightindexfutureratehelper.hpp | 6 +- - ql/termstructures/yield/piecewiseyieldcurve.hpp | 31 +++---- - ql/termstructures/yield/ratehelpers.hpp | 22 ++--- - ql/termstructures/yield/zerocurve.hpp | 21 +++-- - ql/termstructures/yield/zeroyieldstructure.hpp | 8 +- - ql/termstructures/yieldtermstructure.hpp | 8 +- - 63 files changed, 284 insertions(+), 419 deletions(-) - -commit 12fe0e94b6350906b9ddff733ee1aa9d66b775ee -Author: Luigi Ballabio -Date: Fri, 11 Nov 2022 15:10:43 +0100 - - Make Handle default constructor non-explicit. - - This allows using {} for default parameters. + apply substitute holiday - ql/handle.hpp | 4 +++- - 1 file changed, 3 insertions(+), 1 deletion(-) + ql/time/calendars/southkorea.cpp | 118 ++++++++++++++++++++++++++++++++------- + 1 file changed, 99 insertions(+), 19 deletions(-) -commit 8074fddad00e91734f81062d2c83859c7ed261d3 -Author: Luigi Ballabio -Date: Fri, 11 Nov 2022 13:16:59 +0100 +commit 0bc1e5e3babd907c33bcb002775fc12ef46caa5a +Author: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> +Date: Mon, 19 Jun 2023 16:52:25 +0000 - Never mind forward declarations. - - This reverts commit 0555333bd7ffd269c62b431aac51cc387dd3721c. + Update copyright list in license - ql/cashflows/cpicouponpricer.cpp | 1 - - ql/cashflows/inflationcouponpricer.hpp | 1 - - ql/indexes/inflationindex.hpp | 4 +--- - ql/instruments/inflationcapfloor.cpp | 1 - - ql/instruments/zerocouponinflationswap.cpp | 1 - - ql/pricingengines/inflation/inflationcapfloorengines.cpp | 1 - - 6 files changed, 1 insertion(+), 8 deletions(-) + LICENSE.TXT | 1 + + 1 file changed, 1 insertion(+) -commit f3d9eecabfd8b20f25454b578bc2264aa9f8d6b8 +commit cb2080b6eb07655f67717a58db7494285eff016e +Merge: c22f15a3e d8e74fbeb Author: Luigi Ballabio -Date: Fri, 11 Nov 2022 10:50:32 +0100 +Date: Mon, 19 Jun 2023 18:51:56 +0200 - More tests for interpolated fixings, removed redundant ones + Add Canadian Overnight Repo Rate Average (CORRA) (#1705) - test-suite/CMakeLists.txt | 2 - - test-suite/Makefile.am | 2 - - test-suite/inflation.cpp | 182 ++++++++++++++----- - test-suite/inflation.hpp | 3 +- - test-suite/inflationzciisinterpolation.cpp | 283 ----------------------------- - test-suite/inflationzciisinterpolation.hpp | 39 ---- - test-suite/quantlibtestsuite.cpp | 2 - - test-suite/testsuite.vcxproj | 2 - - test-suite/testsuite.vcxproj.filters | 6 - - 9 files changed, 143 insertions(+), 378 deletions(-) - -commit 0555333bd7ffd269c62b431aac51cc387dd3721c +commit d8e74fbebdc53ff54ec55514c571bd13154969ea Author: Luigi Ballabio -Date: Thu, 10 Nov 2022 18:37:55 +0100 +Date: Mon, 19 Jun 2023 14:50:40 +0200 - Use forward declarations where possible + Reorder lists - ql/cashflows/cpicouponpricer.cpp | 1 + - ql/cashflows/inflationcouponpricer.hpp | 1 + - ql/indexes/inflationindex.hpp | 1 - - ql/instruments/inflationcapfloor.cpp | 1 + - ql/instruments/zerocouponinflationswap.cpp | 1 + - ql/pricingengines/inflation/inflationcapfloorengines.cpp | 1 + - 6 files changed, 5 insertions(+), 1 deletion(-) + QuantLib.vcxproj | 6 +++--- + QuantLib.vcxproj.filters | 14 +++++++------- + ql/CMakeLists.txt | 4 ++-- + ql/indexes/ibor/Makefile.am | 8 ++++---- + ql/indexes/ibor/all.hpp | 1 + + 5 files changed, 17 insertions(+), 16 deletions(-) -commit 7d865a7c15584df9c74941fad06c8f6e00d30045 -Merge: efe46c1e7 5dc08d220 -Author: Luigi Ballabio -Date: Thu, 10 Nov 2022 14:48:24 +0100 +commit da0076c07e2066f0b8c9d36d7b3e885681cf9267 +Author: AND2797 +Date: Mon, 19 Jun 2023 07:38:46 -0400 - add equality operators for matrix (#1521) + #1685: Support Canadian Overnight Repo Rate Average (CORRA) + - add corra.cpp/.hpp to build files -commit 5dc08d2202e420c10278f16fc66b0295a446c39f -Author: Matthias Groncki -Date: Thu, 10 Nov 2022 17:22:15 +0700 + QuantLib.vcxproj | 2 ++ + QuantLib.vcxproj.filters | 6 ++++++ + ql/CMakeLists.txt | 1 + + ql/indexes/ibor/Makefile.am | 6 ++++-- + 4 files changed, 13 insertions(+), 2 deletions(-) - add equality operators for matrix +commit a1cdeefe80dc2a8f504233a6498cd2e9a7f16297 +Author: AND2797 +Date: Sun, 18 Jun 2023 03:20:59 -0400 - ql/math/matrix.hpp | 12 ++++++++++++ - 1 file changed, 12 insertions(+) + #1685: Support Canadian Overnight Repo Rate Average (CORRA) + - remove idle "//" -commit efe46c1e7e086ecb96b310639a67b900b4132bb5 -Merge: 00ae31ebf e4af81902 -Author: Luigi Ballabio -Date: Thu, 10 Nov 2022 00:47:13 +0100 + ql/indexes/ibor/corra.cpp | 1 - + 1 file changed, 1 deletion(-) - Expose underlying rate in capped/floored YoY inflation coupon (#1520) +commit 5326a10825251776b38c6832a6c8efbe8c044caa +Author: AND2797 +Date: Sat, 17 Jun 2023 22:07:12 -0400 -commit 00ae31ebfd38d596091cd0d7278d1be504f76920 -Merge: 864d0edad 50c5c3036 -Author: Luigi Ballabio -Date: Wed, 9 Nov 2022 23:59:22 +0100 + #1685: Support Canadian Overnight Repo Rate Average (CORRA) - Avoid out-of-memory access in empty `Exercise` instance (#1519) + ql/CMakeLists.txt | 1 + + ql/indexes/ibor/corra.cpp | 28 ++++++++++++++++++++++++++++ + ql/indexes/ibor/corra.hpp | 33 +++++++++++++++++++++++++++++++++ + 3 files changed, 62 insertions(+) -commit e4af819025d50bbc7f0d13c4873f1104686fd69d -Author: Luigi Ballabio -Date: Wed, 9 Nov 2022 17:22:44 +0100 +commit db90eb6758dcecb7a7a319b3e62174a0642e6a09 +Author: Andrea Pellegatta +Date: Fri, 16 Jun 2023 16:27:58 +0200 - Expose underlying rate in capped/floored YoY inflation coupon + update copyright - ql/cashflows/capflooredinflationcoupon.cpp | 33 +++++++++++------------------- - ql/cashflows/capflooredinflationcoupon.hpp | 3 +++ - 2 files changed, 15 insertions(+), 21 deletions(-) + ql/termstructures/credit/defaultprobabilityhelpers.cpp | 1 + + 1 file changed, 1 insertion(+) -commit 50c5c3036c72bdbe60fd7af91feda529d888680e -Author: Luigi Ballabio -Date: Wed, 9 Nov 2022 16:51:24 +0100 +commit c2808a4b58c8e45687d109800d0a9cfd3a92c677 +Author: Andrea Pellegatta +Date: Fri, 16 Jun 2023 14:56:43 +0200 - Avoid out-of-memory access in empty Exercise instance + bug fix upfront-cds-helper initializeDates - ql/exercise.cpp | 5 +++++ - ql/exercise.hpp | 2 +- - 2 files changed, 6 insertions(+), 1 deletion(-) + .../credit/defaultprobabilityhelpers.cpp | 19 +++++++++++-------- + .../credit/defaultprobabilityhelpers.hpp | 2 ++ + 2 files changed, 13 insertions(+), 8 deletions(-) -commit 864d0edad3e6accaafa77e7b828eb392a4e55833 -Merge: ff382343c 97506f7b5 +commit c22f15a3e98d3b575bc5a4f98ae489e61e963d13 +Merge: e89204adb c0db991a2 Author: Luigi Ballabio -Date: Wed, 9 Nov 2022 16:08:34 +0100 +Date: Wed, 14 Jun 2023 16:13:12 +0200 - Use `Handle` in constant CPI volatility instead of immutable `Real` value (#1518) + Suppress LeakSanitizer in testNotificationLoop (#1702) -commit ff382343c2bd5f51923a4ee11266ca12d757562c -Merge: 317e3e2a2 83fec02d4 -Author: Luigi Ballabio -Date: Wed, 9 Nov 2022 15:23:46 +0100 +commit c0db991a2e181dfc074c74069aaf830f691792e8 +Author: Jonathan Sweemer +Date: Wed, 14 Jun 2023 00:41:02 +0000 - Add King Charles III coronation holiday to UK calendar (#1516) + Suppress LeakSanitizer in testNotificationLoop -commit 317e3e2a2fda701f04798ed4333e19fa3ec1a920 -Merge: 3c7c5b93c e25424573 + .github/workflows/sanitizer.yml | 2 +- + .lsan.txt | 1 + + 2 files changed, 2 insertions(+), 1 deletion(-) + +commit e89204adb38d2579d94194ab3a7361753595605f +Merge: a3d4b90a1 b04defa0a Author: Luigi Ballabio -Date: Wed, 9 Nov 2022 14:44:24 +0100 +Date: Wed, 14 Jun 2023 11:19:09 +0200 - Add holiday for National Day of Mourning to Australian calendar (#1517) + Drop General Prayer Day from DK calendar from 2024 (#1701) -commit e25424573d0bdfa2231dea977ce6ba38997261a2 +commit b04defa0aa34cda12096d654cc95acbbd2c60fb2 Author: Fredrik Gerdin Börjesson -Date: Wed, 9 Nov 2022 12:41:24 +0100 +Date: Wed, 14 Jun 2023 09:19:31 +0200 - Add AU holiday for national day of mourning + Drop General Prayer Day from DK calendar from 2024 + + "Store Bededag" - ql/time/calendars/australia.cpp | 4 +++- - ql/time/calendars/australia.hpp | 1 + - 2 files changed, 4 insertions(+), 1 deletion(-) + ql/time/calendars/denmark.cpp | 2 +- + ql/time/calendars/denmark.hpp | 2 +- + 2 files changed, 2 insertions(+), 2 deletions(-) -commit 97506f7b55f96529bbb772ac2918d7c83513c3f2 +commit a3d4b90a1beb944bef8e69ffddca2bf5a0339235 +Merge: a3e0f6d97 fcd23eee8 Author: Luigi Ballabio -Date: Wed, 9 Nov 2022 11:10:00 +0100 +Date: Tue, 13 Jun 2023 12:34:04 +0200 - Use correct payment calendar + Mark Impl classes as final (#1700) - ql/instruments/cpicapfloor.cpp | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -commit 83fec02d4030d937f95212c79c1368e9288b40d9 -Author: Fredrik Gerdin Börjesson -Date: Wed, 9 Nov 2022 10:57:57 +0100 - - Add comment on special holidays in docstring +commit fcd23eee864bf725c18c0cee559198f075ebcc50 +Author: Eugene Toder +Date: Sun, 11 Jun 2023 19:27:39 -0400 - ql/time/calendars/unitedkingdom.hpp | 3 +++ - 1 file changed, 3 insertions(+) + Mark Impl classes as final + + This expresses the intent and allows compiler to generate more efficient + code. + + ql/experimental/shortrate/generalizedhullwhite.hpp | 4 ++-- + ql/math/interpolations/abcdinterpolation.hpp | 4 ++-- + ql/math/interpolations/convexmonotoneinterpolation.hpp | 2 +- + ql/math/interpolations/cubicinterpolation.hpp | 4 ++-- + ql/math/interpolations/xabrinterpolation.hpp | 4 ++-- + ql/math/optimization/constraint.hpp | 10 +++++----- + ql/math/optimization/projectedconstraint.hpp | 2 +- + ql/methods/finitedifferences/shoutcondition.hpp | 2 +- + ql/models/equity/gjrgarchmodel.cpp | 2 +- + ql/models/equity/hestonmodel.hpp | 2 +- + ql/models/model.hpp | 2 +- + ql/models/parameter.hpp | 6 +++--- + ql/models/shortrate/onefactormodels/coxingersollross.cpp | 2 +- + .../shortrate/onefactormodels/extendedcoxingersollross.hpp | 2 +- + ql/models/shortrate/onefactormodels/hullwhite.hpp | 2 +- + ql/models/shortrate/twofactormodels/g2.hpp | 2 +- + ql/models/volatility/garch.cpp | 4 ++-- + ql/time/calendars/argentina.hpp | 2 +- + ql/time/calendars/australia.hpp | 4 ++-- + ql/time/calendars/austria.hpp | 4 ++-- + ql/time/calendars/bespokecalendar.hpp | 2 +- + ql/time/calendars/botswana.hpp | 2 +- + ql/time/calendars/brazil.hpp | 4 ++-- + ql/time/calendars/canada.hpp | 4 ++-- + ql/time/calendars/chile.hpp | 2 +- + ql/time/calendars/china.hpp | 4 ++-- + ql/time/calendars/czechrepublic.hpp | 2 +- + ql/time/calendars/denmark.hpp | 2 +- + ql/time/calendars/finland.hpp | 2 +- + ql/time/calendars/france.hpp | 4 ++-- + ql/time/calendars/germany.hpp | 10 +++++----- + ql/time/calendars/hongkong.hpp | 2 +- + ql/time/calendars/hungary.hpp | 2 +- + ql/time/calendars/iceland.hpp | 2 +- + ql/time/calendars/india.hpp | 2 +- + ql/time/calendars/indonesia.hpp | 2 +- + ql/time/calendars/israel.hpp | 2 +- + ql/time/calendars/italy.hpp | 4 ++-- + ql/time/calendars/japan.hpp | 2 +- + ql/time/calendars/jointcalendar.hpp | 2 +- + ql/time/calendars/mexico.hpp | 2 +- + ql/time/calendars/newzealand.hpp | 2 +- + ql/time/calendars/norway.hpp | 2 +- + ql/time/calendars/nullcalendar.hpp | 2 +- + ql/time/calendars/poland.hpp | 2 +- + ql/time/calendars/romania.hpp | 2 +- + ql/time/calendars/russia.hpp | 4 ++-- + ql/time/calendars/saudiarabia.hpp | 2 +- + ql/time/calendars/singapore.hpp | 2 +- + ql/time/calendars/slovakia.hpp | 2 +- + ql/time/calendars/southafrica.hpp | 2 +- + ql/time/calendars/southkorea.hpp | 2 +- + ql/time/calendars/sweden.hpp | 2 +- + ql/time/calendars/switzerland.hpp | 2 +- + ql/time/calendars/taiwan.hpp | 2 +- + ql/time/calendars/target.hpp | 2 +- + ql/time/calendars/thailand.hpp | 2 +- + ql/time/calendars/turkey.hpp | 2 +- + ql/time/calendars/ukraine.hpp | 2 +- + ql/time/calendars/unitedkingdom.hpp | 6 +++--- + ql/time/calendars/unitedstates.hpp | 10 +++++----- + ql/time/calendars/weekendsonly.hpp | 2 +- + ql/time/daycounters/actual360.hpp | 2 +- + ql/time/daycounters/actual364.hpp | 2 +- + ql/time/daycounters/actual36525.hpp | 2 +- + ql/time/daycounters/actual365fixed.hpp | 6 +++--- + ql/time/daycounters/actual366.hpp | 2 +- + ql/time/daycounters/actualactual.hpp | 8 ++++---- + ql/time/daycounters/business252.hpp | 2 +- + ql/time/daycounters/one.hpp | 2 +- + ql/time/daycounters/simpledaycounter.hpp | 2 +- + ql/time/daycounters/thirty360.hpp | 12 ++++++------ + ql/time/daycounters/thirty365.hpp | 2 +- + 73 files changed, 112 insertions(+), 112 deletions(-) + +commit a3e0f6d979ce51edfa7c9854065b30e46f0c7d44 +Merge: 9b4843605 9d85a9d5f +Author: Luigi Ballabio +Date: Mon, 12 Jun 2023 11:45:14 +0200 + + Use bitmask in BespokeCalendar (#1699) + +commit 9b4843605dc1202327a06b150ff2186a53239023 +Merge: 47a94ff66 1483ead2c +Author: Luigi Ballabio +Date: Mon, 12 Jun 2023 09:52:55 +0200 + + Replace custom no_deletion with standard null_deleter (#1698) + +commit 9d85a9d5fbfe29317ca27aaa7b89ca30a871e8ef +Author: Eugene Toder +Date: Sun, 11 Jun 2023 18:19:43 -0400 + + Use bitmask in BespokeCalendar + + Replace std::set with a bitmask, which is more efficient. -commit 1d12e222258605567a65382d625d42ad5c5e9cab -Author: Luigi Ballabio -Date: Wed, 9 Nov 2022 10:24:06 +0100 + ql/time/calendars/bespokecalendar.cpp | 4 ++-- + ql/time/calendars/bespokecalendar.hpp | 2 +- + 2 files changed, 3 insertions(+), 3 deletions(-) - Use Handle in constant CPI volatility +commit 1483ead2c1a6093b47e21e250d447b4970a7b5d0 +Author: Eugene Toder +Date: Sun, 11 Jun 2023 17:46:07 -0400 - .../volatility/inflation/constantcpivolatility.cpp | 19 ++++++++++++++++--- - .../volatility/inflation/constantcpivolatility.hpp | 17 +++++++++++++---- - 2 files changed, 29 insertions(+), 7 deletions(-) + Replace custom no_deletion with standard null_deleter -commit f3d1e609c3fdbb26e3dfca1c8e3312894c2c721a -Author: Fredrik Gerdin Börjesson -Date: Wed, 9 Nov 2022 10:12:32 +0100 + ql/experimental/averageois/arithmeticoisratehelper.cpp | 7 ++----- + 1 file changed, 2 insertions(+), 5 deletions(-) - Add King Charles III coronation holiday to UK cal +commit 47a94ff661f05c1bfa6bd4b1210da2f84b2b4148 +Merge: 8641a05c9 cb041bc99 +Author: Luigi Ballabio +Date: Fri, 9 Jun 2023 09:02:17 +0200 - ql/time/calendars/unitedkingdom.cpp | 2 ++ - 1 file changed, 2 insertions(+) + Break infinite recursion in notification loops (#1693) -commit 3c7c5b93c1082bbbe5cebae406c1b156fd8efa3e -Merge: f6d65ce9f 3180e5718 +commit cb041bc991fe1ab65e0789001f3cc8db2cc51461 Author: Luigi Ballabio -Date: Tue, 8 Nov 2022 09:34:33 +0100 +Date: Thu, 8 Jun 2023 11:03:34 +0200 - Remove dependency on BOOST_FOREACH (#1515) + Add configuration flag for managing notification cycles -commit 3180e5718906be26a3b4184ce23b7dd20954eeff -Author: Jonathan Sweemer -Date: Mon, 7 Nov 2022 21:21:04 +0900 + .github/workflows/linux-full-tests.yml | 6 ++++++ + .github/workflows/linux-nondefault.yml | 2 +- + .github/workflows/linux.yml | 7 +++++++ + .github/workflows/macos-nondefault.yml | 2 +- + CMakeLists.txt | 1 + + CMakePresets.json | 2 ++ + Docs/pages/config.docs | 11 ++++++++++- + configure.ac | 19 +++++++++++++++++++ + ql/config.hpp.cfg | 1 + + ql/patterns/lazyobject.hpp | 7 ++++++- + ql/userconfig.hpp | 9 ++++++++- + test-suite/lazyobject.cpp | 12 +++++++++++- + 12 files changed, 73 insertions(+), 6 deletions(-) - Remove dependency on BOOST_FOREACH +commit 8641a05c93dd2fc7965807435e4dd539189a9237 +Merge: 73f662468 348be919b +Author: Luigi Ballabio +Date: Tue, 6 Jun 2023 21:02:24 +0200 - ql/models/volatility/garch.cpp | 9 ++++----- - 1 file changed, 4 insertions(+), 5 deletions(-) + Add Taiwanese holidays for 2020-2023 (#1694) -commit f6d65ce9fac26f8a7eb36796f898079234b6b4af -Author: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> -Date: Sun, 6 Nov 2022 06:16:43 +0000 +commit 348be919b835ad21b273578e2c596f5b1e8f3ba3 +Author: jnzhang +Date: Tue, 6 Jun 2023 22:21:08 +0800 - Automated fixes by clang-tidy + Add holidays for 2020-2023 - ql/math/integrals/gaussianquadratures.hpp | 5 +- - ql/pricingengines/vanilla/qdfpamericanengine.cpp | 78 +++++++++++----------- - ql/pricingengines/vanilla/qdplusamericanengine.cpp | 37 ++++------ - ql/pricingengines/vanilla/qdplusamericanengine.hpp | 11 ++- - test-suite/americanoption.cpp | 10 ++- - 5 files changed, 68 insertions(+), 73 deletions(-) + ql/time/calendars/taiwan.cpp | 99 +++++++++++++++++++++++++++++++++++++++++++- + ql/time/calendars/taiwan.hpp | 4 +- + 2 files changed, 100 insertions(+), 3 deletions(-) -commit 549cd6dfa1679b31c9eb7ce7bc65bd6f64a84e72 -Merge: 4a96abc27 a1a589398 +commit d0977f6e22e499fe2c792881c98806ee6146ec85 Author: Luigi Ballabio -Date: Sun, 6 Nov 2022 14:10:00 +0100 +Date: Tue, 6 Jun 2023 14:13:14 +0200 - fixed QD+ fixed point engine for high precision Gauss-Lobatto integration (#1512) + Make new boolean flag private -commit a1a589398c594afcc8d41b84fae725ef43a89a7e -Author: klausspanderen -Date: Sat, 5 Nov 2022 16:02:25 +0100 + ql/patterns/lazyobject.hpp | 5 +++-- + 1 file changed, 3 insertions(+), 2 deletions(-) - fixed QD+ fixed point engine with high precision Lobatto integration +commit 73f662468a6a39d4d1570fe145d5611acc925c05 +Merge: 2daad8248 9755387ad +Author: Luigi Ballabio +Date: Tue, 6 Jun 2023 09:46:26 +0200 - Examples/EquityOption/EquityOption.cpp | 4 - - ql/pricingengines/vanilla/qdfpamericanengine.cpp | 51 +++++++-- - test-suite/americanoption.cpp | 137 +++++++++++++++++++++-- - test-suite/americanoption.hpp | 1 + - 4 files changed, 170 insertions(+), 23 deletions(-) + Avoid spurious notifications in OIS helpers (#1692) -commit 40e0adfe958a48619a2a01d7fefc209bb9e0444a +commit 2daad8248ece9224fde15e655592c38d45dc143e +Merge: ab24f51dc 0bed2fe3c Author: Luigi Ballabio -Date: Fri, 4 Nov 2022 11:30:04 +0100 +Date: Mon, 5 Jun 2023 18:30:41 +0200 - Fix declaration and error message for tanh-sinh fallback + Clear all fixings between tests (#1691) - ql/math/integrals/tanhsinhintegral.hpp | 7 ++++--- - 1 file changed, 4 insertions(+), 3 deletions(-) - -commit 4a96abc278f311c8384b2e4d42491ee354cd5d3f -Merge: 5868429ef 7258eb182 +commit ab24f51dcc1bb6bd8de51bf834f13ee47367e75f +Merge: 78b112b3a c0d938315 Author: Luigi Ballabio -Date: Fri, 4 Nov 2022 11:18:07 +0100 +Date: Mon, 5 Jun 2023 18:07:34 +0200 - Replace boost::thread with std::thread (#1504) + Support filtering tests in parallel unit test runner (#1690) -commit 7258eb182042098ef7cf0541df26bfe27c76c9e2 -Author: Jonathan Sweemer -Date: Fri, 28 Oct 2022 21:50:06 +0900 +commit 7520ad8c1265598151dba7539c7306d84e92215f +Author: Luigi Ballabio +Date: Mon, 5 Jun 2023 17:33:21 +0200 - Replace boost::thread with std::thread + Reuse utility - CMakeLists.txt | 26 +++++------------ - Examples/Makefile.am | 2 +- - acinclude.m4 | 69 +++++++++++++++------------------------------- - configure.ac | 16 ++--------- - ql/CMakeLists.txt | 3 -- - ql/auto_link.hpp | 11 -------- - ql/patterns/observable.cpp | 12 ++++---- - ql/patterns/observable.hpp | 41 ++++++++++++++------------- - quantlib-config.in | 2 +- - quantlib.pc.in | 2 +- - test-suite/Makefile.am | 4 +-- - test-suite/observable.cpp | 33 +++++++++++----------- - 12 files changed, 79 insertions(+), 142 deletions(-) + test-suite/defaultprobabilitycurves.cpp | 23 ++--------------------- + test-suite/equitycashflow.cpp | 21 +-------------------- + test-suite/equityindex.cpp | 27 ++++----------------------- + test-suite/equitytotalreturnswap.cpp | 25 +++---------------------- + test-suite/piecewiseyieldcurve.cpp | 22 +--------------------- + 5 files changed, 11 insertions(+), 107 deletions(-) -commit 5868429ef3b0e1f0224016b1bcf14345e1e8642c -Merge: 7876651df 2f5650e0c +commit 8f6c28b090fcac0803adf2e8270f071a9d07d874 Author: Luigi Ballabio -Date: Wed, 2 Nov 2022 23:41:27 +0100 +Date: Mon, 5 Jun 2023 17:21:05 +0200 - Add workaround for GCC bug (#1511) + Break infinite notification loops when lazy objects are involved -commit 2f5650e0cf0a0aee22556feeaaa4854354293d42 -Author: Jonathan Sweemer -Date: Tue, 1 Nov 2022 12:10:44 +0900 + ql/patterns/lazyobject.hpp | 23 ++++++++++++++++++++++- + test-suite/lazyobject.cpp | 21 +++++++++++++++++++++ + test-suite/lazyobject.hpp | 1 + + test-suite/utilities.hpp | 20 ++++++++++++++++++++ + 4 files changed, 64 insertions(+), 1 deletion(-) + +commit 9755387ad4098f6d8ea6d5955864191877152f41 +Author: Luigi Ballabio +Date: Mon, 5 Jun 2023 15:15:15 +0200 - Add workaround for GCC bug + Avoid spurious notifications in OIS helper + + We save and/or register with a clone of the passed index, so that + the helper doesn't receive notifications from any curves that the + index might contain but that are not used during bootstrapping. - ql/patterns/singleton.hpp | 23 ++++++++++++++++++++--- - 1 file changed, 20 insertions(+), 3 deletions(-) + ql/termstructures/yield/oisratehelper.cpp | 29 +++++++++++------------------ + ql/termstructures/yield/oisratehelper.hpp | 4 ++-- + 2 files changed, 13 insertions(+), 20 deletions(-) -commit 7876651df25b6efc91582c19a8e2446afe300eae +commit 78b112b3ad3e76159e1d4a920a9e8421d550d5d6 +Merge: d5ffd783d f78ec2716 Author: Luigi Ballabio -Date: Wed, 2 Nov 2022 11:34:50 +0100 +Date: Mon, 5 Jun 2023 10:55:13 +0200 - Disable high-precision engine if not available + Fix typo in MulticurveBootstrapping.cpp (#1689) - Examples/EquityOption/EquityOption.cpp | 5 +++++ - 1 file changed, 5 insertions(+) +commit 0bed2fe3cd15051c436c6a9fb713f1e8d9f00eb9 +Author: Eugene Toder +Date: Sun, 4 Jun 2023 06:53:54 -0400 -commit 608a9c2323cec7609d05134ac030735590252899 -Merge: d2f413940 821f1a10f -Author: Luigi Ballabio -Date: Tue, 1 Nov 2022 17:15:45 +0100 + Clear all fixings between tests + + Centralize cleaning of fixings in quantlib_test_case instead of having + each test do this manually. + + Fixes #1687 + + test-suite/assetswap.cpp | 1 - + test-suite/cashflows.cpp | 2 -- + test-suite/cmsspread.cpp | 1 - + test-suite/equitycashflow.cpp | 1 - + test-suite/equityindex.cpp | 1 - + test-suite/equitytotalreturnswap.cpp | 5 +---- + test-suite/indexes.cpp | 2 -- + test-suite/inflation.cpp | 11 ----------- + test-suite/inflationcpibond.cpp | 5 ----- + test-suite/inflationcpiswap.cpp | 1 - + test-suite/overnightindexedcoupon.cpp | 1 - + test-suite/piecewiseyieldcurve.cpp | 2 -- + test-suite/shortratemodels.cpp | 4 ---- + test-suite/utilities.cpp | 7 ------- + test-suite/utilities.hpp | 11 +++-------- + 15 files changed, 4 insertions(+), 51 deletions(-) + +commit f78ec2716dbcd6c23649cb3c305b539eee4d37f5 +Author: Jose Garcia +Date: Sat, 3 Jun 2023 15:12:08 -0400 + + Fix typo in MulticurveBootstrapping.cpp , comment should read 0.9% not 0.009%, code is OK + + Change-Id: I99a7e90bdd29211daf17f4de2dc6aa62a4e753dd - Add full tests and nondefault tests to weekly schedule (#1508) + Examples/MulticurveBootstrapping/MulticurveBootstrapping.cpp | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) -commit d2f413940ada8a622ddddbfc4a941ad3151cfbd5 -Merge: 7fa23eea8 3ca376438 -Author: Luigi Ballabio -Date: Tue, 1 Nov 2022 17:14:53 +0100 +commit c0d938315939201aebc67f18106f975f75055234 +Author: Eugene Toder +Date: Sun, 4 Jun 2023 08:42:32 -0400 - avoid bug in early versions of tanh_sinh implementation (#1507) + Support filtering tests in parallel unit test runner + + Allow filtering tests using Boost.Test's standard --run_test= + option. This works out-of-the-box, except we should not pass this option + to the subprocesses. + + Also, use Boost.Process's system() with a vector of strings instead of + std::system() with a string to avoid shell escaping issues: arguments + with spaces becoming multiple arguments and globs (e.g. *) being + expanded by the shell. -commit 821f1a10f6b1ad199f7a24e55c973af7a4e8f77e -Author: Jonathan Sweemer -Date: Tue, 1 Nov 2022 21:33:16 +0900 + test-suite/paralleltestrunner.hpp | 26 +++++++++++++------------- + 1 file changed, 13 insertions(+), 13 deletions(-) - Add full tests and nondefault tests to weekly schedule +commit d5ffd783d5d21def4fa3dfd68a7351780df2ee44 +Merge: 8d5569857 98519fe39 +Author: Luigi Ballabio +Date: Wed, 31 May 2023 15:33:42 +0200 - .github/workflows/linux-full-tests.yml | 5 ++++- - .github/workflows/linux-nondefault.yml | 5 ++++- - .github/workflows/macos-nondefault.yml | 5 ++++- - 3 files changed, 12 insertions(+), 3 deletions(-) + Implement iterator_adaptor with standard library (#1682) -commit 3ca376438ca7ae600abec5813abba9e785d21e04 -Author: klausspanderen -Date: Tue, 1 Nov 2022 13:07:20 +0100 +commit 8d5569857f350810e2b278525525d8389708d17a +Author: Luigi Ballabio +Date: Wed, 31 May 2023 12:29:39 +0200 - avoid bug in early versions of tanh_sinh implementation + Make it possible to skip building the examples - ql/math/integrals/tanhsinhintegral.hpp | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) + Examples/Makefile.am | 15 +++++++++++++++ + configure.ac | 10 ++++++++++ + 2 files changed, 25 insertions(+) -commit 7fa23eea8097fcf37ad8ef915a2ed34ef4e4f8e6 -Author: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> -Date: Tue, 1 Nov 2022 01:15:09 +0000 +commit 98519fe39bf8d9cf124f58a59d5f37fbea0fea15 +Author: Jonathan Sweemer +Date: Sat, 20 May 2023 06:47:36 +0000 - Update copyright list in license + Implement iterator_adaptor with standard library - LICENSE.TXT | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) + ql/utilities/steppingiterator.hpp | 174 ++++++++++++++++++++++++++++++++++---- + test-suite/matrices.cpp | 8 ++ + 2 files changed, 165 insertions(+), 17 deletions(-) -commit 3e74b288798103072d074b5bddaa50a90bd24eb9 -Merge: 88a7cc8ba 2a2e4f100 +commit 048f4b9355998ecf68ffd8d701e0f9effd9e0dfe +Merge: 6aea4d429 388f33ab9 Author: Luigi Ballabio -Date: Tue, 1 Nov 2022 02:14:48 +0100 +Date: Tue, 30 May 2023 09:12:34 +0200 - QD+ fixed point American option engine (#1495) + additional test case for schedule (#1683) -commit 2a2e4f100cd14b5e65ba44d443383590d2366953 -Author: Luigi Ballabio -Date: Tue, 1 Nov 2022 00:02:16 +0100 +commit 388f33ab9cd0c06933f40c6b84eee4b7589645da +Author: jakeheke75 +Date: Mon, 29 May 2023 23:50:24 +0200 - Add to equity option example + code clean up removed unnecessary spaces - Examples/EquityOption/EquityOption.cpp | 43 +++++++++++++++++++++++++++++----- - 1 file changed, 37 insertions(+), 6 deletions(-) + test-suite/schedule.cpp | 8 ++++---- + 1 file changed, 4 insertions(+), 4 deletions(-) -commit babf9e562a31164462a911516054bc51cf270568 -Author: Luigi Ballabio -Date: Mon, 31 Oct 2022 23:53:36 +0100 +commit bf09060b6cef928dd2ba5d03fb057581e880fc1f +Author: jakeheke75 +Date: Mon, 29 May 2023 22:25:06 +0200 - Move factory methods to engine + additional test case for schedule - ql/pricingengines/vanilla/qdfpamericanengine.cpp | 38 +++++++++++++----------- - ql/pricingengines/vanilla/qdfpamericanengine.hpp | 14 ++++----- - test-suite/americanoption.cpp | 4 +-- - 3 files changed, 27 insertions(+), 29 deletions(-) + test-suite/schedule.cpp | 27 +++++++++++++++++++++++++++ + test-suite/schedule.hpp | 1 + + 2 files changed, 28 insertions(+) -commit 71c6b4d18671ab631928ebbc0286b01d89311808 +commit 6aea4d4293404d6c2ce94235136b9835d3a7afe3 Author: Luigi Ballabio -Date: Fri, 28 Oct 2022 13:13:46 +0200 +Date: Mon, 29 May 2023 11:43:03 +0200 - Format documentation + Fix evaluation date for failing test - ql/pricingengines/vanilla/qdfpamericanengine.hpp | 34 +++++++++++------------- - 1 file changed, 16 insertions(+), 18 deletions(-) + test-suite/optionletstripper.cpp | 29 +++++++++++------------------ + 1 file changed, 11 insertions(+), 18 deletions(-) -commit 88a7cc8ba874a4352074ed8502eb82f9ce1e4ce9 -Merge: df42c2adb 26e4678d9 +commit be7bdfb9ae4a4d38a3b6cc0bbf7ec75b5b203731 +Merge: ef0d3c92e 40231fbb2 Author: Luigi Ballabio -Date: Fri, 28 Oct 2022 12:16:33 +0200 +Date: Thu, 25 May 2023 15:11:03 +0200 - Check and retrieve inflation fixings on first day of inflation period (#1503) + Don't adjust explicit effective and termination dates to end of month (#1509) -commit 7ddb55c0f1ee59e0a1f37a67d0ef7efdd80519cc +commit ef0d3c92ef1be397debea1bad323531f5d1692af +Merge: df5339ea4 bfdb5e374 Author: Luigi Ballabio -Date: Fri, 28 Oct 2022 12:06:39 +0200 - - Avoid static data members +Date: Thu, 25 May 2023 14:44:59 +0200 - ql/pricingengines/vanilla/qdfpamericanengine.cpp | 21 ++++++--------------- - ql/pricingengines/vanilla/qdfpamericanengine.hpp | 4 ---- - 2 files changed, 6 insertions(+), 19 deletions(-) + Deprecate transform iterators (#1678) -commit 4b91f445eb7bb1bc588d64e0a4dd74f7e1430a13 +commit bfdb5e374a48d9103279905a6f1a82b11436ef14 Author: Luigi Ballabio -Date: Fri, 28 Oct 2022 11:38:16 +0200 +Date: Thu, 25 May 2023 13:16:32 +0200 - Move documentation to the correct class + Add compilation messages for deprecated features - ql/pricingengines/vanilla/qdfpamericanengine.hpp | 65 ++++++++++------------ - ql/pricingengines/vanilla/qdplusamericanengine.hpp | 26 +++++---- - 2 files changed, 43 insertions(+), 48 deletions(-) + ql/models/volatility/garch.hpp | 9 +++--- + ql/timeseries.hpp | 62 +++++++++++++++++++----------------------- + 2 files changed, 33 insertions(+), 38 deletions(-) -commit f2e107bad529bb5b9facc581a3b250644e603fd5 -Author: Luigi Ballabio -Date: Fri, 28 Oct 2022 11:20:47 +0200 +commit 55c1f66069ac15441427ac7e2bd4b124a8a2384c +Author: Jonathan Sweemer +Date: Sat, 20 May 2023 21:20:03 +0900 - Clear executable bit + Deprecate transform iterators - ql/math/integrals/gaussianquadratures.hpp | 0 - 1 file changed, 0 insertions(+), 0 deletions(-) + ql/models/volatility/garch.hpp | 23 +++++++++++++--- + ql/timeseries.hpp | 61 ++++++++++++++++++++++++++++++++++++++++++ + test-suite/timeseries.cpp | 4 +++ + 3 files changed, 85 insertions(+), 3 deletions(-) -commit df42c2adbc6b9f964edd67e7d43e9544d0c6a73d -Merge: 4c5833ae8 38da65f84 +commit df5339ea4ec885a67f8554eb07ccc94831b6403d +Merge: 1858a7504 085dcae21 Author: Luigi Ballabio -Date: Thu, 27 Oct 2022 19:41:53 +0200 +Date: Wed, 24 May 2023 11:22:41 +0200 - Use fixing date correctly in inflation caplet (#1502) + Fix Finland, Singapore calendars and broken link (#1680) -commit 26e4678d9e3645e931ebcfe24e389806fbba8813 -Author: Luigi Ballabio -Date: Thu, 27 Oct 2022 18:06:26 +0200 +commit 085dcae21b761cc03247ee02eff557d8d783432d +Author: Fredrik Gerdin Börjesson +Date: Tue, 23 May 2023 22:05:31 +0200 - Relax condition on observation lag + Fix broken link for US Federal Reserve holidays - ql/instruments/zerocouponinflationswap.cpp | 2 +- + ql/time/calendars/unitedstates.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) -commit 84e451dc985d203dfa9d1eef48a18803d554828c -Author: Luigi Ballabio -Date: Thu, 27 Oct 2022 15:41:57 +0200 +commit aeaf0e9a640b64cd95aa6a8fcf2e72b900c45f75 +Author: Fredrik Gerdin Börjesson +Date: Tue, 23 May 2023 22:01:31 +0200 - Check and retrieve inflation fixings on first day of period + Fix 2019 Chinese New Year in Singapore calendar - ql/indexes/inflationindex.cpp | 52 ++++++++++++++++++------------------------- - 1 file changed, 22 insertions(+), 30 deletions(-) + ql/time/calendars/singapore.cpp | 2 +- + ql/time/calendars/singapore.hpp | 2 +- + 2 files changed, 2 insertions(+), 2 deletions(-) -commit 4c5833ae8f2ad3c4c675e1883071940ebfb2a6a0 -Author: Luigi Ballabio -Date: Thu, 27 Oct 2022 15:08:17 +0200 +commit fdc09f4af8d453d5d9a02380b71f2a8cc3a64c18 +Author: Fredrik Gerdin Börjesson +Date: Tue, 23 May 2023 21:58:58 +0200 - Run coverage only on PRs and on pushes to master + Correct Midsummer's Eve in Finland calendar - .github/workflows/coveralls.yml | 6 +++++- - 1 file changed, 5 insertions(+), 1 deletion(-) + ql/time/calendars/finland.cpp | 4 ++-- + ql/time/calendars/finland.hpp | 2 +- + 2 files changed, 3 insertions(+), 3 deletions(-) -commit 38da65f849f3589fdd3107a1e6337b5384e60f5b +commit 1858a75048bdffdd1755b29d403408093a88c3df +Merge: d6896cbe9 d17122e65 Author: Luigi Ballabio -Date: Thu, 27 Oct 2022 13:17:23 +0200 +Date: Tue, 23 May 2023 16:19:19 +0200 - Use fixing date correctly in inflation caplet + Configure quantlib-config from CMake (#1679) - ql/cashflows/inflationcouponpricer.cpp | 11 ++++++----- - 1 file changed, 6 insertions(+), 5 deletions(-) +commit d17122e656cfbf0f257d20d36fe6cd5f12eb9b93 +Author: Christian Köhnenkamp +Date: Mon, 22 May 2023 22:29:45 +0200 -commit d9e55201c974602303318ccfa79fbdec5c57cfe7 -Merge: b942a80d4 e06ae2203 -Author: Luigi Ballabio -Date: Thu, 27 Oct 2022 00:12:05 +0200 + Cleanup - simplify singleton implementation (#1377) + CMakeLists.txt | 6 ------ + 1 file changed, 6 deletions(-) -commit e06ae2203235f3d0c0b0c6c2bc28381f74649c38 -Author: Luigi Ballabio -Date: Wed, 26 Oct 2022 18:39:02 +0200 +commit 85372bc6e523335eda9cb7de81f1c832ad3ccb59 +Author: Christian Köhnenkamp +Date: Mon, 22 May 2023 21:49:20 +0200 - Update documentation + Remove file variables - Docs/pages/config.docs | 8 -------- - 1 file changed, 8 deletions(-) + CMakeLists.txt | 4 +--- + 1 file changed, 1 insertion(+), 3 deletions(-) -commit 88cf055ab690bec196f18d91c894ce1ae25e2866 -Author: Luigi Ballabio -Date: Wed, 26 Oct 2022 18:37:45 +0200 +commit 3f319559ddb54af50d66cfa0c93893fd88a1db42 +Author: Christian Köhnenkamp +Date: Mon, 22 May 2023 20:51:46 +0200 - Remove reference to obsolete cmake option + Configure quantlib-config from CMake - CMakeLists.txt | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) + CMakeLists.txt | 17 +++++++++++++++++ + 1 file changed, 17 insertions(+) -commit 64fe40ef2b901f17428eeb9052527bb7988fb9bb +commit d6896cbe9d4f6c2576d092eafc947283e5402eba Author: Luigi Ballabio -Date: Wed, 26 Oct 2022 18:30:21 +0200 +Date: Mon, 22 May 2023 16:53:53 +0200 - Update CI matrix + Upgrade Doxyfile - .github/workflows/linux-full-tests.yml | 9 --------- - .github/workflows/linux-nondefault.yml | 2 +- - .github/workflows/linux.yml | 10 ---------- - 3 files changed, 1 insertion(+), 20 deletions(-) + Docs/quantlib.doxy | 15 +++++++++------ + 1 file changed, 9 insertions(+), 6 deletions(-) -commit 40af9c13b8317e6de7129a01751cbfd4f6cf833b +commit 08f4ac5e71c31e7e921a05eeb0bd51305783d477 +Merge: 7cc543e95 b77fb5657 Author: Luigi Ballabio -Date: Wed, 26 Oct 2022 18:26:55 +0200 - - Restore unused typedef for compatibility +Date: Mon, 22 May 2023 12:56:08 +0200 - ql/patterns/singleton.hpp | 20 +++++++++++++++++++- - 1 file changed, 19 insertions(+), 1 deletion(-) + Add correct accrual calculation for CPI coupons (#1674) -commit 95ad0028b7dc262a7b3886a3e33a3c85bfc99a27 -Author: Luigi Ballabio -Date: Wed, 26 Oct 2022 16:57:23 +0200 +commit 7cc543e9548d90ab6e7a8775264c69a2cde65cc3 +Author: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> +Date: Sun, 21 May 2023 02:56:58 +0000 - Add missing include + Automated fixes by clang-tidy - ql/patterns/singleton.hpp | 1 + - 1 file changed, 1 insertion(+) + test-suite/cms_normal.cpp | 16 +++++++--------- + 1 file changed, 7 insertions(+), 9 deletions(-) -commit 90fe9d2b6aa3b948a1d9db647c33c71233e9c153 +commit ebbb3756fee28bd314bc5ef9f6d2b72f17586934 +Merge: 518233127 b2fa56abb Author: Luigi Ballabio -Date: Wed, 26 Oct 2022 16:50:22 +0200 +Date: Mon, 22 May 2023 10:12:26 +0200 - Cleanup comments and included headers + Replace boost::reverse_iterator with std::reverse_iterator (#1676) - ql/patterns/singleton.hpp | 24 +++++++++++++++--------- - 1 file changed, 15 insertions(+), 9 deletions(-) +commit b2fa56abbc03601d16034dc529ab718b5eb3c201 +Author: Jonathan Sweemer +Date: Wed, 5 Apr 2023 21:48:55 +0900 -commit b942a80d4401513414e4942cc11226d2efb4f44d -Merge: a9fa1efc0 5a8b7f8de -Author: Luigi Ballabio -Date: Tue, 25 Oct 2022 20:04:39 +0200 + Replace boost::reverse_iterator with std::reverse_iterator - Remove features deprecated in version 1.24 (#1501) + ql/math/array.hpp | 6 +++--- + ql/math/matrix.hpp | 13 +++++++------ + ql/timeseries.hpp | 4 ++-- + 3 files changed, 12 insertions(+), 11 deletions(-) -commit a9fa1efc04b052d6f1b82f7ef315addf5e3883d1 -Merge: ff8e034bc 1f8729cd1 +commit b77fb5657c201b020b946ad72b62bd189c101892 Author: Luigi Ballabio -Date: Tue, 25 Oct 2022 19:06:31 +0200 +Date: Fri, 19 May 2023 11:57:41 +0200 - init member in ExchangeRate default constructor (#1497) + Deprecate use of spread in CPI coupons -commit 5a8b7f8de52103b6844dba34d51436ac5412469d + ql/cashflows/cpicoupon.cpp | 113 ++++++++++++++++++++++++--------------- + ql/cashflows/cpicoupon.hpp | 102 +++++++++++++++++++++++++++++++---- + ql/cashflows/cpicouponpricer.cpp | 11 ++++ + ql/cashflows/cpicouponpricer.hpp | 13 +++++ + 4 files changed, 184 insertions(+), 55 deletions(-) + +commit 41803387fb388873f84e28d27d20e7f13b8eccff Author: Luigi Ballabio -Date: Tue, 25 Oct 2022 16:55:45 +0200 +Date: Thu, 18 May 2023 17:48:04 +0200 - Avoid warning in gcc + Add correct accrual calculation for CPI coupons - ql/cashflows/inflationcouponpricer.hpp | 1 + - 1 file changed, 1 insertion(+) + ql/cashflows/cpicoupon.cpp | 11 +++++++++++ + ql/cashflows/cpicoupon.hpp | 21 +++++++++++++-------- + ql/cashflows/cpicouponpricer.cpp | 11 +++++++---- + ql/cashflows/cpicouponpricer.hpp | 1 + + test-suite/inflationcpibond.cpp | 22 +++++++++++++++++----- + 5 files changed, 49 insertions(+), 17 deletions(-) -commit 3ab1272f0ea3fc7056e2fdc8227121ab0a31dbdb +commit 57b1f0f4e4a5bf9dc3af9bbf68ce2e8a20098aea Author: Luigi Ballabio -Date: Tue, 25 Oct 2022 15:12:18 +0200 +Date: Thu, 18 May 2023 13:05:17 +0200 - Deprecate now unused data member + Add indexRatio to CPI coupon interface - ql/cashflows/cpicouponpricer.cpp | 8 +++----- - ql/cashflows/inflationcouponpricer.cpp | 8 +++----- - ql/cashflows/inflationcouponpricer.hpp | 10 ++++++++-- - 3 files changed, 14 insertions(+), 12 deletions(-) + ql/cashflows/cpicoupon.cpp | 18 ++++++++++++++++++ + ql/cashflows/cpicoupon.hpp | 4 ++++ + ql/cashflows/cpicouponpricer.cpp | 12 +----------- + 3 files changed, 23 insertions(+), 11 deletions(-) -commit 1b460a318b473569186296194d5ac89eba661f94 +commit 9aaf62e5d5de42d112ea8b0fc3ef64be2d3d21b1 Author: Luigi Ballabio -Date: Tue, 25 Oct 2022 13:36:13 +0200 +Date: Thu, 18 May 2023 12:21:43 +0200 - Remove deprecated static methods from IborCoupon + Return early when fixing is provided - ql/cashflows/iborcoupon.cpp | 12 ------------ - ql/cashflows/iborcoupon.hpp | 12 ------------ - 2 files changed, 24 deletions(-) + ql/cashflows/cpicouponpricer.cpp | 8 ++++---- + ql/cashflows/cpicouponpricer.hpp | 2 +- + 2 files changed, 5 insertions(+), 5 deletions(-) -commit 0e34afb68a71352c26520831aed39bdba70365ca +commit 518233127eae8cb25ac826e94baf1f5d4e4e62e6 Author: Luigi Ballabio -Date: Tue, 25 Oct 2022 13:28:08 +0200 +Date: Tue, 16 May 2023 17:38:11 +0200 - Remove deprecated nominalTermStructure method from inflation curves + Reclassify or speed up a few tests - ql/cashflows/cpicouponpricer.cpp | 9 +------- - ql/cashflows/inflationcouponpricer.cpp | 9 +------- - ql/instruments/makeyoyinflationcapfloor.cpp | 15 ++----------- - .../inflation/inflationcapfloorengines.cpp | 14 +++--------- - ql/termstructures/inflation/inflationhelpers.cpp | 15 +++---------- - ql/termstructures/inflationtermstructure.hpp | 25 ---------------------- - 6 files changed, 10 insertions(+), 77 deletions(-) + test-suite/distributions.cpp | 31 ++++++++++++++----------------- + test-suite/dividendoption.cpp | 11 ++++++----- + test-suite/dividendoption.hpp | 3 ++- + test-suite/hestonmodel.cpp | 2 +- + test-suite/quantlibtestsuite.cpp | 2 +- + 5 files changed, 24 insertions(+), 25 deletions(-) -commit 0fa7abaffe2bc8fd613e222bc93a44cf8d48c249 -Author: Luigi Ballabio -Date: Tue, 25 Oct 2022 12:58:34 +0200 +commit b84034c18d12c5079a5f34463aa39479f8ee2077 +Author: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> +Date: Mon, 15 May 2023 15:00:33 +0000 - Remove deprecated static data members from Money class + Update copyright list in license - ql/money.cpp | 4 ---- - ql/money.hpp | 10 ---------- - 2 files changed, 14 deletions(-) + LICENSE.TXT | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) -commit c5f1d929f3bedff3b7cd3b69161d12a91a5813a0 +commit 7897a76f1d5d85ef5422c65e957e05519698f891 +Merge: b73fa230a 8effd5982 Author: Luigi Ballabio -Date: Tue, 25 Oct 2022 12:54:32 +0200 +Date: Mon, 15 May 2023 16:59:58 +0200 - Remove UnitedStates constructor without an explicit market + Enable normal volatilities in Hagan pricer for CMS coupons (#1660) - ql/time/calendars/unitedstates.hpp | 7 ------- - 1 file changed, 7 deletions(-) - -commit d697b5048d08051d159ed44deb9e6e398f866833 +commit 8effd5982d5c98f9a3cfa6d1e34051f81411c45a Author: Luigi Ballabio -Date: Tue, 25 Oct 2022 12:49:15 +0200 +Date: Mon, 15 May 2023 15:27:53 +0200 - Remove deprecated data member + Keep old name around for backward compatibility - ql/models/calibrationhelper.hpp | 8 -------- - 1 file changed, 8 deletions(-) + ql/cashflows/conundrumpricer.hpp | 6 ++++++ + 1 file changed, 6 insertions(+) -commit e516865dfcbfd5dc2a0fec0c3e7f99c334571352 +commit 59506084e896bf5ad9e51c095803b5298a7cc7fe Author: Luigi Ballabio -Date: Tue, 25 Oct 2022 12:33:33 +0200 +Date: Mon, 15 May 2023 10:48:57 +0200 - Remove deprecated CrossCurrencyBasisSwapRateHelper typedef + Add new tests to build and test suite - ql/experimental/termstructures/crosscurrencyratehelpers.hpp | 7 ------- - 1 file changed, 7 deletions(-) + test-suite/CMakeLists.txt | 2 ++ + test-suite/Makefile.am | 2 ++ + test-suite/cms.cpp | 6 +++--- + test-suite/cms_normal.cpp | 6 +++--- + test-suite/cms_normal.hpp | 3 +-- + test-suite/quantlibtestsuite.cpp | 2 ++ + test-suite/testsuite.vcxproj | 4 +++- + test-suite/testsuite.vcxproj.filters | 8 +++++++- + 8 files changed, 23 insertions(+), 10 deletions(-) -commit 43380185a646ca917525cc169e698fb98d8a9b3b +commit af6e858e336ed3d710c55a28381fb386ea9ea663 Author: Luigi Ballabio -Date: Tue, 25 Oct 2022 12:29:49 +0200 +Date: Mon, 15 May 2023 10:46:29 +0200 - Remove deprecated RiskyBond classes + Fix initialization order of data members - QuantLib.vcxproj | 1 - - QuantLib.vcxproj.filters | 11 +- - ql/CMakeLists.txt | 1 - - ql/experimental/credit/Makefile.am | 3 +- - ql/experimental/credit/all.hpp | 1 - - ql/experimental/credit/riskybond.cpp | 300 ----------------------------------- - ql/experimental/credit/riskybond.hpp | 203 +----------------------- - 7 files changed, 9 insertions(+), 511 deletions(-) + ql/cashflows/conundrumpricer.cpp | 226 +++++++++++++++++++-------------------- + 1 file changed, 109 insertions(+), 117 deletions(-) -commit ff8e034bcb474859a7c9d23a6210befa4eb78214 +commit b73fa230a1e92b7db98dd473ec9639680c82c727 +Merge: fd9877013 13b7bac2d Author: Luigi Ballabio -Date: Thu, 15 Apr 2021 16:25:45 +0200 +Date: Mon, 15 May 2023 10:05:53 +0200 - Set version to 1.29-dev. + Add underlying index to YoY inflation index if calculated as ratio, use it for fixing (#1668) - CMakeLists.txt | 6 +++--- - configure.ac | 2 +- - ql/version.hpp | 4 ++-- - 3 files changed, 6 insertions(+), 6 deletions(-) +commit fd9877013a32847b51edcdc17a4244ca207b87e9 +Merge: 6c73e177b 86eaca8b2 +Author: Luigi Ballabio +Date: Mon, 15 May 2023 10:02:24 +0200 -commit 1619ff4d9a2fefbd59316a660ee28cde4924f1f9 -Author: Matthias Groncki -Date: Wed, 19 Oct 2022 08:41:08 +0700 + Use type traits from standard library (#1671) - Add indexFixing method to indexed cashflows +commit 6c73e177ba14b3b693828de41ab3b48703e2b974 +Merge: 6d95ba7ab 7033f9bc9 +Author: Luigi Ballabio +Date: Mon, 15 May 2023 10:01:42 +0200 - ql/cashflows/cpicoupon.cpp | 9 +++++++++ - ql/cashflows/cpicoupon.hpp | 2 ++ - ql/cashflows/indexedcashflow.hpp | 2 ++ - 3 files changed, 13 insertions(+) + Remove boost null_deleter (#1672) -commit 5f461d5eddafae57587734157c0f79fc021cc829 -Author: klausspanderen -Date: Tue, 18 Oct 2022 21:36:36 +0200 +commit 91608c7b524cf8bd488617181c7868b85f8c14f6 +Author: amiemiec <133022689+amiemiec@users.noreply.github.com> +Date: Sun, 14 May 2023 13:29:38 +0200 - make the error message for the double-boundary case more explicit + New test cases for cms with normal model + + Based on cms. LinearTsr currently not included due to effort. Do not expect any additional problem, when this is included into the new test file. - ql/pricingengines/vanilla/qdfpamericanengine.cpp | 3 +++ - ql/pricingengines/vanilla/qdplusamericanengine.cpp | 4 ++-- - 2 files changed, 5 insertions(+), 2 deletions(-) + test-suite/cms_normal.cpp | 515 ++++++++++++++++++++++++++++++++++++++++++++++ + test-suite/cms_normal.hpp | 37 ++++ + 2 files changed, 552 insertions(+) -commit 1f8729cd12d61e65564d8cfafc605e59d471013b -Author: Peter Caspers -Date: Sun, 16 Oct 2022 14:38:18 +0200 +commit 3f2dec5783b6ee7aecd2a81d541d0400858bae6d +Author: amiemiec <133022689+amiemiec@users.noreply.github.com> +Date: Sun, 14 May 2023 13:21:10 +0200 - init member in default constructor + Added further functionality for the normal model + + Amended : + - Analytical Pricer + - capletPrice, floorletPrice + - GaussKronrod integration + - method to set the lower integration limit - ql/exchangerate.hpp | 3 +-- - 1 file changed, 1 insertion(+), 2 deletions(-) + ql/cashflows/conundrumpricer.cpp | 189 +++++++++++++++++++++++++++------------ + 1 file changed, 130 insertions(+), 59 deletions(-) -commit 395252e447c621649a02812b181ab9ac9c91589b -Author: klausspanderen -Date: Tue, 11 Oct 2022 20:46:38 +0200 +commit 8881d64891a8537a77555b4d3f1f270738b4cd5f +Author: amiemiec <133022689+amiemiec@users.noreply.github.com> +Date: Sun, 14 May 2023 12:52:24 +0200 - performance tuning + Added member variables and methods for lower limits. - ql/math/interpolations/lagrangeinterpolation.hpp | 16 +++++++---- - test-suite/interpolations.cpp | 36 ++++++++++++++++++------ - 2 files changed, 38 insertions(+), 14 deletions(-) + ql/cashflows/conundrumpricer.hpp | 6 ++++-- + 1 file changed, 4 insertions(+), 2 deletions(-) -commit 0c47b06b9ef7304f4bb1c556965e821c774ab4a7 -Author: klausspanderen -Date: Sun, 9 Oct 2022 21:20:11 +0200 +commit 7033f9bc95f30bb6b9d23de7ae279dcddcec4558 +Author: Jonathan Sweemer +Date: Sat, 13 May 2023 01:01:21 +0000 - better iteration start value for QD+ approximation + Remove boost null_deleter - ql/pricingengines/vanilla/qdfpamericanengine.cpp | 4 ++-- - ql/pricingengines/vanilla/qdplusamericanengine.cpp | 2 +- - 2 files changed, 3 insertions(+), 3 deletions(-) + ql/utilities/null_deleter.hpp | 15 +-------------- + 1 file changed, 1 insertion(+), 14 deletions(-) -commit c1a9ad829b4fb195b3cac5cb3a00bbaa1c428c11 -Author: klausspanderen -Date: Sun, 9 Oct 2022 17:01:16 +0200 +commit 86eaca8b28848e99d1a204aecaa66fb51a314f0c +Author: Jonathan Sweemer +Date: Fri, 12 May 2023 21:33:36 +0900 - fixed one argument constructor + Use type traits from standard library - ql/math/interpolations/chebyshevinterpolation.hpp | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) + ql/experimental/asian/analytic_cont_geom_av_price_heston.hpp | 1 + + ql/experimental/asian/analytic_discr_geom_av_price_heston.hpp | 1 + + .../forward/analytichestonforwardeuropeanengine.cpp | 1 + + ql/experimental/variancegamma/fftvanillaengine.hpp | 1 + + ql/experimental/variancegamma/fftvariancegammaengine.cpp | 1 - + ql/experimental/variancegamma/fftvariancegammaengine.hpp | 1 + + ql/math/array.hpp | 10 +++++----- + ql/math/generallinearleastsquares.hpp | 1 - + ql/math/linearleastsquaresregression.hpp | 3 ++- + ql/math/ode/adaptiverungekutta.hpp | 1 + + ql/pricingengines/barrier/binomialbarrierengine.hpp | 3 ++- + 11 files changed, 15 insertions(+), 9 deletions(-) -commit cb61a1635c472c11fd4df321bafa430a7371b1c1 -Author: klausspanderen -Date: Sun, 9 Oct 2022 05:35:42 +0200 +commit be0882d641be0b42674502c97b75450be9db03f9 +Author: Luigi Ballabio +Date: Fri, 12 May 2023 18:39:11 +0200 - clean-up + Avoid dereferencing error - QuantLib.vcxproj.filters | 8 ++++---- - ql/math/integrals/gaussianquadratures.hpp | 2 +- - ql/math/interpolations/chebyshevinterpolation.hpp | 2 +- - ql/pricingengines/vanilla/qdfpamericanengine.cpp | 10 +--------- - ql/pricingengines/vanilla/qdfpamericanengine.hpp | 6 +++--- - test-suite/americanoption.cpp | 9 +-------- - 6 files changed, 11 insertions(+), 26 deletions(-) - -commit dc32deac83900dde6f91449837710a77f9e02a22 -Author: klausspanderen -Date: Tue, 13 Sep 2022 21:25:05 +0200 - - - + ql/cashflows/conundrumpricer.cpp | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) - ql/pricingengines/vanilla/qdplusamericanengine.cpp | 1 - - 1 file changed, 1 deletion(-) +commit e41a3bfd0c01c087d4194109edde3e31b0b6a15e +Author: Luigi Ballabio +Date: Fri, 12 May 2023 18:36:24 +0200 -commit e0b30beb6340d41b641de789017ed3b9279432bb -Author: klausspanderen -Date: Tue, 13 Sep 2022 21:17:05 +0200 + Restore line endings - fixed single header build + .../swaptions/haganirregularswaptionengine.cpp | 745 ++++++++++----------- + 1 file changed, 362 insertions(+), 383 deletions(-) - ql/pricingengines/vanilla/qdplusamericanengine.hpp | 1 + - 1 file changed, 1 insertion(+) +commit 6d95ba7ab69ccf093532a8d7cf6f3c4c56263f65 +Merge: d87947e78 9d1f3e85e +Author: Luigi Ballabio +Date: Fri, 12 May 2023 11:25:35 +0200 -commit bc9a08dbe7320c9f6736a57e2de82bc6389264f1 -Merge: 77edcb071 aa3315b30 -Author: Klaus Spanderen -Date: Tue, 13 Sep 2022 20:12:40 +0200 + Add ThreadSanitizer to CI (#1667) - Merge pull request #45 from klausspanderen/update-generated-headers-refs/heads/early_exercise_boundary - - Update generated headers +commit 13b7bac2d71366a1292131222557baf26d3a1fa8 +Author: Luigi Ballabio +Date: Thu, 11 May 2023 19:19:34 +0200 -commit aa3315b30f34cdfac366839697f48989aa44b37f -Author: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> -Date: Sun, 11 Sep 2022 20:20:24 +0000 + Deprecate old generic YoY index constructor - Update generated headers + ql/experimental/inflation/genericindexes.hpp | 13 +++++++++---- + ql/indexes/inflation/aucpi.hpp | 14 ++++++++++---- + ql/indexes/inflation/euhicp.hpp | 16 ++++++++++------ + ql/indexes/inflation/frhicp.hpp | 13 +++++++++---- + ql/indexes/inflation/ukrpi.hpp | 13 +++++++++---- + ql/indexes/inflation/uscpi.hpp | 13 +++++++++---- + ql/indexes/inflation/zacpi.hpp | 13 +++++++++---- + ql/indexes/inflationindex.cpp | 4 ++++ + ql/indexes/inflationindex.hpp | 4 ++++ + test-suite/inflation.cpp | 21 +++++++++++++++++++-- + test-suite/inflationcapfloor.cpp | 11 ++++++----- + test-suite/inflationcapflooredcoupon.cpp | 11 ++++++----- + test-suite/inflationvolatility.cpp | 4 ++-- + 13 files changed, 106 insertions(+), 44 deletions(-) - ql/math/interpolations/all.hpp | 2 +- - ql/pricingengines/vanilla/all.hpp | 3 ++- - 2 files changed, 3 insertions(+), 2 deletions(-) +commit b13708bf34d4b76005765a530c38413565656100 +Author: Luigi Ballabio +Date: Thu, 11 May 2023 15:42:51 +0200 -commit 77edcb07159e109b24007a7c8b39fb82598a7e7a -Author: klausspanderen -Date: Sun, 11 Sep 2022 22:17:33 +0200 + Add specific constructors for ratio and non-ratio YoY indices - visual studio build + ql/indexes/inflationindex.cpp | 34 ++++++++- + ql/indexes/inflationindex.hpp | 55 +++++++++++--- + test-suite/inflation.cpp | 169 +++++++++++++++++++++++++++++++++++++----- + test-suite/inflation.hpp | 4 +- + 4 files changed, 228 insertions(+), 34 deletions(-) - QuantLib.vcxproj | 7 +++ - QuantLib.vcxproj.filters | 21 +++++++ - ql/math/integrals/gaussianquadratures.hpp | 2 +- - ql/math/interpolations/chebyshevinterpolation.cpp | 2 - - ql/pricingengines/vanilla/qdfpamericanengine.cpp | 12 ++-- - test-suite/americanoption.cpp | 73 +++++++++++------------ - test-suite/americanoption.hpp | 1 + - 7 files changed, 72 insertions(+), 46 deletions(-) +commit d87947e782d52bb02e37f206c95b2a7d7b98b273 +Merge: 1a34fc840 c36935a0a +Author: Luigi Ballabio +Date: Thu, 11 May 2023 14:16:02 +0200 -commit aa3d876a59018189fcbf06f5cc8572254be4190d -Author: klausspanderen -Date: Sun, 4 Sep 2022 19:54:57 +0200 + Corrections to HKEx, NSE, KRX, and South Africa calendars (#1665) - fixed this capture +commit 9d1f3e85e6739c8b944a14974ad95f4c265596bb +Author: Jonathan Sweemer +Date: Sun, 7 Aug 2022 13:15:42 +0900 - ql/pricingengines/vanilla/qdfpamericanengine.cpp | 10 +++++----- - 1 file changed, 5 insertions(+), 5 deletions(-) + Add ThreadSanitizer to CI -commit f2cdb59c71892ad1ec19fbe7a98b5339670b99fe -Author: klausspanderen -Date: Sun, 4 Sep 2022 00:51:18 +0200 + .github/workflows/sanitizer.yml | 21 ++++++++++++++++++++- + 1 file changed, 20 insertions(+), 1 deletion(-) - remove unused variables +commit 39d1be9e76cc131d189e3c910e5f88a754fa292a +Author: amiemiec <133022689+amiemiec@users.noreply.github.com> +Date: Thu, 11 May 2023 11:55:38 +0200 - ql/pricingengines/vanilla/qdfpamericanengine.cpp | 26 ++++++++++-------------- - 1 file changed, 11 insertions(+), 15 deletions(-) + Enable normal volatilities in Hagan pricer for CMS coupons + + Added the fallback to the forwardingTS if the discountingTS is a null pointer -commit c9b4b10c7fe083f31f4e2a9433b62ef90769c322 -Author: klausspanderen -Date: Sat, 3 Sep 2022 23:27:32 +0200 + ql/cashflows/conundrumpricer.cpp | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) - . +commit a3ecca1061c2f3d039b49bf802be00b0120bfeed +Author: amiemiec <133022689+amiemiec@users.noreply.github.com> +Date: Wed, 10 May 2023 15:51:24 +0200 - ql/math/integrals/gaussianquadratures.hpp | 4 + - ql/math/interpolations/chebyshevinterpolation.cpp | 6 +- - ql/pricingengines/vanilla/qdfpamericanengine.cpp | 324 ++++++--------------- - ql/pricingengines/vanilla/qdplusamericanengine.cpp | 5 +- - test-suite/americanoption.cpp | 28 +- - 5 files changed, 117 insertions(+), 250 deletions(-) + Add files via upload -commit c5ed738866b06ebadef934dc5044310f49e54d17 -Author: klausspanderen -Date: Thu, 1 Sep 2022 21:31:37 +0200 + .../swaptions/haganirregularswaptionengine.cpp | 764 +++++++++++---------- + 1 file changed, 383 insertions(+), 381 deletions(-) - use equation interface +commit c4e64f53346d92ac5f86a2a3f54b1b7a0a5c0bb0 +Author: Luigi Ballabio +Date: Wed, 10 May 2023 12:59:59 +0200 - ql/pricingengines/vanilla/qdfpamericanengine.cpp | 488 +++++++++++++---------- - ql/pricingengines/vanilla/qdfpamericanengine.hpp | 9 - - 2 files changed, 277 insertions(+), 220 deletions(-) + Add underlying index to YoY inflation index, use for fixing if ratio -commit 92e39662e47b6b56b5772c279580d5cc23165a1b -Author: klausspanderen -Date: Mon, 29 Aug 2022 22:06:06 +0200 + ql/indexes/inflationindex.cpp | 52 ++++++------------------------------------- + ql/indexes/inflationindex.hpp | 6 +++++ + 2 files changed, 13 insertions(+), 45 deletions(-) - first light from fixed point equation interface +commit 1a34fc840fc663a26a33092096302dcb21a6e27b +Merge: 9e04d57b9 06c77e1c9 +Author: Luigi Ballabio +Date: Wed, 10 May 2023 11:59:50 +0200 - ql/math/interpolations/chebyshevinterpolation.cpp | 8 +- - ql/math/interpolations/chebyshevinterpolation.hpp | 6 +- - ql/pricingengines/vanilla/qdfpamericanengine.cpp | 287 ++++++++++++++-------- - ql/pricingengines/vanilla/qdfpamericanengine.hpp | 9 +- - test-suite/americanoption.cpp | 19 +- - test-suite/interpolations.cpp | 36 ++- - test-suite/interpolations.hpp | 2 + - 7 files changed, 238 insertions(+), 129 deletions(-) + Replace boost::math::erf with std::erf (#1663) -commit d718a86d706ba58ad0235dccde620fb520f051ef -Author: klausspanderen -Date: Sun, 21 Aug 2022 11:32:28 +0200 +commit 9e04d57b9f11d695ef7132b4ee6e36cd13dca2fd +Author: Jonathan Sweemer +Date: Tue, 9 May 2023 20:50:57 +0900 - fixed unused this capture + Add compile options for AppleClang too - ql/pricingengines/vanilla/qdfpamericanengine.cpp | 11 +++++------ - 1 file changed, 5 insertions(+), 6 deletions(-) + CMakeLists.txt | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) -commit 9c84b7ded1a5cea54d88918fb0e4daea07280628 -Author: klausspanderen -Date: Sun, 21 Aug 2022 04:06:15 +0200 +commit c36935a0a6f8a3b1ce4b39b67d2865da57d42370 +Author: Fredrik Gerdin Börjesson +Date: Wed, 10 May 2023 09:51:19 +0200 - implemented FP-B + Add Indian holidays for 2021-2025 - ql/pricingengines/vanilla/qdfpamericanengine.cpp | 222 +++++++++++++++-- - ql/pricingengines/vanilla/qdfpamericanengine.hpp | 18 +- - test-suite/americanoption.cpp | 298 +++++++++++++++++++---- - test-suite/americanoption.hpp | 6 +- - 4 files changed, 470 insertions(+), 74 deletions(-) + ql/time/calendars/india.cpp | 130 +++++++++++++++++++++++++++++++++++++++++++- + ql/time/calendars/india.hpp | 4 +- + 2 files changed, 132 insertions(+), 2 deletions(-) -commit aaebf31edc02c6c9ed6b10070e68c9fea384e7cb -Author: klausspanderen -Date: Sat, 20 Aug 2022 13:55:51 +0200 +commit fd6a4afbcca48ca49073e33890eaf6dddfe5bc8f +Author: Fredrik Gerdin Börjesson +Date: Wed, 10 May 2023 09:50:25 +0200 - small performance improvements + Fix incorrect 2023 holidays for HKEx calendar + + These are copy-paste errors of the 2022 holidays, verified against the linked pdfs. - ql/pricingengines/vanilla/qdfpamericanengine.cpp | 92 ++++++++++++++++++---- - ql/pricingengines/vanilla/qdfpamericanengine.hpp | 50 +++++++++++- - ql/pricingengines/vanilla/qdplusamericanengine.cpp | 3 + - 3 files changed, 126 insertions(+), 19 deletions(-) + ql/time/calendars/hongkong.cpp | 4 +--- + 1 file changed, 1 insertion(+), 3 deletions(-) -commit a7e4328574dd6d986ecd5201a4e163d9c00e003a -Author: klausspanderen -Date: Wed, 17 Aug 2022 23:18:27 +0200 +commit 3b774ca155f2080c074e219b311e20c005464833 +Author: Fredrik Gerdin Börjesson +Date: Tue, 9 May 2023 18:11:06 +0200 - fixed c++20 compilation + Add missing election to South Africa calendar - ql/pricingengines/vanilla/qdfpamericanengine.cpp | 6 +++--- - 1 file changed, 3 insertions(+), 3 deletions(-) + ql/time/calendars/southafrica.cpp | 3 +++ + 1 file changed, 3 insertions(+) -commit 8cbd6cc60e7500d6c0943482ba8a3d52d4cca3d3 -Author: klausspanderen -Date: Wed, 17 Aug 2022 00:58:02 +0200 +commit 0d37497735896b95604ed1abb1774342d763660d +Merge: 346d720c8 c8c719114 +Author: Luigi Ballabio +Date: Tue, 9 May 2023 22:46:28 +0200 - fixed compilation + Rework check on test times (#1661) - ql/pricingengines/vanilla/qdfpamericanengine.hpp | 2 ++ - test-suite/americanoption.cpp | 2 +- - 2 files changed, 3 insertions(+), 1 deletion(-) +commit 4a5a61c5f724f6c49e8c61ea6dc113fe5cd3e33d +Author: amiemiec <133022689+amiemiec@users.noreply.github.com> +Date: Tue, 9 May 2023 18:38:50 +0200 -commit 9a6f668b32040b5e5791093a74ab5d43edd75e68 -Author: klausspanderen -Date: Tue, 16 Aug 2022 23:50:27 +0200 + Add files via upload + + Extended functionality, such that cms pricing can cope with the normal model as well. Renamed the class BlackVanillaOptionPricer into MarketQuotedOptionPricer and changed the method NumericHaganPricer::resetUpperLimit accordingly. + In line 97 the YTM struchture used for discounting was changed from the forwardingTermStructure to the discountingTermStructure. - fixed point engine, only fp-a scheme + ql/cashflows/conundrumpricer.cpp | 45 +++++++++++++++++++++++++--------------- + ql/cashflows/conundrumpricer.hpp | 6 ++++-- + 2 files changed, 32 insertions(+), 19 deletions(-) - ql/math/interpolations/chebyshevinterpolation.cpp | 5 + - ql/math/interpolations/chebyshevinterpolation.hpp | 1 + - ql/pricingengines/vanilla/qdfpamericanengine.cpp | 258 +++++++++++++++++++- - ql/pricingengines/vanilla/qdfpamericanengine.hpp | 68 ++++-- - ql/pricingengines/vanilla/qdplusamericanengine.cpp | 262 +++++++++++---------- - ql/pricingengines/vanilla/qdplusamericanengine.hpp | 69 ++++-- - test-suite/americanoption.cpp | 59 +++-- - test-suite/americanoption.hpp | 1 + - 8 files changed, 540 insertions(+), 183 deletions(-) +commit 3373b53fbeaf91d4d7940712ad3ae69a0005d300 +Author: Fredrik Gerdin Börjesson +Date: Tue, 9 May 2023 18:10:52 +0200 -commit 446ac3d301da9f869936002ae010fbe0beab5978 -Author: klausspanderen -Date: Tue, 26 Jul 2022 15:25:05 +0200 + Add 3 missing elections to South Korea calendar - fixed file extensions + ql/time/calendars/southkorea.cpp | 5 ++++- + 1 file changed, 4 insertions(+), 1 deletion(-) - ql/pricingengines/vanilla/Makefile.am | 7 +++---- - 1 file changed, 3 insertions(+), 4 deletions(-) +commit c8c719114c40aaa56f16da0d504958a55d688b68 +Author: Luigi Ballabio +Date: Tue, 9 May 2023 14:43:43 +0200 -commit e465c246a47036be0c74669cd4cd4fb3cbdee126 -Author: klausspanderen -Date: Tue, 26 Jul 2022 15:22:16 +0200 + Update recorded speed of some tests - fixed tab + test-suite/andreasenhugevolatilityinterpl.cpp | 43 +++++++++++---------------- + test-suite/bermudanswaption.cpp | 2 +- + test-suite/distributions.cpp | 2 +- + test-suite/doublebarrieroption.cpp | 7 ++--- + test-suite/fdheston.cpp | 5 +--- + test-suite/hestonslvmodel.cpp | 2 +- + test-suite/shortratemodels.cpp | 10 ++----- + 7 files changed, 26 insertions(+), 45 deletions(-) - ql/pricingengines/vanilla/Makefile.am | 73 ++++++++++++++++++----------------- - 1 file changed, 37 insertions(+), 36 deletions(-) +commit f4e22fccf3a5b13f4397423325d6229134489a19 +Author: Luigi Ballabio +Date: Tue, 9 May 2023 13:13:21 +0200 -commit f946b877375791884913dd9099004ce066cc54b0 -Author: klausspanderen -Date: Tue, 26 Jul 2022 14:48:36 +0200 + Refactor, add new conditions - removed white spaces + tools/check_test_times.py | 55 +++++++++++++++++++++++++++++++++++++++++------ + 1 file changed, 48 insertions(+), 7 deletions(-) - ql/pricingengines/vanilla/Makefile.am | 4 ++-- - 1 file changed, 2 insertions(+), 2 deletions(-) +commit 7a724c7595e2cb0d93cdc3ad11c4d6dd71e8c34b +Author: Luigi Ballabio +Date: Tue, 9 May 2023 11:29:43 +0200 -commit 1e513fb1be2b51f883d9606c6e6604ee8a5c1577 -Author: klausspanderen -Date: Tue, 26 Jul 2022 14:37:16 +0200 + Export all results as artifacts - now with empty action caches + .github/workflows/test-times.yml | 8 ++++++-- + 1 file changed, 6 insertions(+), 2 deletions(-) - ql/pricingengines/vanilla/qdfpamericanengine.cpp | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) +commit 346d720c84444aa953ac395fe9de1f2d5a278653 +Author: Jonathan Sweemer +Date: Sat, 19 Nov 2022 14:10:43 +0900 -commit eff49b61504f28ba1a486f0373400c4f299ab1e7 -Author: klausspanderen -Date: Tue, 26 Jul 2022 13:56:15 +0200 + Replace boost::mpl with standard library - . + ql/timeseries.hpp | 11 ++++------- + 1 file changed, 4 insertions(+), 7 deletions(-) - ql/pricingengines/vanilla/qdfpamericanengine.cpp | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) +commit 777d13cc08b0fa6ff1b36d40c0dd16e57bc4ac4d +Merge: ca413d25a e80b20375 +Author: Luigi Ballabio +Date: Tue, 9 May 2023 09:14:31 +0200 -commit 9200c6f9a82a626106bf019f9c8aa5405df50823 -Author: klausspanderen -Date: Tue, 26 Jul 2022 13:44:46 +0200 + Make floating-rate coupons lazy (#1566) - . +commit ca413d25a1ac9a8ca9979992885da0b4b625853e +Author: Jonathan Sweemer +Date: Mon, 8 May 2023 19:24:29 +0900 - ql/pricingengines/vanilla/qdfpamericanengine.cpp | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) + Add compile options for GNU and Clang only -commit 09972519d2e1ed5ea9ca30ccbd833f0d6ff8a446 -Author: klausspanderen -Date: Tue, 26 Jul 2022 13:33:14 +0200 + CMakeLists.txt | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) - . +commit e80b20375fdabe4a4cd94555e8ab8a98bb512471 +Author: Luigi Ballabio +Date: Fri, 5 May 2023 23:25:16 +0200 - .github/workflows/sanitizer.yml | 4 ++-- - ql/CMakeLists.txt | 4 ++++ - ql/cashflows/cmscoupon.cpp | 3 ++- - .../marketmodels/products/multistep/callspecifiedmultiproduct.cpp | 4 ++-- - .../marketmodels/products/pathwise/pathwiseproductcallspecified.cpp | 4 ++-- - 5 files changed, 12 insertions(+), 7 deletions(-) + Remove run-tine settings -commit 4f8b198854423c6887b5ee0317d2523177c17ae1 -Author: klausspanderen -Date: Tue, 26 Jul 2022 13:16:00 +0200 + ql/patterns/lazyobject.hpp | 46 +++--------------------------- + test-suite/lazyobject.cpp | 71 +++------------------------------------------- + test-suite/lazyobject.hpp | 2 -- + 3 files changed, 8 insertions(+), 111 deletions(-) - . +commit f8fb06beba673ca9bdbfd9e863f07dbe21625280 +Author: Luigi Ballabio +Date: Fri, 5 May 2023 17:07:20 +0200 - CMakeLists.txt | 10 ++++++++-- - 1 file changed, 8 insertions(+), 2 deletions(-) + Initialize all data members + + This avoids a warning with gcc and some combination of flags. -commit 6e631070912bfb0b5aaf6b90719903ab74c81ece -Author: klausspanderen -Date: Tue, 26 Jul 2022 13:09:10 +0200 + ql/termstructures/iterativebootstrap.hpp | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) - . +commit 7c8f7092b56c9ae76e8609e30921b431b05e0774 +Author: RalfKonrad +Date: Thu, 4 May 2023 19:02:07 +0200 - ql/math/integrals/gaussianquadratures.cpp | 25 ++++++++++ - ql/math/integrals/gaussianquadratures.hpp | 24 +++++++++ - ql/pricingengines/vanilla/Makefile.am | 66 ++++++++++++------------- - test-suite/americanoption.cpp | 82 ++++++++++++++++++++++++------- - test-suite/americanoption.hpp | 1 + - test-suite/integrals.cpp | 38 ++++++++++++++ - test-suite/integrals.hpp | 3 ++ - 7 files changed, 188 insertions(+), 51 deletions(-) + Fixes issues #1651 -commit 31e3dee4f7ce9f611468e88ea0050be782d7ccaa -Author: klausspanderen -Date: Mon, 25 Jul 2022 16:01:52 +0200 + cmake/GenerateHeaders.cmake | 13 ++++++++----- + 1 file changed, 8 insertions(+), 5 deletions(-) - . +commit 06c77e1c99c1123c6d9627ef672b5cc9e36b311d +Author: Jonathan Sweemer +Date: Fri, 5 May 2023 15:38:42 +0900 - ql/CMakeLists.txt | 2 ++ - ql/pricingengines/vanilla/Makefile.am | 6 ++++-- - ql/pricingengines/vanilla/qdfpamericanengine.hpp | 2 +- - 3 files changed, 7 insertions(+), 3 deletions(-) + Replace boost::math::erf with std::erf -commit 5a456d684d30574500acebdafa74939d1b961da4 -Author: klausspanderen -Date: Mon, 25 Jul 2022 14:05:14 +0200 + .../shortrate/onefactormodels/gaussian1dmodel.cpp | 19 +++++++++---------- + .../shortrate/onefactormodels/gaussian1dmodel.hpp | 2 -- + 2 files changed, 9 insertions(+), 12 deletions(-) - first stub for new fixed point engine +commit 8fc33686ac6b0e1c344415d7a95b514cbcfbfeb5 +Merge: 6a0beaa4b 820bb3d02 +Author: Luigi Ballabio +Date: Thu, 4 May 2023 15:15:05 +0200 - ql/pricingengines/vanilla/all.hpp | 3 +- - ql/pricingengines/vanilla/qdfpamericanengine.cpp | 39 +++++++++++ - ql/pricingengines/vanilla/qdfpamericanengine.hpp | 80 ++++++++++++++++++++++ - ql/pricingengines/vanilla/qdplusamericanengine.cpp | 4 +- - ql/pricingengines/vanilla/qdplusamericanengine.hpp | 15 +++- - 5 files changed, 136 insertions(+), 5 deletions(-) + Use range-bound for loop with FdmLinearOpIterator (#1652) -commit 2d48d15446c3b31e5557260ac9ddc25ffb0fc3cc -Author: klausspanderen -Date: Mon, 25 Jul 2022 11:27:22 +0200 +commit 6a0beaa4b22d652c3a03d6a8ef4e87d2e729c825 +Author: Xcelerit Dev Team +Date: Thu, 4 May 2023 07:52:17 +0000 - rename qr in qd + Fixing test macros for compatibility - ql/CMakeLists.txt | 4 +- - ql/math/interpolations/chebyshevinterpolation.cpp | 69 +++++++++++----------- - ql/math/interpolations/chebyshevinterpolation.hpp | 28 +++++---- - ...americanengine.cpp => qdplusamericanengine.cpp} | 26 ++++---- - ...americanengine.hpp => qdplusamericanengine.hpp} | 8 +-- - test-suite/americanoption.cpp | 62 +++++++++---------- - test-suite/americanoption.hpp | 6 +- - test-suite/interpolations.cpp | 37 ++++++++++++ - test-suite/interpolations.hpp | 1 + - 9 files changed, 142 insertions(+), 99 deletions(-) + test-suite/daycounters.cpp | 12 ++++++------ + 1 file changed, 6 insertions(+), 6 deletions(-) -commit 00735ab16c3ee77f0edda8310c8c6d9615fda68a -Author: Oleg Kulkov -Date: Fri, 22 Jul 2022 23:20:54 +0200 +commit 838425de6e432752764899bb2286673e4ccf3204 +Author: RalfKonrad +Date: Thu, 4 May 2023 10:31:45 +0200 - removed check for increasing notionals as there are bonds with draw downs + Workaround for #1651 - ql/instruments/bond.cpp | 2 -- - 1 file changed, 2 deletions(-) + cmake/GenerateHeaders.cmake | 9 ++++++--- + 1 file changed, 6 insertions(+), 3 deletions(-) -commit 680c2929e0f74e360e966fa1c169e6afdae6e81a -Author: Xcelerit Dev Team -Date: Wed, 13 Jul 2022 13:05:21 +0100 +commit c99de6f9b3716753920d2f27a73f91daf91a7b0c +Merge: d748893e1 21435ca0f +Author: Luigi Ballabio +Date: Wed, 3 May 2023 14:17:51 +0200 - Adding ccache compiler launcher to CMake preset instead + Add install step to CMake CI jobs (#1647) - .github/workflows/cmake.yml | 2 +- - CMakePresets.json | 1 + - 2 files changed, 2 insertions(+), 1 deletion(-) +commit 21435ca0fd9d2f10495c02b1450c01ecfcef4731 +Author: Jonathan Sweemer +Date: Thu, 27 Apr 2023 13:08:03 +0900 -commit dffd8b27520ee2e73922992ae70dfdcebcf4cc14 -Author: Xcelerit Dev Team -Date: Wed, 13 Jul 2022 08:43:21 +0100 + Build CMake install target - Migrating to ninja generator with CMake + .github/workflows/cmake.yml | 25 +++++++++++++------------ + CMakePresets.json | 1 + + 2 files changed, 14 insertions(+), 12 deletions(-) - .github/workflows/cmake.yml | 56 +++++++++++++++++++++++++++++++-------------- - CMakePresets.json | 14 ++++++++---- - 2 files changed, 48 insertions(+), 22 deletions(-) +commit 820bb3d02654f37ea51a2fafc11527f167f2fcad +Author: Jonathan Sweemer +Date: Tue, 2 May 2023 22:17:34 +0900 + + Use range-bound for loop with FdmLinearOpIterator + + .../fdmextendedornsteinuhlenbeckop.cpp | 8 +-- + .../finitedifferences/fdmextoujumpop.cpp | 14 ++--- + .../finitedifferences/fdmvppstepcondition.cpp | 13 ++-- + ql/experimental/volatility/zabr.cpp | 6 +- + .../meshers/fdmmeshercomposite.cpp | 4 +- + .../meshers/uniformgridmesher.cpp | 4 +- + .../operators/fdm2dblackscholesop.cpp | 8 +-- + .../finitedifferences/operators/fdmbatesop.cpp | 14 ++--- + .../operators/fdmblackscholesfwdop.cpp | 8 +-- + .../operators/fdmblackscholesop.cpp | 8 +-- + .../finitedifferences/operators/fdmhestonfwdop.cpp | 13 ++-- + .../operators/fdmhestonhullwhiteop.cpp | 7 +-- + .../finitedifferences/operators/fdmhestonop.cpp | 14 ++--- + .../operators/fdmlocalvolfwdop.cpp | 8 +-- + .../operators/fdmornsteinuhlenbeckop.cpp | 7 +-- + .../operators/fdmsquarerootfwdop.cpp | 12 +--- + .../operators/firstderivativeop.cpp | 7 +-- + .../operators/ninepointlinearop.cpp | 31 ++++------ + .../operators/nthorderderivativeop.cpp | 9 +-- + .../operators/secondderivativeop.cpp | 7 +-- + .../operators/secondordermixedderivativeop.cpp | 15 ++--- + .../operators/triplebandlinearop.cpp | 35 ++++------- + .../finitedifferences/solvers/fdm1dimsolver.cpp | 9 +-- + .../finitedifferences/solvers/fdm2dimsolver.cpp | 15 ++--- + .../finitedifferences/solvers/fdm3dimsolver.cpp | 19 +++--- + .../finitedifferences/solvers/fdmndimsolver.hpp | 29 +++------ + .../stepconditions/fdmamericanstepcondition.cpp | 9 +-- + .../stepconditions/fdmbermudanstepcondition.cpp | 11 +--- + .../stepconditions/fdmsimplestoragecondition.cpp | 20 ++---- + .../stepconditions/fdmsimpleswingcondition.cpp | 11 +--- + .../utilities/fdmhestongreensfct.cpp | 6 +- + .../utilities/fdmindicesonboundary.cpp | 4 +- + .../utilities/fdminnervaluecalculator.cpp | 5 +- + ql/models/equity/hestonslvfdmmodel.cpp | 19 ++---- + .../equityfx/andreasenhugevolatilityinterpl.cpp | 9 +-- + test-suite/fdmlinearop.cpp | 72 +++++++--------------- + test-suite/hestonslvmodel.cpp | 20 ++---- + test-suite/nthorderderivativeop.cpp | 27 +++----- + 38 files changed, 163 insertions(+), 374 deletions(-) + +commit d748893e12a11855777df01a68e118d54b0b1970 +Merge: 5caa0b890 4b62cd61b +Author: Luigi Ballabio +Date: Tue, 2 May 2023 15:16:43 +0200 + + Allow schedules without tenor in CallableFixedRateBond (#1638) + +commit 5caa0b89069bf1facae767199fdd15c316ef2d0a +Author: Luigi Ballabio +Date: Tue, 2 May 2023 12:49:37 +0200 + + Replace kinetic with lunar images in CI build + + .github/workflows/linux-full-tests.yml | 4 ++-- + .github/workflows/linux-nondefault.yml | 4 ++-- + .github/workflows/linux.yml | 4 ++-- + 3 files changed, 6 insertions(+), 6 deletions(-) -commit 88a93877db5c7787adb6b141c1c6ee818e328e70 -Author: klausspanderen -Date: Mon, 11 Jul 2022 03:00:32 +0200 +commit 588255646d8585651e68a232c8b56d14913bab8b +Merge: 00db6da3d 78b94ce4e +Author: Luigi Ballabio +Date: Tue, 2 May 2023 09:41:23 +0200 - fixed g++4.8 build + Replace boost::hash with std::hash (#1648) - test-suite/americanoption.cpp | 5 +++-- - 1 file changed, 3 insertions(+), 2 deletions(-) +commit 00db6da3dbd38ce8fb528120688b40eff558519e +Author: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> +Date: Sun, 30 Apr 2023 03:05:54 +0000 -commit 11ec0aa9ef64d2edaaf725814f86904d3ca6e7b3 -Author: klausspanderen -Date: Mon, 11 Jul 2022 02:11:35 +0200 + Automated fixes by clang-tidy - fixed testcases + ql/termstructures/volatility/optionlet/strippedoptionlet.cpp | 10 +++++----- + ql/time/daycounters/yearfractiontodate.cpp | 3 +-- + test-suite/daycounters.cpp | 4 ++-- + 3 files changed, 8 insertions(+), 9 deletions(-) - ql/pricingengines/vanilla/qrplusamericanengine.cpp | 2 +- - test-suite/americanoption.cpp | 50 +++++++++++----------- - 2 files changed, 26 insertions(+), 26 deletions(-) +commit 1492e87c2104e4cf8e201374881b78053e7ff3c9 +Author: RalfKonrad +Date: Sun, 30 Apr 2023 13:35:44 +0200 -commit 5e05f57b997876531e5e8bdbd0640c842f8642f3 -Author: klausspanderen -Date: Mon, 11 Jul 2022 01:46:00 +0200 + Added mssing #include - improve root finding + ql/instruments/asianoption.cpp | 1 + + 1 file changed, 1 insertion(+) - ql/pricingengines/vanilla/qrplusamericanengine.cpp | 47 ++++++------ - ql/pricingengines/vanilla/qrplusamericanengine.hpp | 3 +- - test-suite/americanoption.cpp | 89 +++++++++++----------- - 3 files changed, 72 insertions(+), 67 deletions(-) +commit 78b94ce4e67c147b26f25713579c2305e99511e7 +Author: Jonathan Sweemer +Date: Sat, 29 Apr 2023 21:36:48 +0900 -commit 549bf21e11ed6cb57807a0bc5e526e1dc445a6d0 -Author: klausspanderen -Date: Sun, 10 Jul 2022 12:52:04 +0200 + Replace boost::hash with std::hash - . + ql/time/date.cpp | 7 ++++--- + 1 file changed, 4 insertions(+), 3 deletions(-) - ql/pricingengines/vanilla/qrplusamericanengine.cpp | 212 +++++++++++++++++---- - 1 file changed, 175 insertions(+), 37 deletions(-) +commit 4b62cd61b64258dbf513b229332853bf65aa6d95 +Author: HristoRaykov +Date: Fri, 28 Apr 2023 19:33:20 +0300 -commit 2c92771ac44ca13cbaf732b0019372678912924e -Author: klausspanderen -Date: Sun, 10 Jul 2022 12:15:09 +0200 + Unused import removed - finished qr plus engine + test-suite/callablebonds.cpp | 1 - + 1 file changed, 1 deletion(-) - ql/math/integrals/tanhsinhintegral.hpp | 8 +- - ql/pricingengines/vanilla/qrplusamericanengine.hpp | 22 +- - test-suite/americanoption.cpp | 352 ++++++++++++++++++--- - test-suite/americanoption.hpp | 1 + - 4 files changed, 328 insertions(+), 55 deletions(-) +commit 342542d30c7fa2ddbd920e13a803a7b0e74c3dd8 +Author: HristoRaykov +Date: Fri, 28 Apr 2023 19:13:52 +0300 -commit 2a5953faf37a0afc5adac3fa7dbc9f3b2bec4ac2 -Author: klausspanderen -Date: Wed, 1 Jun 2022 20:58:15 +0200 + Added test case for callable bond with arbitrary schedule - C++20 compliant this capture + test-suite/callablebonds.cpp | 43 +++++++++++++++++++++++++++++++++++++++++++ + test-suite/callablebonds.hpp | 1 + + 2 files changed, 44 insertions(+) - ql/pricingengines/vanilla/qrplusamericanengine.cpp | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) +commit ec7a060e1f9ace6c9ebb6570172fec1c12adfddf +Merge: a6c7874f1 6b90c868a +Author: Luigi Ballabio +Date: Fri, 28 Apr 2023 12:45:35 +0200 -commit 6b1a7fb4f254f25caa934ccac6686788296e29a2 -Author: klausspanderen -Date: Wed, 1 Jun 2022 19:08:27 +0200 + forwardrateagreement constructor enhancements fixes #154 (#1600) - removed square() +commit 6b90c868a91407ba31861b69d7807d11b998125f +Author: Luigi Ballabio +Date: Fri, 28 Apr 2023 10:22:20 +0200 - ql/pricingengines/vanilla/qrplusamericanengine.cpp | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) + Reuse constructors, clean up -commit e516f7e39728601a380341e9ed6ea04f341b730e -Author: klausspanderen -Date: Wed, 1 Jun 2022 07:33:05 +0200 + ql/instruments/forwardrateagreement.cpp | 65 +++++---------------------------- + ql/instruments/forwardrateagreement.hpp | 23 ++++++++---- + ql/termstructures/yield/ratehelpers.cpp | 2 +- + test-suite/forwardrateagreement.cpp | 2 +- + 4 files changed, 27 insertions(+), 65 deletions(-) - added QR analytic American engine +commit a6c7874f1bf100d4419067b9cc2f0404dc7026f2 +Merge: 7e328f8c0 d55819dcb +Author: Luigi Ballabio +Date: Fri, 28 Apr 2023 09:39:53 +0200 - ql/math/integrals/tanhsinhintegral.hpp | 5 +++-- - ql/pricingengines/vanilla/qrplusamericanengine.cpp | 6 +++--- - 2 files changed, 6 insertions(+), 5 deletions(-) + Extend available maturities for SOFR quarterly contract (#1643) -commit 339545aee793126ed79bd54186724d94dd89b41b -Author: Peter Caspers -Date: Wed, 11 May 2022 16:59:33 +0200 +commit 7e328f8c0267a77d6d88658ed68cdfa874ce6453 +Merge: 22c0760ee 7c18aa724 +Author: Luigi Ballabio +Date: Fri, 28 Apr 2023 08:52:06 +0200 - remove sessionId() declaration + Singapore calendar update (#1642) - .github/workflows/linux-full-tests.yml | 2 +- - .github/workflows/linux-nondefault.yml | 2 +- - .github/workflows/linux.yml | 2 +- - 3 files changed, 3 insertions(+), 3 deletions(-) +commit 22c0760ee875479a7990e0022810be91658e78e3 +Merge: 262bbf038 dcd96b665 +Author: Luigi Ballabio +Date: Thu, 27 Apr 2023 17:52:35 +0200 -commit f2a311d1ef303932f56cb0a883af1d6b08a48752 -Author: Peter Caspers -Date: Wed, 11 May 2022 16:57:40 +0200 + add ctor for date-dependent strikes to StrippedOptionlet (#1645) - Revert "remove sessionId from github workflows" - - This reverts commit 2c11a510ccbeb3e2f6d42877fa8f0d85f92e49be. +commit 262bbf03808317a10aea1b2db4fb87c661bdaad5 +Merge: e6a4bfc3d 323eb935a +Author: Luigi Ballabio +Date: Thu, 27 Apr 2023 17:09:02 +0200 - .github/workflows/linux-full-tests.yml | 6 +++++- - .github/workflows/linux-nondefault.yml | 3 ++- - .github/workflows/linux.yml | 6 +++++- - 3 files changed, 12 insertions(+), 3 deletions(-) + Add all.hpp even when no headers exist in directory (#1644) -commit 2c11a510ccbeb3e2f6d42877fa8f0d85f92e49be +commit dcd96b665ad8af5e9958e7a7f1b07e72d9c1cf1b Author: Peter Caspers -Date: Wed, 11 May 2022 15:41:58 +0200 +Date: Thu, 27 Apr 2023 16:25:44 +0200 - remove sessionId from github workflows + add ctor for date-dependent strikes - .github/workflows/linux-full-tests.yml | 6 +----- - .github/workflows/linux-nondefault.yml | 3 +-- - .github/workflows/linux.yml | 6 +----- - 3 files changed, 3 insertions(+), 12 deletions(-) + .../volatility/optionlet/strippedoptionlet.cpp | 79 +++++++++++++++------- + .../volatility/optionlet/strippedoptionlet.hpp | 11 ++- + 2 files changed, 64 insertions(+), 26 deletions(-) -commit 558d2b3f4756a71f796848829c4d6cbfdc9dd98a -Author: klausspanderen -Date: Wed, 11 May 2022 10:42:46 +0200 +commit 323eb935af930b8a7594487d58b14f1bafebdb2f +Author: Jonathan Sweemer +Date: Thu, 27 Apr 2023 12:37:08 +0900 - . + Add all.hpp even when no headers exist in directory - CMakeLists.txt | 2 +- - ql/CMakeLists.txt | 2 + - ql/math/interpolations/chebyshevinterpolation.hpp | 3 - - ql/pricingengines/vanilla/Makefile.am | 6 +- - ql/pricingengines/vanilla/qrplusamericanengine.cpp | 236 +++++++++++++++++++++ - ql/pricingengines/vanilla/qrplusamericanengine.hpp | 63 ++++++ - test-suite/americanoption.cpp | 137 +++++++++++- - test-suite/americanoption.hpp | 2 + - 8 files changed, 444 insertions(+), 7 deletions(-) - -commit cd3986b11b6717cb1383ac642d4743a9ab1c50d4 -Author: Peter Caspers -Date: Wed, 11 May 2022 09:13:13 +0200 + cmake/GenerateHeaders.cmake | 14 ++++++-------- + 1 file changed, 6 insertions(+), 8 deletions(-) - update description of singleton +commit d55819dcb76b6073f1034d8bc7077dd377b3b757 +Author: jakeheke75 +Date: Wed, 26 Apr 2023 23:32:19 +0200 - ql/patterns/singleton.hpp | 25 +++++++++---------------- - 1 file changed, 9 insertions(+), 16 deletions(-) + Should fix SOFR quarterly contract constraint #1636 -commit b2cceec6e1ef4e4e71d5efbcb14233b8b7c3ae8a -Author: Peter Caspers -Date: Wed, 11 May 2022 08:41:40 +0200 - - update examples - - Examples/BasketLosses/BasketLosses.cpp | 6 ------ - Examples/BermudanSwaption/BermudanSwaption.cpp | 9 --------- - Examples/Bonds/Bonds.cpp | 9 --------- - Examples/CDS/CDS.cpp | 7 ------- - Examples/CVAIRS/CVAIRS.cpp | 8 -------- - Examples/CallableBonds/CallableBonds.cpp | 7 ------- - Examples/ConvertibleBonds/ConvertibleBonds.cpp | 9 --------- - Examples/DiscreteHedging/DiscreteHedging.cpp | 9 --------- - Examples/EquityOption/EquityOption.cpp | 9 --------- - Examples/FRA/FRA.cpp | 8 -------- - Examples/FittedBondCurve/FittedBondCurve.cpp | 6 ------ - Examples/Gaussian1dModels/Gaussian1dModels.cpp | 8 -------- - Examples/GlobalOptimizer/GlobalOptimizer.cpp | 8 -------- - Examples/LatentModel/LatentModel.cpp | 9 --------- - Examples/MarketModels/MarketModels.cpp | 9 --------- - Examples/MulticurveBootstrapping/MulticurveBootstrapping.cpp | 9 --------- - Examples/MultidimIntegral/MultidimIntegral.cpp | 8 -------- - Examples/Replication/Replication.cpp | 8 -------- - Examples/Repo/Repo.cpp | 8 -------- - 19 files changed, 154 deletions(-) - -commit 7891fb41fff24d03aa8f12d0c513aa539571542a -Author: Peter Caspers -Date: Wed, 11 May 2022 08:41:01 +0200 + ql/termstructures/yield/overnightindexfutureratehelper.cpp | 10 ---------- + 1 file changed, 10 deletions(-) - update build system +commit e6a4bfc3d02c136d90ab8629c94e23e8c9c9cd28 +Merge: 647528eb0 1735e07b5 +Author: Luigi Ballabio +Date: Wed, 26 Apr 2023 17:33:57 +0200 - Examples/CMakeLists.txt | 3 +-- - 1 file changed, 1 insertion(+), 2 deletions(-) + update hk calendar (#1640) -commit 2bc4a2977ed958cf3fbc6b55adf66a7318abe201 -Author: Peter Caspers -Date: Wed, 11 May 2022 08:39:57 +0200 +commit 7c18aa72498862cc1f74c5b37f9734d918a1bb52 +Author: Rémy Frèrebeau +Date: Wed, 26 Apr 2023 14:43:44 +0200 - update build system + singapour calendar update + + No info before 2019 on https://www.sgx.com/derivatives/trading - CMakeLists.txt | 5 ++--- - configure.ac | 16 ---------------- - ql/auto_link.hpp | 2 +- - ql/config.hpp.cfg | 1 - - ql/userconfig.hpp | 8 -------- - test-suite/CMakeLists.txt | 6 ++---- - test-suite/quantlibbenchmark.cpp | 6 ------ - test-suite/quantlibtestsuite.cpp | 8 -------- - 8 files changed, 5 insertions(+), 47 deletions(-) + ql/time/calendars/singapore.cpp | 88 +++++++++++++++++++++++++++++++++++++++++ + 1 file changed, 88 insertions(+) -commit 738c9677bef93b0c150255b4f02d515a4b4c802b -Author: Peter Caspers -Date: Tue, 10 May 2022 15:35:28 +0200 +commit 1735e07b5b515c63061e10e5c2e55588f00aeb9e +Author: Rémy Frèrebeau +Date: Wed, 26 Apr 2023 11:22:51 +0200 - simplify singleton implementation + HKEx calendar update - ql/patterns/singleton.hpp | 114 ++++------------------------------------------ - 1 file changed, 8 insertions(+), 106 deletions(-) + ql/time/calendars/hongkong.cpp | 20 ++++++++++++++++++++ + 1 file changed, 20 insertions(+) -commit 6a66a29a78d804c3cfd1061b645122c628e9313e -Author: klausspanderen -Date: Sat, 9 Apr 2022 20:24:45 +0200 +commit 88084ebf4abe6b9e25daf194248e4400469ba432 +Author: Rémy Frèrebeau +Date: Tue, 25 Apr 2023 18:17:51 +0200 - test call put parity for American option + update hk calendar - test-suite/americanoption.cpp | 92 ++++++++++++++++++++++++++++++++++ - test-suite/americanoption.hpp | 1 + - test-suite/fdheston.cpp | 112 ++++++++++++++++++++++++++++++++++++++++++ - test-suite/fdheston.hpp | 1 + - 4 files changed, 206 insertions(+) + ql/time/calendars/hongkong.cpp | 34 ++++++++++++++++++++++++++++++++++ + 1 file changed, 34 insertions(+) -commit 643e69bdfe047aac91559c4d892a7e8e20955119 -Author: klausspanderen -Date: Thu, 7 Apr 2022 00:04:04 +0200 +commit 225ab3670ea2ebfdb796ccddfaeb304e0bd013cc +Author: jakeheke75 +Date: Tue, 25 Apr 2023 13:03:29 +0200 - fixed single file compilation + New constructors - ql/math/integrals/tanhsinhintegral.hpp | 1 + - 1 file changed, 1 insertion(+) + Examples/FRA/FRA.cpp | 8 ++--- + ql/instruments/forwardrateagreement.cpp | 60 ++++++++++++++++++++++++++++++--- + ql/instruments/forwardrateagreement.hpp | 26 ++++++++++++-- + ql/termstructures/yield/ratehelpers.cpp | 5 ++- + test-suite/forwardrateagreement.cpp | 26 +++++++++++--- + test-suite/piecewiseyieldcurve.cpp | 34 +++++++++---------- + 6 files changed, 121 insertions(+), 38 deletions(-) -commit 179eda7ae360fb546719b92325eb9c79237b2000 -Author: klausspanderen -Date: Wed, 6 Apr 2022 23:08:00 +0200 +commit 647528eb08890fac030c2ae07e061fec0891dab2 +Merge: fc2734893 a998e6764 +Author: Luigi Ballabio +Date: Mon, 24 Apr 2023 22:54:02 +0200 - fixed build + Change boost::unordered_set to std::unordered_set (#1634) - ql/math/Makefile.am | 2 +- - ql/math/interpolations/Makefile.am | 9 ++++----- - 2 files changed, 5 insertions(+), 6 deletions(-) +commit fc2734893caad113b6f577e1dd8d9c484a261061 +Merge: a342b44ff 681959c25 +Author: Luigi Ballabio +Date: Mon, 24 Apr 2023 22:50:02 +0200 -commit 154919949d5e19b26356ee079cf0fd15d1610189 -Author: klausspanderen -Date: Wed, 6 Apr 2022 22:40:05 +0200 + enable more daycounters for QL_HIGH_RESOLUTION_DATE (#1637) - add chebyshev interpolation make file +commit 681959c255d70dad65518a35dc9a5b8d71d3995c +Author: klaus spanderen +Date: Mon, 24 Apr 2023 19:44:09 +0200 - CMakeLists.txt | 2 ++ - ql/math/Makefile.am | 1 + - 2 files changed, 3 insertions(+) + replace class with single function -commit ffe53ca373794ef7f8b7b17c0f6aa977e83fac41 -Author: klausspanderen -Date: Tue, 5 Apr 2022 21:10:31 +0200 - - . - - ql/CMakeLists.txt | 3 + - ql/math/integrals/Makefile.am | 1 + - ql/math/integrals/all.hpp | 1 + - ql/math/integrals/tanhsinhintegral.hpp | 85 +++++++++++++++++++++++ - ql/math/interpolations/Makefile.am | 26 +++++++ - ql/math/interpolations/all.hpp | 1 + - ql/math/interpolations/chebyshevinterpolation.cpp | 73 +++++++++++++++++++ - ql/math/interpolations/chebyshevinterpolation.hpp | 60 ++++++++++++++++ - test-suite/integrals.cpp | 13 ++++ - test-suite/integrals.hpp | 1 + - test-suite/interpolations.cpp | 42 +++++++++++ - test-suite/interpolations.hpp | 1 + - 12 files changed, 307 insertions(+) - -commit 0bb5f1e5d3a074a37f41c6bed5e9e175f8aafb20 -Author: RalfKonrad -Date: Sun, 3 Oct 2021 23:14:34 +0200 + .../volatility/equityfx/fixedlocalvolsurface.cpp | 4 ++-- + ql/time/daycounters/yearfractiontodate.cpp | 26 +++++++++------------- + ql/time/daycounters/yearfractiontodate.hpp | 12 ++-------- + test-suite/daycounters.cpp | 7 +++--- + 4 files changed, 17 insertions(+), 32 deletions(-) - Prevent (weird !?) -Werror=deprecated-declarations error for gcc compilers +commit 5b26dcff61b2e151acdc0d928cfc2fad58c8d919 +Author: HristoRaykov +Date: Mon, 24 Apr 2023 15:36:07 +0300 - ql/indexes/inflationindex.cpp | 5 +++++ - 1 file changed, 5 insertions(+) + adjustment checks for first and last date moved out of EOM if/else -commit acb130cba7c7aef7936fed3aa52651f3bfbcc248 -Author: RalfKonrad -Date: Sun, 3 Oct 2021 19:09:59 +0200 + ql/time/schedule.cpp | 35 +++++++++++++++-------------------- + 1 file changed, 15 insertions(+), 20 deletions(-) - small enhancements +commit 00ecb3a1193d32c8e8078e5eae15a38f9b00f3b3 +Author: klaus spanderen +Date: Sun, 23 Apr 2023 14:36:35 +0200 - ql/indexes/inflationindex.cpp | 12 +++++------- - ql/indexes/inflationindex.hpp | 18 ++++++------------ - 2 files changed, 11 insertions(+), 19 deletions(-) + fixed tabs -commit c86250cd9ec9057a9b6326fc11e0ad9d77fa14e5 -Author: RalfKonrad -Date: Sat, 2 Oct 2021 17:00:16 +0200 + test-suite/daycounters.cpp | 45 ++++++++++++++++++++++----------------------- + 1 file changed, 22 insertions(+), 23 deletions(-) - fixed -Werror,-Wreorder +commit 465364a373314cd8a9ad5a6f0314d04761664d91 +Author: klaus spanderen +Date: Sun, 23 Apr 2023 14:27:01 +0200 - ql/indexes/inflationindex.cpp | 8 +++----- - ql/indexes/inflationindex.hpp | 2 +- - 2 files changed, 4 insertions(+), 6 deletions(-) + avoid cast warnings -commit 6fbb5062fa7430d934b91861367d9c8f45e81250 -Author: RalfKonrad -Date: Sat, 2 Oct 2021 16:47:28 +0200 - - Reverted clang format changes for better comparison. - - ql/cashflows/cpicoupon.cpp | 154 ++++++++++---------- - ql/cashflows/cpicoupon.hpp | 47 +++--- - .../inflation/cpicapfloortermpricesurface.cpp | 1 + - ql/experimental/inflation/genericindexes.hpp | 68 +++++---- - ql/indexes/inflationindex.cpp | 160 +++++++++++---------- - ql/indexes/inflationindex.hpp | 52 ++++--- - ql/instruments/cpicapfloor.cpp | 30 ++-- - ql/termstructures/inflation/inflationhelpers.cpp | 2 +- - test-suite/inflationcapfloor.cpp | 2 + - test-suite/inflationcpibond.cpp | 1 + - test-suite/inflationcpicapfloor.cpp | 1 + - test-suite/inflationcpiswap.cpp | 1 + - 12 files changed, 295 insertions(+), 224 deletions(-) - -commit 78e7537d6728706a87dea5afad9bb45a0b3b9f31 -Author: RalfKonrad -Date: Sun, 28 Feb 2021 18:51:16 +0100 + ql/time/daycounters/yearfractiontodate.cpp | 11 ++++++++--- + 1 file changed, 8 insertions(+), 3 deletions(-) - Own QL_DEPRECATED_[DIS|EN]ABLE_WARNING_III macros to find places I am wroking on... +commit 970d196bf8757a25cbb6113895369c557c094370 +Author: klaus spanderen +Date: Sun, 23 Apr 2023 13:51:52 +0200 - ql/indexes/inflationindex.hpp | 30 ++++----- - ql/qldefines.hpp | 121 +++++++++++++++--------------------- - test-suite/inflation.cpp | 4 +- - test-suite/inflationcapfloor.cpp | 4 +- - test-suite/inflationcpibond.cpp | 4 +- - test-suite/inflationcpicapfloor.cpp | 12 ++-- - test-suite/inflationcpiswap.cpp | 8 +-- - 7 files changed, 81 insertions(+), 102 deletions(-) + enable more daycounters for QL_HIGH_RESOLUTION_DATE + + added YearFractionToDate class -commit 8b1ecc0635a960b89acf68a3931fc0850a5dd1b3 -Author: RalfKonrad -Date: Sat, 27 Feb 2021 15:37:11 +0100 + QuantLib.vcxproj | 6 +- + QuantLib.vcxproj.filters | 8 +- + ql/CMakeLists.txt | 2 + + .../volatility/equityfx/fixedlocalvolsurface.cpp | 18 +-- + ql/time/date.cpp | 15 +++ + ql/time/daycounters/Makefile.am | 6 +- + ql/time/daycounters/actual364.hpp | 2 +- + ql/time/daycounters/actual36525.hpp | 3 +- + ql/time/daycounters/actual366.hpp | 3 +- + ql/time/daycounters/all.hpp | 1 + + ql/time/daycounters/yearfractiontodate.cpp | 66 +++++++++++ + ql/time/daycounters/yearfractiontodate.hpp | 44 +++++++ + test-suite/dates.cpp | 18 +++ + test-suite/daycounters.cpp | 132 ++++++++++++++++++++- + test-suite/daycounters.hpp | 3 + + 15 files changed, 303 insertions(+), 24 deletions(-) + +commit a998e6764fd43e186740de094cee266b343b9a7e +Author: Jonathan Sweemer +Date: Fri, 21 Apr 2023 00:29:11 +0000 - Used PR #1055 in advance... + Change boost::unordered_set to std::unordered_set - ql/indexes/inflationindex.hpp | 31 ---------- - ql/qldefines.hpp | 134 +++++++++++++++++++++++++++--------------- - 2 files changed, 88 insertions(+), 77 deletions(-) + .../shortrate/onefactormodels/gaussian1dmodel.hpp | 6 ++++++ + ql/patterns/observable.hpp | 22 ++++++++++++++++++---- + ql/time/date.cpp | 6 ++++++ + 3 files changed, 30 insertions(+), 4 deletions(-) -commit 24c01e8ab50209a4a0b5d8446dc4f4a5bf83d699 -Author: RalfKonrad -Date: Fri, 26 Feb 2021 18:10:24 +0100 +commit a342b44ff76a160240334566f6bd66d442666601 +Author: Luigi Ballabio +Date: Fri, 21 Apr 2023 10:42:21 +0200 - Avoid deprecated warnings. + Avoid including deprecated files in cmake build - ql/instruments/zerocouponinflationswap.cpp | 6 ++++++ - ql/termstructures/inflation/inflationhelpers.cpp | 4 ++++ - 2 files changed, 10 insertions(+) + ql/experimental/Makefile.am | 2 +- + ql/experimental/all.hpp | 1 + + ql/experimental/amortizingbonds/Makefile.am | 2 +- + ql/experimental/amortizingbonds/all.hpp | 3 --- + 4 files changed, 3 insertions(+), 5 deletions(-) -commit 308ce7bf3012124ab839da6222fd7846ae795ae6 -Author: RalfKonrad -Date: Fri, 26 Feb 2021 17:02:02 +0100 +commit 523d9a535a38e8c185d3850c589f8ebf86865c1b +Merge: 8f3b3f22d d2cf852ce +Author: Luigi Ballabio +Date: Fri, 21 Apr 2023 09:17:08 +0200 - Minor changes + Unsuppress cppcoreguidelines-special-member-functions (#1629) - ql/indexes/inflationindex.cpp | 6 +++--- - ql/instruments/cpicapfloor.cpp | 1 + - 2 files changed, 4 insertions(+), 3 deletions(-) +commit d2cf852ce68c69da2730dabd3af915348e9e1638 +Author: Jonathan Sweemer +Date: Wed, 12 Apr 2023 07:54:44 +0000 -commit c68cf714905c3bb663cb239000f68180e1a87d33 -Author: RalfKonrad -Date: Fri, 26 Feb 2021 17:00:41 +0100 + Unsuppress cppcoreguidelines-special-member-functions - Reverted changes + .clang-tidy | 3 ++- + ql/cashflows/cashflows.hpp | 4 ++++ + ql/experimental/callablebonds/callablebond.cpp | 2 +- + ql/math/array.hpp | 9 +++++---- + ql/math/matrix.hpp | 4 ++-- + .../operators/ninepointlinearop.hpp | 1 + + .../operators/triplebandlinearop.hpp | 1 + + .../finitedifferences/tridiagonaloperator.hpp | 1 + + ql/patterns/observable.hpp | 4 ++-- + ql/patterns/singleton.hpp | 1 + + ql/settings.hpp | 2 +- + ql/termstructures/interpolatedcurve.hpp | 23 ++++++++++++++++++++-- + .../swaption/sabrswaptionvolatilitycube.hpp | 2 +- + ql/time/date.cpp | 2 +- + ql/utilities/clone.hpp | 1 + + ql/utilities/observablevalue.hpp | 2 +- + test-suite/inflationcpibond.cpp | 2 +- + test-suite/observable.cpp | 2 +- + test-suite/tracing.cpp | 2 +- + test-suite/utilities.hpp | 2 +- + 20 files changed, 50 insertions(+), 20 deletions(-) - ql/instruments/zerocouponinflationswap.cpp | 93 ++++++------------ - ql/instruments/zerocouponinflationswap.hpp | 41 +++----- - ql/termstructures/inflation/inflationhelpers.cpp | 116 +++++++++++------------ - ql/termstructures/inflation/inflationhelpers.hpp | 75 ++++++--------- - 4 files changed, 126 insertions(+), 199 deletions(-) +commit 8f3b3f22d5dbc9b76a79143f261e447f2860aa4b +Merge: 48ddfebf8 334fa9702 +Author: Luigi Ballabio +Date: Wed, 19 Apr 2023 22:20:08 +0200 -commit 89cef04583cd60bfd4d6699ee1d2f764cf694b04 -Author: RalfKonrad -Date: Fri, 26 Feb 2021 16:37:45 +0100 + Remove features deprecated in version 1.26 (#1633) - bugfix +commit 48ddfebf80c12bd8ee090a5087a81b5909000f3f +Merge: 22c28fc48 f4b14465e +Author: Luigi Ballabio +Date: Wed, 19 Apr 2023 15:31:57 +0200 - ql/instruments/cpicapfloor.cpp | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) + Pass dim by value to FdmLinearOpLayout and move (#1628) -commit edf12b298fc9d32d4e677b4c748d8449f417b11e -Author: RalfKonrad -Date: Fri, 26 Feb 2021 16:34:35 +0100 +commit 22c28fc483b342d3b3fcb0c879cacaa0c53a1a56 +Merge: d2d89f05e 6d63eaf17 +Author: Luigi Ballabio +Date: Wed, 19 Apr 2023 15:31:05 +0200 - Added copyrights + Make swap functions noexcept (#1631) - ql/cashflows/cpicoupon.cpp | 1 + - ql/cashflows/cpicoupon.hpp | 1 + - ql/instruments/zerocouponinflationswap.cpp | 1 + - ql/instruments/zerocouponinflationswap.hpp | 1 + - ql/termstructures/inflation/inflationhelpers.cpp | 1 + - ql/termstructures/inflation/inflationhelpers.hpp | 1 + - 6 files changed, 6 insertions(+) +commit 334fa970275313e19ada47ae9077206705747abf +Author: Luigi Ballabio +Date: Wed, 19 Apr 2023 13:19:52 +0200 -commit f5a41ffc64bcaa942b754df52c89b89f8302ae02 -Author: RalfKonrad -Date: Fri, 26 Feb 2021 15:45:36 +0100 + Fix access to private type - Disabled deprecated warning. + ql/patterns/observable.hpp | 1 + + 1 file changed, 1 insertion(+) - ql/experimental/inflation/cpicapfloortermpricesurface.cpp | 3 ++- - 1 file changed, 2 insertions(+), 1 deletion(-) +commit a60789d72ec9fd3f0ddbcc6c8df74180f2d2e9bb +Author: Luigi Ballabio +Date: Wed, 19 Apr 2023 13:03:48 +0200 -commit 849abd7f3da03e2bedc8506336bea7dc0415e9aa -Author: RalfKonrad -Date: Fri, 26 Feb 2021 15:41:38 +0100 + Remove features deprecated in version 1.26 - CPI::InterpolationType is specific to CPICoupon based intruments. + cmake/GenerateHeaders.cmake | 4 + + ql/cashflows/cpicoupon.cpp | 84 -------------- + ql/cashflows/cpicoupon.hpp | 72 ------------ + ql/cashflows/zeroinflationcashflow.cpp | 17 --- + ql/cashflows/zeroinflationcashflow.hpp | 15 --- + ql/math/Makefile.am | 2 +- + ql/math/all.hpp | 2 - + ql/math/curve.hpp | 30 +---- + ql/math/lexicographicalview.hpp | 154 +------------------------ + ql/methods/montecarlo/lsmbasissystem.hpp | 6 - + ql/patterns/Makefile.am | 2 +- + ql/patterns/all.hpp | 1 - + ql/patterns/composite.hpp | 33 +----- + ql/patterns/observable.hpp | 45 +------- + ql/pricingengines/vanilla/mcamericanengine.hpp | 12 -- + ql/termstructures/yield/Makefile.am | 2 +- + ql/termstructures/yield/all.hpp | 1 - + ql/termstructures/yield/drifttermstructure.hpp | 98 +--------------- + 18 files changed, 21 insertions(+), 559 deletions(-) - ql/cashflows/cpicoupon.cpp | 218 +++++++++++++++++++++--------------------- - ql/cashflows/cpicoupon.hpp | 33 +++++++ - ql/indexes/inflationindex.cpp | 14 --- - ql/indexes/inflationindex.hpp | 45 --------- - 4 files changed, 140 insertions(+), 170 deletions(-) +commit d2d89f05ec5770bf68289e3a7af421e911ed6536 +Author: Luigi Ballabio +Date: Wed, 19 Apr 2023 10:51:02 +0200 -commit 60424a0d6cb0ee15b13b5ade2eb58cfc0c480de0 -Author: RalfKonrad -Date: Fri, 26 Feb 2021 15:30:33 +0100 + Avoid warning on latest Apple clang - Reverted to master + test-suite/tracing.cpp | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) - .../inflation/cpicapfloortermpricesurface.cpp | 114 +++---- - .../inflation/cpicapfloortermpricesurface.hpp | 338 ++++++++------------- - 2 files changed, 173 insertions(+), 279 deletions(-) +commit ec2ad9e77cfb6e77d406707048196859f7f25b53 +Author: Luigi Ballabio +Date: Thu, 15 Apr 2021 16:25:45 +0200 -commit b75d5db265409ad778eb4c2923617dbd0e14f065 -Author: RalfKonrad -Date: Fri, 26 Feb 2021 15:20:02 +0100 + Set version to 1.31-dev. - ZeroCouponInflationSwap is not CPI + CMakeLists.txt | 6 +++--- + configure.ac | 2 +- + ql/version.hpp | 4 ++-- + 3 files changed, 6 insertions(+), 6 deletions(-) - ql/instruments/zerocouponinflationswap.cpp | 22 +++++++++------------- - ql/instruments/zerocouponinflationswap.hpp | 9 +++------ - ql/termstructures/inflation/inflationhelpers.cpp | 14 ++++++++------ - ql/termstructures/inflation/inflationhelpers.hpp | 4 ++-- - 4 files changed, 22 insertions(+), 27 deletions(-) +commit 4887a7a5f645a6e95cb302ca2908a7fb96fc99fc +Author: jakeheke75 +Date: Wed, 19 Apr 2023 10:19:13 +0200 -commit 1bf8a054b04960f5a781c86a3487f50dec5b54bf -Author: Ralf Konrad <42419984+ralfkonrad@users.noreply.github.com> -Date: Thu, 25 Feb 2021 23:09:22 +0100 + deprecated constructor in version 1.31 - Added missing header file. + ql/instruments/forwardrateagreement.hpp | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) - ql/instruments/zerocouponinflationswap.hpp | 1 + - 1 file changed, 1 insertion(+) +commit 08aa5476e4193792cb9aa05158baf37b97c5052c +Author: jakeheke75 +Date: Tue, 18 Apr 2023 22:53:20 +0200 -commit bab8c96830fc28f17263f5194ce7aaeb07956f07 -Author: Ralf Konrad <42419984+ralfkonrad@users.noreply.github.com> -Date: Thu, 25 Feb 2021 22:12:19 +0100 + -removed the ctor without the index + -cleaned up comments/unnecessary spaces - bugfix + ql/instruments/forwardrateagreement.cpp | 73 +++------------------------------ + ql/instruments/forwardrateagreement.hpp | 23 ----------- + ql/termstructures/yield/ratehelpers.cpp | 6 +-- + 3 files changed, 7 insertions(+), 95 deletions(-) - test-suite/inflationcpicapfloor.cpp | 4 ++-- - 1 file changed, 2 insertions(+), 2 deletions(-) +commit 6d63eaf1729b33976eed5ae6d806916111ea7b84 +Author: Jonathan Sweemer +Date: Fri, 14 Apr 2023 21:19:08 +0900 + + Make swap functions noexcept + + ql/math/array.hpp | 11 +++++------ + ql/math/interpolations/multicubicspline.hpp | 4 ++-- + ql/math/matrix.hpp | 13 ++++++------- + ql/math/sampledcurve.hpp | 9 ++++----- + .../finitedifferences/operators/fdmlinearopiterator.hpp | 2 +- + .../finitedifferences/operators/ninepointlinearop.cpp | 4 ++-- + .../finitedifferences/operators/ninepointlinearop.hpp | 2 +- + .../finitedifferences/operators/triplebandlinearop.cpp | 4 ++-- + .../finitedifferences/operators/triplebandlinearop.hpp | 2 +- + ql/methods/finitedifferences/tridiagonaloperator.hpp | 13 ++++++------- + ql/utilities/clone.hpp | 8 ++++---- + 11 files changed, 34 insertions(+), 38 deletions(-) + +commit e5a2a96cdaf6dd0067d19a5ea8102ae20192cd21 +Author: jakeheke75 +Date: Thu, 13 Apr 2023 17:43:49 +0200 + + New ctor with forecast-discount curve and new helper class + + ql/instruments/forwardrateagreement.cpp | 38 +++++++++++++++++++++++---------- + ql/instruments/forwardrateagreement.hpp | 8 +++++-- + ql/termstructures/yield/ratehelpers.cpp | 10 +++++++-- + 3 files changed, 41 insertions(+), 15 deletions(-) + +commit f4b14465e0dd542536a8858a4952c522690a8bc4 +Author: Jonathan Sweemer +Date: Mon, 20 Feb 2023 21:56:12 +0900 -commit cac9ab3c1fdb30688b1a8e307eb95c8d1b677684 -Author: RalfKonrad -Date: Thu, 25 Feb 2021 21:13:57 +0100 + Pass dim by value to FdmLinearOpLayout and move - Disabled more deprecated warnings in testsuite. + ql/experimental/volatility/zabr.cpp | 9 +++++++++ + ql/methods/finitedifferences/meshers/fdmmeshercomposite.cpp | 2 +- + ql/methods/finitedifferences/operators/fdmlinearoplayout.hpp | 8 ++++---- + 3 files changed, 14 insertions(+), 5 deletions(-) - test-suite/inflationcpicapfloor.cpp | 4 ++++ - 1 file changed, 4 insertions(+) +commit e99427b572344cf5df763bcddb6bf77538c1f54c +Author: Luigi Ballabio +Date: Wed, 5 Apr 2023 12:51:49 +0200 -commit 9fc5696acbc17473917ccf3560df6a8389d3ccbc -Author: RalfKonrad -Date: Thu, 25 Feb 2021 20:30:37 +0100 + Some changes in docs - Disabled more deprecated warnings in testsuite. + ql/instruments/forwardrateagreement.hpp | 22 +++++++++++----------- + 1 file changed, 11 insertions(+), 11 deletions(-) - test-suite/inflation.cpp | 4 ++++ - 1 file changed, 4 insertions(+) +commit 72b97c46e8f426d8e75068281ef7915adced8016 +Author: Luigi Ballabio +Date: Wed, 5 Apr 2023 12:36:15 +0200 -commit 250bdf31d95d2addbd48af3dc90122e236ff9b13 -Author: RalfKonrad -Date: Thu, 25 Feb 2021 20:12:25 +0100 + Reorganize docs - Disabled more deprecated warnings in testsuite. + ql/patterns/lazyobject.hpp | 39 ++++++++++++++++++++++++--------------- + ql/patterns/observable.hpp | 36 ++++++++++++++++++++---------------- + 2 files changed, 44 insertions(+), 31 deletions(-) - test-suite/inflationcapfloor.cpp | 6 ++++-- - 1 file changed, 4 insertions(+), 2 deletions(-) +commit 3840448446991af44b729069f4d4e9fd16cb0013 +Author: Luigi Ballabio +Date: Wed, 5 Apr 2023 10:45:28 +0200 -commit 47d4c645adf9d7f9e8af5f0c7ead38e7ca09a836 -Author: RalfKonrad -Date: Thu, 25 Feb 2021 20:01:41 +0100 + Add LazyObject configuration - Disabled more deprecated warnings in testsuite. + ql/patterns/lazyobject.hpp | 42 ++++++++++++++++++-- + test-suite/lazyobject.cpp | 96 ++++++++++++++++++++++++++++++++++++++++------ + test-suite/lazyobject.hpp | 2 + + 3 files changed, 125 insertions(+), 15 deletions(-) - test-suite/inflationcpiswap.cpp | 4 ++++ - 1 file changed, 4 insertions(+) +commit c2ac9965c4f7abb2fb5a58f000d1bad7e5102b63 +Author: Luigi Ballabio +Date: Mon, 3 Apr 2023 10:17:40 +0200 -commit b288ba3279b11fea2cc3e6d28910a3da4639bc1a -Author: RalfKonrad -Date: Thu, 25 Feb 2021 19:56:41 +0100 + Deprecated both implementations of registerWithObservables - Refactored from detail::effectiveInterpolationType(...) to detail::CPI::effectiveInterpolationType(...) + ql/patterns/observable.hpp | 21 +++++++++++++++------ + 1 file changed, 15 insertions(+), 6 deletions(-) - .../inflation/cpicapfloortermpricesurface.cpp | 2 +- - .../inflation/cpicapfloortermpricesurface.hpp | 2 +- - ql/indexes/inflationindex.cpp | 8 +++--- - ql/indexes/inflationindex.hpp | 32 ++++++++++++---------- - ql/instruments/cpicapfloor.cpp | 2 +- - ql/instruments/zerocouponinflationswap.cpp | 8 ++++-- - ql/termstructures/inflation/inflationhelpers.cpp | 2 +- - 7 files changed, 30 insertions(+), 26 deletions(-) +commit e3a177d48b2da4c82da02afa4a2c9599061fecdd +Author: Luigi Ballabio +Date: Tue, 28 Mar 2023 14:18:55 +0200 -commit fa0186617f25279fd2de09d55d6fe4444625a632 -Author: RalfKonrad -Date: Thu, 25 Feb 2021 19:38:18 +0100 + Test regression for at-par FRA - Disabled more deprecated warnings in testsuite. + test-suite/piecewiseyieldcurve.cpp | 192 ++++++++++++++++++++++++------------- + test-suite/piecewiseyieldcurve.hpp | 2 + + 2 files changed, 126 insertions(+), 68 deletions(-) - ql/indexes/inflationindex.hpp | 2 ++ - test-suite/inflationcpibond.cpp | 4 ++++ - test-suite/inflationcpicapfloor.cpp | 8 ++++++++ - test-suite/inflationcpiswap.cpp | 4 ++++ - 4 files changed, 18 insertions(+) +commit 1ca515fd766afec155e4c97a4c24e2574d2c9f50 +Author: Peter Caspers +Date: Sat, 18 Mar 2023 18:02:05 +0100 -commit 38df7a95a92a1a9722832f87b3ca831bf02169e1 -Author: RalfKonrad -Date: Thu, 25 Feb 2021 19:06:07 +0100 + Update test-suite/piecewiseyieldcurve.cpp + + Co-authored-by: Luigi Ballabio - Deprecated CPICapFloorTermPriceSurface constructor because of missing CPI::InterpolationType, silently deprecated ZeroInflationIndex::isInterpolated was used. + test-suite/piecewiseyieldcurve.cpp | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) - .../inflation/cpicapfloortermpricesurface.cpp | 114 ++++--- - .../inflation/cpicapfloortermpricesurface.hpp | 338 +++++++++++++-------- - 2 files changed, 279 insertions(+), 173 deletions(-) +commit 3c7e6eba0c199a0a33d13972428d8e7e3eda1ab2 +Author: Peter Caspers +Date: Sat, 18 Mar 2023 13:04:55 +0100 -commit 5704f7d45312d969b92017fb48d21b69482cc5ad -Author: RalfKonrad -Date: Thu, 25 Feb 2021 18:46:50 +0100 + fix - Deprecated ZeroCouponInflationSwapHelper constructor because of missing CPI::InterpolationType, silently deprecated ZeroInflationIndex::isInterpolated was used. + test-suite/piecewiseyieldcurve.cpp | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) - ql/termstructures/inflation/inflationhelpers.cpp | 113 ++++++++++++----------- - ql/termstructures/inflation/inflationhelpers.hpp | 74 +++++++++------ - 2 files changed, 104 insertions(+), 83 deletions(-) +commit b441c82831d4ee3a72513199a432bcb18124bf71 +Author: Peter Caspers +Date: Sat, 18 Mar 2023 12:53:29 +0100 -commit 1445775298ca7b5bf607db2c775b7bce7b90fe8e -Author: RalfKonrad -Date: Thu, 25 Feb 2021 14:52:31 +0100 + remove utility to enable first notification on subgraph, remove observables inspector, update test case - Deprecated ZeroCouponInflationSwap constructor because of missing CPI::InterpolationType, silently deprecated ZeroInflationIndex::isInterpolated was used. + ql/patterns/lazyobject.hpp | 12 ------------ + ql/patterns/observable.hpp | 10 ---------- + test-suite/piecewiseyieldcurve.cpp | 2 +- + 3 files changed, 1 insertion(+), 23 deletions(-) - ql/instruments/zerocouponinflationswap.cpp | 48 ++++++++++++++++++++++++++---- - ql/instruments/zerocouponinflationswap.hpp | 26 ++++++++++++++++ - 2 files changed, 68 insertions(+), 6 deletions(-) +commit f1abb78a22b6a850f7105a59c1a8b71aacc5c8e7 +Author: Peter Caspers +Date: Thu, 9 Mar 2023 08:22:02 +0100 -commit c418ecd13c13899fb026f1ef21fb0dbbd4aaf9f0 -Author: RalfKonrad -Date: Thu, 25 Feb 2021 14:50:09 +0100 + expose observables for enabled thread safe observer pattern - namespace detail {...} combines calls to ZeroInflationIndex::isInterpolated() and CPI::InterpolationType to get the effective type + ql/patterns/observable.hpp | 5 +++++ + 1 file changed, 5 insertions(+) - ql/indexes/inflationindex.cpp | 15 +++++++++++++++ - ql/indexes/inflationindex.hpp | 21 +++++++++++++++++++++ - ql/instruments/cpicapfloor.cpp | 9 ++------- - 3 files changed, 38 insertions(+), 7 deletions(-) +commit be329691d02738a90c0cd2af3689a934590c3d51 +Author: Peter Caspers +Date: Thu, 9 Mar 2023 07:54:36 +0100 -commit dcb158bd3a5c1bf4b95ff0a3b15aec345e9332b6 -Author: RalfKonrad -Date: Thu, 25 Feb 2021 09:09:51 +0100 + fixes - Avoid deprecated warnings. + ql/patterns/lazyobject.hpp | 6 +++--- + test-suite/piecewiseyieldcurve.cpp | 3 +-- + 2 files changed, 4 insertions(+), 5 deletions(-) - ql/instruments/cpicapfloor.cpp | 42 +++++++++++++++++++----------------------- - 1 file changed, 19 insertions(+), 23 deletions(-) +commit 4d6a70a6f5368724e1b93df08e55c787919a847b +Author: Peter Caspers +Date: Wed, 8 Mar 2023 19:59:28 +0100 -commit 7d927a038252f506dd6e27d86558609eff12a266 -Author: RalfKonrad -Date: Thu, 25 Feb 2021 09:08:58 +0100 + fix unit test case - Moved 'CPI::InterpolationType' to 'inflationindex.hpp' as it is used together with it ZeroInflationIndex to set up coupons, instruments, termstructures etc. Therefore it avoids including 'cpicoupon.hpp' + test-suite/piecewiseyieldcurve.cpp | 4 ++++ + 1 file changed, 4 insertions(+) - ql/cashflows/cpicoupon.hpp | 24 ------------------------ - ql/indexes/inflationindex.hpp | 25 ++++++++++++++++++++++++- - 2 files changed, 24 insertions(+), 25 deletions(-) +commit 00ffe231e23b15d4d0d084f858c9f25046ab127f +Author: Peter Caspers +Date: Wed, 8 Mar 2023 19:58:51 +0100 -commit c76eaefdcac43795814b27aa1444d1c85c2c18b4 -Author: RalfKonrad -Date: Wed, 24 Feb 2021 13:19:29 +0100 + add function to enable single notification recursively - clang format first + ql/patterns/lazyobject.hpp | 12 ++++++++++++ + ql/patterns/observable.hpp | 5 +++++ + 2 files changed, 17 insertions(+) - ql/instruments/zerocouponinflationswap.cpp | 48 ++++++++++++++---------------- - ql/instruments/zerocouponinflationswap.hpp | 16 +++------- - 2 files changed, 26 insertions(+), 38 deletions(-) +commit 2fab9eda4494441f5c4c9e9058e5b66b1874cd17 +Author: Peter Caspers +Date: Tue, 7 Mar 2023 16:25:53 +0100 -commit 4798651308dffa8a6a954e57425449fdc95d28cb -Author: RalfKonrad -Date: Wed, 24 Feb 2021 13:00:18 +0100 + address Luigi's comments - Added QL_ENABLE_CPI_ASINDEX + ql/patterns/lazyobject.hpp | 11 ++++++++++- + ql/patterns/observable.hpp | 11 +++++++---- + test-suite/lazyobject.cpp | 8 +++++--- + 3 files changed, 22 insertions(+), 8 deletions(-) - ql/cashflows/cpicoupon.hpp | 65 +++++++++++++++++++++++----------------------- - 1 file changed, 33 insertions(+), 32 deletions(-) +commit d2cadf74c0b58e3b47061189fb3a7dfbab06f83f +Author: Peter Caspers +Date: Tue, 7 Mar 2023 15:34:47 +0100 -commit 2f2c33bd3c6c13ed5b83524419159f3b6fdaab7b -Author: RalfKonrad -Date: Wed, 24 Feb 2021 09:08:30 +0100 + fix - Disabled deprecated warnings. + ql/termstructures/volatility/interpolatedsmilesection.hpp | 1 + + 1 file changed, 1 insertion(+) - test-suite/inflation.cpp | 14 +++++++++++++- - test-suite/inflationcpibond.cpp | 7 +++++-- - test-suite/inflationcpicapfloor.cpp | 8 ++++++-- - test-suite/inflationcpiswap.cpp | 7 +++++-- - 4 files changed, 29 insertions(+), 7 deletions(-) +commit 8f6b5f1333ea2b8873c0305eb70e567e4d5ef547 +Author: Peter Caspers +Date: Tue, 7 Mar 2023 15:29:31 +0100 -commit 17d8f558a2f4197cc98627b88b35fcf010430cb4 -Author: RalfKonrad -Date: Wed, 24 Feb 2021 08:41:57 +0100 + fix unit test - Reverted changes + test-suite/lazyobject.cpp | 4 +--- + 1 file changed, 1 insertion(+), 3 deletions(-) - test-suite/inflation.cpp | 988 ++++++++++++++++++++---------------- - test-suite/inflationcpibond.cpp | 171 ++++--- - test-suite/inflationcpicapfloor.cpp | 395 +++++++------- - test-suite/inflationcpiswap.cpp | 432 ++++++++-------- - 4 files changed, 1088 insertions(+), 898 deletions(-) +commit 4dd582e6ca2e29d99c28ba4556a2dd4c16222c17 +Author: Peter Caspers +Date: Tue, 7 Mar 2023 15:22:24 +0100 -commit 980ba9aa65bc76307def9c933f9d0c7b4148b26b -Author: RalfKonrad -Date: Tue, 23 Feb 2021 19:10:25 +0100 + remove registerWith overwrite - Avoid deprecated warning in constructor in gcc. + ql/termstructures/volatility/capfloor/capfloortermvolsurface.hpp | 5 ----- + 1 file changed, 5 deletions(-) - ql/indexes/inflationindex.cpp | 14 +++++++++----- - 1 file changed, 9 insertions(+), 5 deletions(-) +commit f6e4715bca5b7ace570c0f3778fb95c68e4e0c6d +Author: Peter Caspers +Date: Tue, 7 Mar 2023 15:20:24 +0100 -commit 7fa0566f793eddb6bfa2c2a36c3b2e02f8848217 -Author: RalfKonrad -Date: Tue, 23 Feb 2021 14:51:06 +0100 + Revert "second attempt to avoid msvc warning c4250" + + This reverts commit b4250ad5815f0f61de06cf6dbe0d782879e60166. - Override YoYInflationIndex::interpolated_; + ql/patterns/lazyobject.hpp | 46 +++++++++++++--------------------------------- + 1 file changed, 13 insertions(+), 33 deletions(-) - ql/indexes/inflationindex.cpp | 3 --- - ql/indexes/inflationindex.hpp | 10 +++++----- - 2 files changed, 5 insertions(+), 8 deletions(-) +commit 3ec0dd43dc1a795524f3ac6736e11b20940c48ea +Author: Peter Caspers +Date: Tue, 7 Mar 2023 15:10:05 +0100 -commit f06626f2e01ab2613f07f7259a4c711621c0f730 -Author: RalfKonrad -Date: Tue, 23 Feb 2021 14:41:29 +0100 + Revert "fix msvc warning c4250" + + This reverts commit 6f91089cb53d389c33d8cdeb5c97408ac11c6bd0. + + ql/experimental/volatility/abcdatmvolcurve.hpp | 10 ---------- + .../volatility/noarbsabrinterpolatedsmilesection.hpp | 9 --------- + ql/experimental/volatility/sviinterpolatedsmilesection.hpp | 10 ---------- + ql/models/shortrate/onefactormodels/gsr.hpp | 5 ----- + ql/models/shortrate/onefactormodels/markovfunctional.hpp | 5 ----- + ql/termstructures/volatility/capfloor/capfloortermvolcurve.hpp | 9 --------- + ql/termstructures/volatility/interpolatedsmilesection.hpp | 8 -------- + .../volatility/optionlet/strippedoptionletadapter.hpp | 10 ---------- + ql/termstructures/volatility/sabrinterpolatedsmilesection.hpp | 9 --------- + ql/termstructures/volatility/swaption/swaptionvolcube.hpp | 10 ---------- + ql/termstructures/volatility/swaption/swaptionvoldiscrete.hpp | 7 ------- + ql/termstructures/volatility/swaption/swaptionvolmatrix.hpp | 10 ---------- + ql/termstructures/yield/flatforward.hpp | 6 ------ + 13 files changed, 108 deletions(-) + +commit 70ec6d5ee84926f3a65c4ed31f8b421d47c85cc1 +Author: Peter Caspers +Date: Tue, 7 Mar 2023 15:08:58 +0100 - Initializing and deprecated does not fit together. + Revert "fix warning c4250" + + This reverts commit 31bd92d6be307462701ef81288cb30b011058a2a. - ql/indexes/inflationindex.cpp | 4 ++++ - ql/indexes/inflationindex.hpp | 2 +- - 2 files changed, 5 insertions(+), 1 deletion(-) + ql/termstructures/yield/fittedbonddiscountcurve.hpp | 7 ------- + 1 file changed, 7 deletions(-) -commit f7c53f2bca4cf77c0485a81c422d31131a42fa71 -Author: RalfKonrad -Date: Tue, 23 Feb 2021 13:52:08 +0100 +commit 19386b9ea5bd802a3a5d5383878505a51430a404 +Author: Peter Caspers +Date: Tue, 7 Mar 2023 15:08:56 +0100 - Added QL_DEPRECATED_[DIS|EN]ABLE_WARNING_III_INTERPOLATED_METHOD + Revert "avoid warning c4250" + + This reverts commit 8ff6d49d345e8e67ad9989460a543c52719195c7. - ql/indexes/inflationindex.hpp | 9 +++++++++ - 1 file changed, 9 insertions(+) + ql/termstructures/defaulttermstructure.hpp | 6 ------ + ql/termstructures/inflation/piecewisezeroinflationcurve.hpp | 6 ------ + ql/termstructures/yield/piecewiseyieldcurve.hpp | 6 ------ + 3 files changed, 18 deletions(-) -commit f267c0927be1a307caff1723fca76b408fae9c76 -Author: RalfKonrad -Date: Tue, 23 Feb 2021 12:50:47 +0100 - - Deprecated protected member bool InflationIndex::interpolated_; - - ql/experimental/inflation/genericindexes.hpp | 2 ++ - ql/indexes/inflation/aucpi.hpp | 2 ++ - ql/indexes/inflation/euhicp.hpp | 4 ++++ - ql/indexes/inflation/frhicp.hpp | 2 ++ - ql/indexes/inflation/ukrpi.hpp | 2 ++ - ql/indexes/inflation/uscpi.hpp | 2 ++ - ql/indexes/inflation/zacpi.hpp | 4 +++- - ql/indexes/inflationindex.cpp | 27 +++++++++++++++++++------- - ql/indexes/inflationindex.hpp | 29 ++++++++++++++++++++++------ - 9 files changed, 60 insertions(+), 14 deletions(-) - -commit 96b52d716591017715883075a975d7d2c5b6cbb6 -Author: RalfKonrad -Date: Tue, 23 Feb 2021 10:30:11 +0100 +commit e9da2d5e8fd49895d6eca7b573e771fa6e561c18 +Author: Peter Caspers +Date: Tue, 7 Mar 2023 15:08:54 +0100 - try to fix mac os boost::make_shared deprecated error + Revert "more fixes" + + This reverts commit 686062ecf411274a8b488060f02a5d1f81ce5cf9. - test-suite/inflation.cpp | 24 ++++++++++++------------ - test-suite/inflationcpibond.cpp | 4 ++-- - test-suite/inflationcpicapfloor.cpp | 6 +++--- - test-suite/inflationcpiswap.cpp | 6 +++--- - 4 files changed, 20 insertions(+), 20 deletions(-) + ql/termstructures/credit/piecewisedefaultcurve.hpp | 9 +-------- + ql/termstructures/defaulttermstructure.hpp | 4 ++-- + ql/termstructures/inflation/piecewisezeroinflationcurve.hpp | 3 +-- + ql/termstructures/yield/piecewiseyieldcurve.hpp | 3 +-- + 4 files changed, 5 insertions(+), 14 deletions(-) -commit b20ed20fd60e7c00becfb2495c44f0d965b6ca2e -Author: RalfKonrad -Date: Tue, 23 Feb 2021 10:27:55 +0100 +commit 464800bf0d26b7e4cac27eb876310cec3094f643 +Author: Peter Caspers +Date: Tue, 7 Mar 2023 15:08:45 +0100 - Renamed macro + Revert "avoid c4250" + + This reverts commit 64a72ead06acc925e3f448881f63a78a2a9fb808. - ql/indexes/inflationindex.hpp | 31 ++++++++++++++++++------------- - 1 file changed, 18 insertions(+), 13 deletions(-) + ql/experimental/inflation/piecewiseyoyoptionletvolatility.hpp | 7 ------- + ql/termstructures/inflation/piecewiseyoyinflationcurve.hpp | 7 ------- + 2 files changed, 14 deletions(-) -commit 163bd0e223e77a9a26855af160c63529747e45cd -Author: RalfKonrad -Date: Tue, 23 Feb 2021 10:05:49 +0100 +commit 537ea232ec383bcba469ad9898fb05ce3cb44bde +Author: Peter Caspers +Date: Tue, 7 Mar 2023 15:08:33 +0100 - try to fix macos boost::make_shared deprecated error + Revert "avoid warning C4250 "inherits via dominance"" + + This reverts commit 623a9ae9df697ec85eadd46109b17a512427de92. - test-suite/inflationcpibond.cpp | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) + ql/termstructures/volatility/capfloor/capfloortermvolsurface.hpp | 5 ----- + 1 file changed, 5 deletions(-) -commit 1d6330ea4e80e962a21e767eb11089dc3a1b9557 -Author: RalfKonrad -Date: Mon, 22 Feb 2021 20:16:59 +0100 +commit 812d8ca9d593a220022bd0eaa728f5bf3f84cb73 +Author: jakeheke75 +Date: Thu, 23 Feb 2023 00:26:57 +0100 - ..._SKIP_WARNING(CODE) macro does not work with gcc, only with clang and vs c++ + Fixes the AppVeyor build failed - ql/indexes/inflationindex.hpp | 11 +++-------- - test-suite/inflation.cpp | 25 +++++++++++++++++++------ - test-suite/inflationcpibond.cpp | 4 +++- - test-suite/inflationcpicapfloor.cpp | 4 +++- - test-suite/inflationcpiswap.cpp | 4 +++- - 5 files changed, 31 insertions(+), 17 deletions(-) + ql/instruments/forwardrateagreement.cpp | 4 ++-- + ql/instruments/forwardrateagreement.hpp | 4 ++-- + 2 files changed, 4 insertions(+), 4 deletions(-) -commit dc0b74af647d30a8493ffd2e66e86bcaeb575187 -Author: RalfKonrad -Date: Mon, 22 Feb 2021 19:31:02 +0100 +commit afef8765edabc095b07854c880c3e4e9660c64b6 +Author: jakeheke75 +Date: Wed, 22 Feb 2023 21:37:14 +0100 - Fixed QL_DEPRECATED_SKIP_WARNING_[] macros + ForwardRateAgreement constructor fix + Fixed the deprecated constructor + Removed the deprecated constructor from the test suite - ql/indexes/inflationindex.hpp | 4 ++-- - 1 file changed, 2 insertions(+), 2 deletions(-) + ql/instruments/forwardrateagreement.cpp | 21 +++++++++++++++++++-- + ql/instruments/forwardrateagreement.hpp | 5 +++-- + test-suite/forwardrateagreement.cpp | 1 - + test-suite/piecewiseyieldcurve.cpp | 17 ++++------------- + 4 files changed, 26 insertions(+), 18 deletions(-) -commit 9e25143862e2ced63a67c051a35dc686dd6de07e -Author: RalfKonrad -Date: Mon, 22 Feb 2021 19:07:08 +0100 +commit 87ee176a4d58ee89ba65ddd072d459f5a57d79a2 +Author: jakeheke75 +Date: Sun, 19 Feb 2023 14:13:10 +0100 - try QL_DEPRECATED_SKIP_WARNING_[] macros + 1) Fixed intializer list + 2) New ctor with Handle - test-suite/inflation.cpp | 12 ++++++------ - test-suite/inflationcpibond.cpp | 2 +- - test-suite/inflationcpicapfloor.cpp | 2 +- - test-suite/inflationcpiswap.cpp | 2 +- - 4 files changed, 9 insertions(+), 9 deletions(-) + ql/instruments/forwardrateagreement.cpp | 84 ++++++++++----------------------- + ql/instruments/forwardrateagreement.hpp | 44 +++++------------ + 2 files changed, 37 insertions(+), 91 deletions(-) -commit 58d6db7ef9b49b7b7ebcf480add2b50d63194110 -Author: RalfKonrad -Date: Mon, 22 Feb 2021 19:06:27 +0100 +commit 64a72ead06acc925e3f448881f63a78a2a9fb808 +Author: Peter Caspers +Date: Sun, 12 Feb 2023 15:12:17 +0100 - Added QL_DEPRECATED_SKIP_WARNING_[] macros + avoid c4250 - ql/indexes/inflationindex.hpp | 5 ++--- - 1 file changed, 2 insertions(+), 3 deletions(-) + ql/experimental/inflation/piecewiseyoyoptionletvolatility.hpp | 7 +++++++ + ql/termstructures/inflation/piecewiseyoyinflationcurve.hpp | 7 +++++++ + 2 files changed, 14 insertions(+) -commit a98df48aad5615932c54831ff79bc91db9dadda5 -Author: RalfKonrad -Date: Mon, 22 Feb 2021 18:56:53 +0100 +commit ecf19c87302e6207a85c81debfa6ef7f2ba25566 +Author: jakeheke75 +Date: Sun, 12 Feb 2023 01:03:23 +0100 - clang format first + forwardrateagreement ctor enhancements fixes #154 - test-suite/inflation.cpp | 975 ++++++++++++++++-------------------- - test-suite/inflationcpibond.cpp | 165 +++--- - test-suite/inflationcpicapfloor.cpp | 391 +++++++-------- - test-suite/inflationcpiswap.cpp | 428 ++++++++-------- - 4 files changed, 875 insertions(+), 1084 deletions(-) + ql/instruments/forwardrateagreement.cpp | 88 ++++++++++++++++++++++++++++++--- + ql/instruments/forwardrateagreement.hpp | 46 +++++++++++++++++ + 2 files changed, 128 insertions(+), 6 deletions(-) -commit fb7b2b10e8a4129d586406d5b5bc15c197df3949 -Author: RalfKonrad -Date: Mon, 22 Feb 2021 18:40:53 +0100 +commit 686062ecf411274a8b488060f02a5d1f81ce5cf9 +Author: Peter Caspers +Date: Sat, 11 Feb 2023 18:19:18 +0100 - Added QL_DEPRECATED_SKIP_WARNING_[] macros + more fixes - ql/indexes/inflationindex.hpp | 43 ++++++++++++++++++++++++++++++++++++++++++- - 1 file changed, 42 insertions(+), 1 deletion(-) + ql/termstructures/credit/piecewisedefaultcurve.hpp | 9 ++++++++- + ql/termstructures/defaulttermstructure.hpp | 4 ++-- + ql/termstructures/inflation/piecewisezeroinflationcurve.hpp | 3 ++- + ql/termstructures/yield/piecewiseyieldcurve.hpp | 3 ++- + 4 files changed, 14 insertions(+), 5 deletions(-) -commit 14dc6d75ca1e5c5d5b934f3df12ea43805f39800 -Author: RalfKonrad -Date: Sun, 21 Feb 2021 21:39:23 +0100 +commit 8ff6d49d345e8e67ad9989460a543c52719195c7 +Author: Peter Caspers +Date: Sat, 11 Feb 2023 12:03:15 +0100 - Do not inline interpolated(); to avoid deprecated warning on deprected interpolation_ + avoid warning c4250 - ql/indexes/inflationindex.cpp | 5 ++++- - ql/indexes/inflationindex.hpp | 8 ++++---- - 2 files changed, 8 insertions(+), 5 deletions(-) + ql/termstructures/defaulttermstructure.hpp | 6 ++++++ + ql/termstructures/inflation/piecewisezeroinflationcurve.hpp | 6 ++++++ + ql/termstructures/yield/piecewiseyieldcurve.hpp | 6 ++++++ + 3 files changed, 18 insertions(+) -commit f0f760684d0dd1a32dd69629fb7785129613da57 -Author: RalfKonrad -Date: Sun, 21 Feb 2021 21:09:13 +0100 - - Renamed QL_TO_BE_DEPRECATED_INTERPOLATED_INFLATION_INDEXES - - ql/experimental/inflation/genericindexes.hpp | 2 +- - ql/indexes/inflation/aucpi.hpp | 2 +- - ql/indexes/inflation/euhicp.hpp | 4 ++-- - ql/indexes/inflation/frhicp.hpp | 2 +- - ql/indexes/inflation/ukrpi.hpp | 2 +- - ql/indexes/inflation/uscpi.hpp | 2 +- - ql/indexes/inflation/zacpi.hpp | 2 +- - ql/indexes/inflationindex.hpp | 30 +++++++++++++++++++++++----- - 8 files changed, 33 insertions(+), 13 deletions(-) - -commit 02c999929f3c74e090efbb829645b568c9577bca -Merge: 26560c4a3 3eec5b893 -Author: Ralf Konrad <42419984+ralfkonrad@users.noreply.github.com> -Date: Sun, 21 Feb 2021 18:50:59 +0100 +commit 31bd92d6be307462701ef81288cb30b011058a2a +Author: Peter Caspers +Date: Sat, 11 Feb 2023 10:23:43 +0100 - Merge pull request #43 from ralfkonrad/update-copyright-list-refs/heads/feature/issue_1050__deprecate_inflation-index_interpolation - - Update copyright list in license + fix warning c4250 -commit 3eec5b893af99e156a56623ba52f965567cf85ec -Author: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> -Date: Sun, 21 Feb 2021 17:38:38 +0000 + ql/termstructures/yield/fittedbonddiscountcurve.hpp | 7 +++++++ + 1 file changed, 7 insertions(+) - Update copyright list in license +commit 0ce10bce7f32ebe5122c30a0e117df5afb7dc67e +Author: Peter Caspers +Date: Fri, 10 Feb 2023 18:43:31 +0100 - LICENSE.TXT | 2 ++ - 1 file changed, 2 insertions(+) + fixes -commit 26560c4a3283d79f5f918c7b2037197acf8cb9db -Author: RalfKonrad -Date: Sun, 21 Feb 2021 18:33:47 +0100 - - Rolled back changes for YoY Indexes - - ql/experimental/inflation/genericindexes.hpp | 28 +++--------------- - ql/indexes/inflation/aucpi.hpp | 18 ++---------- - ql/indexes/inflation/euhicp.hpp | 44 ++++++++++++---------------- - ql/indexes/inflation/frhicp.hpp | 16 ++-------- - ql/indexes/inflation/ukrpi.hpp | 36 +++++++++++------------ - ql/indexes/inflation/uscpi.hpp | 36 +++++++++++------------ - ql/indexes/inflation/zacpi.hpp | 36 +++++++++++------------ - ql/indexes/inflationindex.cpp | 30 +++---------------- - ql/indexes/inflationindex.hpp | 15 ---------- - 9 files changed, 85 insertions(+), 174 deletions(-) - -commit 3770516088ac300bc6e91883ac8244401daaeb5a -Merge: 16183ca67 3e5e39aff -Author: Ralf Konrad <42419984+ralfkonrad@users.noreply.github.com> -Date: Sun, 21 Feb 2021 18:11:14 +0100 + ql/termstructures/volatility/interpolatedsmilesection.hpp | 7 ++++--- + ql/termstructures/volatility/swaption/swaptionvoldiscrete.hpp | 2 +- + 2 files changed, 5 insertions(+), 4 deletions(-) - Merge pull request #42 from ralfkonrad/clang-tidy-fixes-refs/heads/feature/issue_1050__deprecate_inflation-index_interpolation - - Automated fixes by clang-tidy +commit 6f91089cb53d389c33d8cdeb5c97408ac11c6bd0 +Author: Peter Caspers +Date: Fri, 10 Feb 2023 18:41:04 +0100 + + fix msvc warning c4250 + + ql/experimental/volatility/abcdatmvolcurve.hpp | 10 ++++++++++ + .../volatility/noarbsabrinterpolatedsmilesection.hpp | 9 +++++++++ + ql/experimental/volatility/sviinterpolatedsmilesection.hpp | 10 ++++++++++ + ql/models/shortrate/onefactormodels/gsr.hpp | 5 +++++ + ql/models/shortrate/onefactormodels/markovfunctional.hpp | 5 +++++ + ql/termstructures/volatility/capfloor/capfloortermvolcurve.hpp | 9 +++++++++ + .../volatility/capfloor/capfloortermvolsurface.hpp | 3 +++ + ql/termstructures/volatility/interpolatedsmilesection.hpp | 6 ++++++ + .../volatility/optionlet/strippedoptionletadapter.hpp | 10 ++++++++++ + ql/termstructures/volatility/sabrinterpolatedsmilesection.hpp | 9 +++++++++ + ql/termstructures/volatility/swaption/swaptionvolcube.hpp | 10 ++++++++++ + ql/termstructures/volatility/swaption/swaptionvoldiscrete.hpp | 7 +++++++ + ql/termstructures/volatility/swaption/swaptionvolmatrix.hpp | 10 ++++++++++ + ql/termstructures/yield/flatforward.hpp | 6 ++++++ + 14 files changed, 109 insertions(+) + +commit b4250ad5815f0f61de06cf6dbe0d782879e60166 +Author: Peter Caspers +Date: Fri, 10 Feb 2023 14:00:22 +0100 -commit 3e5e39aff547c34080d0c0237b2d606f561f7eb5 -Author: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> -Date: Sun, 21 Feb 2021 00:42:15 +0000 + second attempt to avoid msvc warning c4250 - Automated fixes by clang-tidy + ql/termstructures/volatility/capfloor/capfloortermvolsurface.hpp | 8 +++++++- + 1 file changed, 7 insertions(+), 1 deletion(-) - ql/indexes/inflationindex.cpp | 26 +++++++++++++++++++++----- - 1 file changed, 21 insertions(+), 5 deletions(-) +commit 623a9ae9df697ec85eadd46109b17a512427de92 +Author: Peter Caspers +Date: Fri, 10 Feb 2023 10:20:03 +0100 -commit 16183ca67e70e0979fa16825c62e3146424360ea -Author: RalfKonrad -Date: Sat, 20 Feb 2021 22:12:46 +0100 + avoid warning C4250 "inherits via dominance" - QL_TO_BE_DEPRECATED_INTERPOLATED_YOY_INDEXES: enable deprecation of YoY seperately. + ql/termstructures/volatility/capfloor/capfloortermvolsurface.hpp | 1 + + 1 file changed, 1 insertion(+) - ql/experimental/inflation/genericindexes.hpp | 4 ++-- - ql/indexes/inflation/aucpi.hpp | 4 ++-- - ql/indexes/inflation/euhicp.hpp | 6 +++--- - ql/indexes/inflation/frhicp.hpp | 4 ++-- - ql/indexes/inflation/ukrpi.hpp | 4 ++-- - ql/indexes/inflation/uscpi.hpp | 4 ++-- - ql/indexes/inflation/zacpi.hpp | 4 ++-- - ql/indexes/inflationindex.hpp | 6 +++++- - 8 files changed, 20 insertions(+), 16 deletions(-) +commit 94a1a78886d95b99f61730e962872afde32b92ea +Author: klausspanderen +Date: Tue, 31 Jan 2023 21:36:02 +0100 -commit 2cf5eb043b06948cb06cd24fdd981ad98a9ffbdc -Author: RalfKonrad -Date: Sat, 20 Feb 2021 20:56:26 +0100 + Revert "moved expm from experimental to main" + + This reverts commit f88537b3d3021692c5cf6afbb6ae095560aeef6d. + + QuantLib.vcxproj | 4 ++-- + QuantLib.vcxproj.filters | 12 ++++++------ + ql/CMakeLists.txt | 4 ++-- + ql/experimental/math/Makefile.am | 2 ++ + ql/{math/matrixutilities => experimental/math}/expm.cpp | 2 +- + ql/{math/matrixutilities => experimental/math}/expm.hpp | 0 + ql/math/matrixutilities/Makefile.am | 2 -- + test-suite/ode.cpp | 2 +- + 8 files changed, 14 insertions(+), 14 deletions(-) + +commit f88537b3d3021692c5cf6afbb6ae095560aeef6d +Author: klausspanderen +Date: Mon, 30 Jan 2023 22:09:07 +0100 - Forgotten QL_TO_BE_DEPRECATED_INTERPOLATED_INFLATION_INDEXES + moved expm from experimental to main - ql/indexes/inflationindex.hpp | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) + QuantLib.vcxproj | 4 ++-- + QuantLib.vcxproj.filters | 12 ++++++------ + ql/CMakeLists.txt | 4 ++-- + ql/experimental/math/Makefile.am | 2 -- + ql/math/matrixutilities/Makefile.am | 2 ++ + ql/{experimental/math => math/matrixutilities}/expm.cpp | 2 +- + ql/{experimental/math => math/matrixutilities}/expm.hpp | 0 + test-suite/ode.cpp | 2 +- + 8 files changed, 14 insertions(+), 14 deletions(-) -commit c44f67f1842edf3e4d54dae3fd8012641d960b4f -Author: RalfKonrad -Date: Sat, 20 Feb 2021 20:51:04 +0100 +commit 01d87f5d27f56e41ad7687dc9a8f2b52460ed751 +Author: Peter Caspers +Date: Wed, 25 Jan 2023 19:38:17 +0100 - Added copyright + use ext instead of boost, missing include - ql/experimental/inflation/genericindexes.hpp | 1 + - 1 file changed, 1 insertion(+) + ql/patterns/lazyobject.hpp | 3 ++- + 1 file changed, 2 insertions(+), 1 deletion(-) -commit 6c518bb6b9af343b25ea19ba3fd2256b14f89423 -Author: RalfKonrad -Date: Sat, 20 Feb 2021 20:48:11 +0100 +commit 8bdbaf3e37a7b1caee62675f3fddbd78b067e4c4 +Author: Peter Caspers +Date: Wed, 25 Jan 2023 16:16:32 +0100 + + always forward notifications from a lazy object when another lazy object registers with it + + ql/cashflows/capflooredcoupon.cpp | 5 ----- + ql/cashflows/capflooredcoupon.hpp | 1 - + ql/cashflows/digitalcoupon.cpp | 7 ------- + ql/cashflows/digitalcoupon.hpp | 1 - + ql/experimental/coupons/strippedcapflooredcoupon.cpp | 1 - + ql/instruments/bond.cpp | 9 --------- + ql/instruments/bond.hpp | 4 ---- + ql/instruments/compositeinstrument.cpp | 9 --------- + ql/instruments/floatfloatswaption.cpp | 1 - + ql/instruments/nonstandardswaption.cpp | 1 - + ql/instruments/swap.cpp | 10 ---------- + ql/instruments/swap.hpp | 4 ---- + ql/instruments/swaption.cpp | 2 -- + ql/patterns/lazyobject.hpp | 8 ++++++++ + ql/patterns/observable.hpp | 4 ++-- + 15 files changed, 10 insertions(+), 57 deletions(-) + +commit 99ba9dbb45d31c5158f7f2ac05b5b3b4140a39d6 +Author: Peter Caspers +Date: Sun, 22 Jan 2023 18:00:40 +0100 - Reoved QL_DEPRECATED to test... + forgot to update this one - ql/indexes/inflationindex.hpp | 2 +- + ql/termstructures/yield/oisratehelper.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) -commit 282de037ca03a00eb2d33d6f507c50c181b9014c -Author: RalfKonrad -Date: Sat, 20 Feb 2021 20:44:50 +0100 - - Add new constructors - - ql/experimental/inflation/genericindexes.hpp | 42 ++++++++++++++++++++++++---- - 1 file changed, 36 insertions(+), 6 deletions(-) - -commit c46fbabd5cf7d98f07b5708e943e910b3c71af87 -Author: RalfKonrad -Date: Sat, 20 Feb 2021 20:35:12 +0100 - - clang format first - - ql/experimental/inflation/genericindexes.hpp | 78 ++++++++++------------------ - 1 file changed, 28 insertions(+), 50 deletions(-) - -commit 1dc88c3babcce0d37e29c77eca68387e5a868e0f -Author: RalfKonrad -Date: Sat, 20 Feb 2021 20:33:11 +0100 +commit 17914a4260a9ba03e0987eb91b4b191bf4f312ca +Author: Peter Caspers +Date: Sun, 22 Jan 2023 16:34:44 +0100 - renamed to QL_TO_BE_DEPRECATED_INTERPOLATED_INFLATION_INDEXES + update new basis swap rate helper to use deepUpdate() instead of recalculate - ql/indexes/inflation/aucpi.hpp | 6 +++--- - ql/indexes/inflation/euhicp.hpp | 10 +++++----- - ql/indexes/inflation/frhicp.hpp | 6 +++--- - ql/indexes/inflation/ukrpi.hpp | 6 +++--- - ql/indexes/inflation/uscpi.hpp | 6 +++--- - ql/indexes/inflation/zacpi.hpp | 6 +++--- - ql/indexes/inflationindex.hpp | 8 ++++---- - 7 files changed, 24 insertions(+), 24 deletions(-) + ql/experimental/termstructures/basisswapratehelpers.cpp | 6 ++---- + 1 file changed, 2 insertions(+), 4 deletions(-) -commit 2180a56f72f66d57ce0e175406a861e08a040b33 -Author: RalfKonrad -Date: Sat, 20 Feb 2021 19:47:09 +0100 +commit 92807d1f3401b895b03ec5718be596c17310063d +Author: HristoRaykov +Date: Wed, 2 Nov 2022 12:26:00 +0200 - Wrong copyright year + callable bond frequency issue lballabio/QuantLib#928 fixed proposed by @OleBueker - ql/indexes/inflation/aucpi.hpp | 2 +- - ql/indexes/inflation/euhicp.hpp | 2 +- - ql/indexes/inflation/frhicp.hpp | 2 +- - ql/indexes/inflation/ukrpi.hpp | 2 +- - ql/indexes/inflation/uscpi.hpp | 2 +- - ql/indexes/inflation/zacpi.hpp | 2 +- - ql/indexes/inflationindex.cpp | 2 +- - ql/indexes/inflationindex.hpp | 2 +- - 8 files changed, 8 insertions(+), 8 deletions(-) + ql/experimental/callablebonds/callablebond.cpp | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) -commit 3d5faeddfa897e70bba0a54152be5fba48616f3e -Author: RalfKonrad -Date: Sat, 20 Feb 2021 18:13:31 +0100 +commit 1919fd841ac9e7bfd4eef77db099d083b5ec6777 +Author: HristoRaykov +Date: Tue, 1 Nov 2022 17:15:24 +0200 - Add new constructors + schedule tests corrected - ql/indexes/inflation/aucpi.hpp | 36 ++++++++++++++++++-------- - ql/indexes/inflation/euhicp.hpp | 56 +++++++++++++++++++++++++---------------- - ql/indexes/inflation/frhicp.hpp | 31 +++++++++++++++-------- - ql/indexes/inflation/ukrpi.hpp | 51 ++++++++++++++++++------------------- - ql/indexes/inflation/uscpi.hpp | 42 +++++++++++++++++-------------- - ql/indexes/inflation/zacpi.hpp | 51 ++++++++++++++++++------------------- - 6 files changed, 154 insertions(+), 113 deletions(-) + ql/time/schedule.cpp | 18 ------------------ + test-suite/schedule.cpp | 33 +++++++++------------------------ + 2 files changed, 9 insertions(+), 42 deletions(-) -commit 39c011c6b0df7ddf2ae0fdc426ce55d1cfbe02dc -Author: RalfKonrad -Date: Sat, 20 Feb 2021 17:38:28 +0100 +commit 7e6b39da6939e8f3849d34884ccc7e6dea276f44 +Author: HristoRaykov +Date: Tue, 1 Nov 2022 16:16:19 +0200 - Add new constructors + EOM adjustment removed for effective and termination date - ql/indexes/inflationindex.cpp | 63 +++++++++++++++++++++++++++++++++++-------- - ql/indexes/inflationindex.hpp | 33 ++++++++++++++++++++++- - 2 files changed, 84 insertions(+), 12 deletions(-) + ql/time/schedule.cpp | 38 ++++++++++++++++++++++---------------- + test-suite/schedule.cpp | 11 ++++++----- + 2 files changed, 28 insertions(+), 21 deletions(-) -commit 6c92a1373160f3dbd110cec596da69931c069d77 -Author: RalfKonrad -Date: Fri, 19 Feb 2021 18:24:09 +0100 +commit 0d82b813a8e2e96944f8b06187721f04795d8e6c +Author: HristoRaykov +Date: Tue, 1 Nov 2022 15:57:38 +0200 - Deprecated old constructors + schedule tests added - ql/indexes/inflation/aucpi.hpp | 3 +++ - ql/indexes/inflation/euhicp.hpp | 24 ++++++++++++++++-------- - ql/indexes/inflation/frhicp.hpp | 18 ++++++++++++------ - ql/indexes/inflation/ukrpi.hpp | 18 ++++++++++++------ - ql/indexes/inflation/uscpi.hpp | 18 ++++++++++++------ - ql/indexes/inflation/zacpi.hpp | 18 ++++++++++++------ - ql/indexes/inflationindex.hpp | 14 +++++++++++++- - 7 files changed, 80 insertions(+), 33 deletions(-) + test-suite/schedule.cpp | 50 +++++++++++++++++++++++++++++++++++++++++++++++++ + test-suite/schedule.hpp | 2 ++ + 2 files changed, 52 insertions(+) -commit 3b2de2ebf88790b89e24510c884ba58d17c7546d -Author: RalfKonrad -Date: Fri, 19 Feb 2021 17:50:15 +0100 - - clang format first - - ql/indexes/inflation/aucpi.hpp | 12 ++-- - ql/indexes/inflation/euhicp.hpp | 23 +++---- - ql/indexes/inflation/frhicp.hpp | 12 ++-- - ql/indexes/inflation/ukrpi.hpp | 11 ++- - ql/indexes/inflation/uscpi.hpp | 17 ++--- - ql/indexes/inflation/zacpi.hpp | 11 ++- - ql/indexes/inflationindex.cpp | 149 ++++++++++++++++++---------------------- - ql/indexes/inflationindex.hpp | 55 +++++---------- - 8 files changed, 116 insertions(+), 174 deletions(-) +commit 00a0ad93ed4c6797a73d8a9a9a18e21578a5f6f4 +Author: Peter Caspers +Date: Wed, 3 Nov 2021 17:53:24 +0100 + + make floating rate coupons lazy + + ql/cashflows/capflooredcoupon.cpp | 25 ++++++++++---- + ql/cashflows/capflooredcoupon.hpp | 13 +++++--- + ql/cashflows/digitalcoupon.cpp | 38 +++++++++++++++------- + ql/cashflows/digitalcoupon.hpp | 13 +++++--- + ql/cashflows/floatingratecoupon.cpp | 7 +++- + ql/cashflows/floatingratecoupon.hpp | 14 ++++---- + ql/event.hpp | 2 +- + .../coupons/strippedcapflooredcoupon.cpp | 21 ++++++++---- + .../coupons/strippedcapflooredcoupon.hpp | 12 +++++-- + ql/instruments/bond.cpp | 15 +++++++-- + ql/instruments/bond.hpp | 4 +++ + ql/instruments/capfloor.cpp | 5 ++- + ql/instruments/floatfloatswaption.cpp | 2 +- + ql/instruments/nonstandardswaption.cpp | 2 +- + ql/instruments/swap.cpp | 16 ++++++--- + ql/instruments/swap.hpp | 4 +++ + ql/instruments/swaption.cpp | 8 ++++- + ql/instruments/swaption.hpp | 4 +++ + ql/patterns/lazyobject.hpp | 8 ++++- + ql/patterns/observable.hpp | 8 +++-- + ql/termstructures/yield/oisratehelper.cpp | 2 +- + ql/termstructures/yield/ratehelpers.cpp | 4 +-- + 22 files changed, 162 insertions(+), 65 deletions(-) diff --git a/Contributors.txt b/Contributors.txt index f5d98862c72..92799f20f15 100644 --- a/Contributors.txt +++ b/Contributors.txt @@ -63,6 +63,7 @@ Mike DelMedico, Barry Devlin, Nicolas Di Césaré, Piter Dias, +Binrui Dong, Michael von den Driesch, Francis Duffy, Cristina Duminuco, @@ -80,6 +81,7 @@ Neil Firth, Stefano Fondi, Chiara Fornarola, Silvia Frasson, +Rémy Frèrebeau, Andreas Gaida, Matteo Gallivanoni, Jose Garcia, @@ -103,6 +105,7 @@ Cavit Hafizoglu, Lew Wei Hao, Joshua Hayes, Michael Heckl, +Jake Heke, Andres Hernandez, Chris Higgs, Laurent Hoffmann, @@ -142,6 +145,7 @@ Yan Kuang, Werner Kuerzinger, Oleg Kulkov, Allen Kuo, +Christian Köhnenkamp, Mickael Anas Laaouini, Paul Laderoute, Yasmine Lahlou, @@ -163,6 +167,7 @@ André Louw, Benson Luk, Matthias Lungwitz, Jasen Mackie, +Trent Maetzold, Andrea Maffezzoli, Joao Paulo Magalhaes, Jose Magana, @@ -197,6 +202,7 @@ Mike Parker, Giorgio Pazmandi, Guillaume Pealat, Gilbert Peffer, +Andrea Pellegatta, Walter Penschke, Francesco Perissin, Robert Philipp, @@ -213,6 +219,7 @@ Alexandre Radicchi, J. Erik Radmall, Ilyas Rahbaoui, Fabio Ramponi, +Hristo Raykov, Maria Cristina Recchioni, Simon Rees, Dimitri Reiswich, @@ -240,6 +247,7 @@ Michael Sharpe, Kirill Shemyakin, Eugene Shevkoplyas, Mohammad Shojatalab, +Anastasiia Shumyk, Piotr Siejda, Matthias Siemering, Adityakumar Sinha, @@ -264,6 +272,7 @@ Eisuke Tani, Marco Tarenghi, Ryan Taylor, Yue Tian, +Eugene Toder, Steven Van Haren, Jayanth R. Varma, François du Vignaud, diff --git a/Docs/Makefile.am b/Docs/Makefile.am index e2c1511de78..aa560d2885f 100644 --- a/Docs/Makefile.am +++ b/Docs/Makefile.am @@ -10,7 +10,7 @@ DOXYGEN_CUSTOM := quantlibextra.css quantlibheader.html quantlibfooter.html DOXYGEN_INPUT := $(shell find ${top_srcdir} -name *.hpp) \ $(wildcard pages/*.docs) -BASEPATH = @abs_top_srcdir@ +BASEPATH = $(shell cd @abs_top_srcdir@ && pwd) .PHONY: docs docs-clean diff --git a/Docs/pages/config.docs b/Docs/pages/config.docs index cf1b19ee73a..899e6b375f7 100644 --- a/Docs/pages/config.docs +++ b/Docs/pages/config.docs @@ -95,10 +95,31 @@ resolution down to microseconds. Strictly monotone daycounters (`Actual360`, `Actual365Fixed` and `ActualActual`) will take the additional information into account and allow for accurate - intraday pricing. If disabled (the default) the smallest + intraday pricing. If undefined (the default) the smallest resolution of date objects is a single day. Intraday datetime resolution is experimental. + \code + #define QL_THROW_IN_CYCLES + \endcode + If defined, lazy objects will raise an exception when they detect + a notification cycle which would result in an infinite recursion + loop. If undefined (the default), they will break the recursion + without throwing. Enabling this option is recommended but might + cause existing code to throw. + + \code + #define QL_FASTER_LAZY_OBJECTS + \endcode + If defined (the default), lazy objects will forward the first + notification received, and discard the others until recalculated; + the rationale is that observers were already notified, and don't + need further notifications until they recalculate, at which point + this object would be recalculated too. After recalculation, this + object would again forward the first notification received. + Although not always correct, this behavior is a lot faster and + thus is the current default. + \code #define QL_USE_STD_SHARED_PTR \endcode @@ -110,16 +131,30 @@ \code #define QL_USE_STD_FUNCTION \endcode - If defined, `std::function`, `std::bind` and related classes and functions - are used instead of `boost::function` and `boost::bind`. If disabled (the - default) the Boost facilities are used. + If defined (the default), `std::function`, `std::bind` and related + classes and functions are used. If disabled, the corresponding + Boost facilities are used instead. \code #define QL_USE_STD_TUPLE \endcode - If defined, `std::tuple` and related classes and functions - are used instead of `boost::tuple`. If disabled (the - default) the Boost facilities are used. + If defined (the default), `std::tuple` and related classes and + functions are used. If disabled, the corresponding Boost + facilities are used instead.. + + \code + #define QL_USE_STD_ANY + \endcode + If enabled, `std::any` and related classes and functions will be + used instead of `boost::any`. This requires C++17. If disabled + (the default) the Boost facilities are used. + + \code + #define QL_USE_STD_OPTIONAL + \endcode + If enabled, `std::optional` and related classes and functions will + be used instead of `boost::optional`. This requires C++17. If + disabled (the default) the Boost facilities are used. \code #define QL_NULL_AS_FUNCTIONS diff --git a/Docs/pages/history.docs b/Docs/pages/history.docs index 608c18e889a..ac5f3336e32 100644 --- a/Docs/pages/history.docs +++ b/Docs/pages/history.docs @@ -17,7 +17,277 @@ /*! \page history Version history - Release 1.29 - January 2023 + Release 1.31.1 - July 2023 + + QuantLib 1.31.1 is a bug-fix release for QuantLib 1.31. + + It fixes a regression that could cause a segmentation fault when + bootstrapping an interest-rate curve using OIS rates. + + Release 1.31 - July 18th, 2023 + + PORTABILITY + - **Future end of support:** as announced in the notes for the + previous release, after this release using `std::tuple`, + `std::function` and `std::bind` (instead of their `boost` + counterparts) will become the default. If you're using `ext::tuple` + etc. in your code (which is suggested), this should be a transparent + change. If not, you'll still be able to choose the `boost` versions + via a configure switch for a while; but we do suggest you start + using `ext::tuple` etc. in the meantime. + - The cmake build now creates (but doesn't install) a + `quantlib-config` script that can be used to retrieve flags for + compiling QuantLib-dependent projects; thanks to Christian + Köhnenkamp. + - A number of Boost classes and functions only used internally were + replaced by their standard-library equivalent; thanks to Jonathan + Sweemer. + + PATTERNS + - **Optional change of behavior:** by default, the `LazyObject` + class forwards only one notification after recalculating and + silently ignores the others. In some edge cases, this could + lead to objects not being updated. It's now possible to enable + a different behavior where all notifications are forwarded; the + new behavior can be chosen at compile time via the configure + option `--disable-faster-lazy-objects` (or disabling + `QL_FASTER_LAZY_OBJECTS` in cmake or `userconfig.hpp`) or at run + time by calling + `LazyObject::Defaults::instance().alwaysForwardNotifications()`. + This might cause a slow down, so you're invited to try it out + and report on the mailing list. If there are no problems, the + new behavior might become the default in future releases. Also, + a new configure option `--enable-throwing-in-cycles` + (`QL_THROW_IN_CYCLES` in cmake or `userconfig.hpp`) is + optionally available; when both this option and the new behavior + are enabled, notifications cycles involving a lazy object will + throw an exception. It is suggested to try enabling the option + and removing such loops, if any. Thanks to Peter Caspers for + the change and to Ralf Konrad, Jonathan Sweemer and GitHub user + `djkrystul` for feedback. + + DATE/TIME + - **Change of behavior:** when the end-of-month option is true, the + constructor of a schedule no longer adjust to the end of their month + the effective date and the termination date if they were passed + explicitly. Thanks to Hristo Raykov. + - Added separate US SOFR calendar to manage days that are business + days for the US government bond market but in which SOFR doesn't + fix; for instance, Good Friday 2023. Thanks to Tom + Anderson for reporting the issue. + - Fixed some rolling rules for South Korean calendar; thanks to Jonghee + Lee. + - Fixed incorrect 2023 holidays for Hong Kong calendar; thanks to + Fredrik Gerdin Börjesson. + - Added Hong Kong holidays for 2021-2024; thanks to Rémy Frèrebeau + and Binrui Dong. + - Added Singapore holidays for 2019-2023; thanks to Rémy Frèrebeau. + - Added Indian holidays for 2021-2025; thanks to Fredrik Gerdin + Börjesson. + - Added Taiwanese holidays for 2020-2023; thanks to GitHub user `jsmx`. + - Added a few election days for South African and South Korean + calendar; thanks to Fredrik Gerdin Börjesson. + - Updated Danish calendar; starting in 2024, General Prayer Day will + no longer be a holiday. Thanks to Fredrik Gerdin Börjesson. + - Fixed a few holidays in Finland and Singapore calendars; Thanks to + Fredrik Gerdin Börjesson. + - More day counters (Act/364, Act/365.25, Act/366) now take into + account intraday resolution when enabled; thanks to Klaus Spanderen. + + CASH FLOWS + - The accrued amount for CPI coupons is now correctly based on the + index ratio at settlement date. An inspector for retrieving the + index ratio at a given date was also added. + - Enabled the use of normal volatilities in Hagan pricer for CMS + coupons; thanks to Andre Miemiec. + - Floating-rate coupons are now lazy; thanks to Peter Caspers. + + INDEXES + - When passed a tenor of 7 or 14 business days, interest-rate indexes + would wrongly convert it to 1 or 2 weeks. This is now fixed. + Thanks to Eugene Toder for reporting the issue. + - Added DESTR and SWESTR indexes; thanks to Fredrik Gerdin Börjesson. + - Added CORRA index; thanks to GitHub user `AND2797`. + - When an YoY inflation index is calculated as a ratio, the underlying + inflation index is available through an inspector and its fixings + are used to calculate the fixing of the YoY index. + + INSTRUMENTS + - Instruments now register automatically with the global evaluation + date and are notified when it changes. This makes sense in general + (if the evaluation date changes, you probably want to recalculate) + and can also help avoid some edge cases when lazy objects only + forward their first notification. + - Allowed passing a schedule without a regular tenor to callable + fixed-rate bonds; thanks to Hristo Raykov for the + fix and to GitHub user `OleBueker` for reporting the issue. + - Reorganized the constructors of FRA instruments; thanks to Jake Heke. + + TERM STRUCTURES + - Ensures that upfront CDS helpers update correctly when the global + evaluation date changes; thanks to Andrea Pellegatta + for the fix and to GitHub user `bkhoor` for reporting the issue. + - Allow more maturities for SOFR quarterly contract in SOFR futures + rate helper; thanks to Jake Heke. + - Added constructor for date-dependent strikes to StrippedOptionlet; + thanks to Peter Caspers. + + TEST SUITE + - Global settings (such as the evaluation date) are now restored and + index fixings are now cleaned automatically at the end of each test + case, making it unnecessary to clean them up manually. Thanks to + Eugene Toder. + - The parallel unit-test runner now passes the `--run_test=` + option down to the underlying Boost.Test implementation. Thanks to + Eugene Toder. + + DEPRECATED FEATURES + - **Removed** features deprecated in version 1.26: + - The `CPICoupon` constructor taking a number of fixing days and its + `indexObservation`, `adjustedFixing` and `indexFixing(date)` methods. + - The `CPICashFlow` constructor taking a fixing date. + - The `withFixingDays` methods of `CPILeg`. + - The `ZeroInflationCashFlow` constructor taking a calendar and + business-day convention. + - The `LsmBasisSystem::PolynomType` typedef and the + `MakeMCAmericanEngine::withPolynomOrder` method. + - The `Observer::set_type` and `Observable::set_type` typedefs. + - The `Curve` class. + - The `LexicographicalView` class. + - The `Composite` class. + - The `DriftTermStructure` class. + - Deprecated the various `time_iterator` and `value_iterator` types in + `TimeSeries`, as well as methods returning them. The more general + `const_iterator` and `const_reverse_iterator` types can be used + instead. + - Deprecated the constructors of `CPICoupon` taking a spread, as well + as its `spread` method, its protected `spread_` data member, and the + `withSpreads` methods of `CPILeg`. + - Deprecated the `adjustedFixing` method and the protected `spread_` + data member of `CPICouponPricer`. + - Renamed `BlackVanillaOptionPricer` to `MarketQuotedOptionPricer` and + deprecated the old name. + - Deprecated a couple of constructors of `ForwardRateAgreement`. + - Deprecated the constructor of `YoYInflationIndex` taking a `ratio`. + Also, deprecated explicit classes for YoY ratio indexes + `YYGenericCPIr`, `YYAUCPIr`, `YYEUHICPr`, `YYFRHICPr`, `YYUKRPIr`, + `YYUSCPIr` and `YYZACPIr`. + - Deprecated the `base`, `increment`, `decrement`, `advance` and + `distance_to` methods of the `step_iterator` class. + + Thanks go also to Jonathan Sweemer, Jose Garcia, Jake Heke, Eugene + Toder, Binrui Dong, the Xcelerit Dev Team, Ralf Konrad, Tom + Anderson and Fredrik Gerdin Börjesson for a number of smaller + fixes and improvements. + + Release 1.30 - April 19th, 2023 + + PORTABILITY + - **Future end of support:** as announced in the notes for the + previous release, after this release and the next, using + `std::tuple`, `std::function` and `std::bind` (instead of their + `boost` counterparts) will become the default. If you're using + `ext::tuple` etc. in your code (which is suggested), this should be + a transparent change. If not, you'll still be able to choose the + `boost` versions via a configure switch for a while; but we do + suggest you start using `ext::tuple` etc. in the meantime. + - CMake builds now use a stricter warning level by default; thanks to + Ralf Konrad. + - Is it now possible to use `std::any` and `std::optional` (and the + related `std::any_cast` and `std::nullopt`) instead of their `boost` + counterparts by setting new compilation switches; thanks to Jonathan + Sweemer. Using the `std` classes requires C++17. We + expect the `boost` classes to remain the default for a while, but in + the meantime we encourage to start using `ext::any` and + `ext::optional` in preparation for a new default. + + DATE/TIME + - Good Friday 2023 is now a business day for the US government bond + calendar; thanks to Anastasiia Shumyk. + - Added specialized Australian calendar for ASX; thanks to Trent + Maetzold. + - Fixed Turkish holidays between 2019 and 2023; thanks to Fredrik + Gerdin Börjesson. + - Added a few missing holidays to Danish calendar; thanks to Fredrik + Gerdin Börjesson. + - Added the Matariki holiday to the New Zealand calendar; thanks to + Jake Heke. + + CASHFLOWS + - Added a new equity cash flow class to model equity legs in total + return swaps; thanks to Marcin Rybacki. Quanto + pricing is also supported. + - Added an overloaded constructor for CPI coupons that allows to + specify a base date instead of a base CPI value; thanks to Matthias + Groncki. + + INSTRUMENTS + - Added a new total-return swap; thanks to Marcin Rybacki. + An equity-index class was also added to support + this instrument. + - The analytic engine for barrier options would return NaN for low + values of volatility; this is now fixed. + - The `VanillaOption` and `BarrierOption` classes can now be used to + model vanilla and barrier options with discrete dividends; the + future dividends (not being part of the terms and conditions of the + contract) should be passed to the pricing engine instead. + - Added analytical Greeks to Bjerksund-Stensland engine; thanks to + Klaus Spanderen. + + INDEXES + - Added UKHICP inflation index; thanks to Fredrik Gerdin Börjesson. + + TERM STRUCTURES + - Renamed `SwaptionVolCube1`, `SwaptionVolCube1x`, `SwaptionVolCube1a` + and `SwaptionVolCube2` to `SabrSwaptionVolatilityCube`, + `XabrSwaptionVolatilityCube`, `NoArbSabrSwaptionVolatilityCube` and + `InterpolatedSwaptionVolatilityCube`, respectively; thanks to + Ignacio Anguita. The old names are deprecated but + still available for a few releases. + - Ensure that inflation curves are re-bootstrapped correctly when + seasonality is added. + + MODELS + - Moved the Heston SLV model from experimental to main; thanks to + Klaus Spanderen. + + MATH + - Added a few overloads to Array and Matrix operators taking rvalue + references for increased speed; thanks to Jonathan Sweemer. + + DEPRECATED FEATURES + - **Removed** features deprecated in version 1.24: + - the protected `spreadLegValue_` data member of `BlackIborCouponPricer`; + - the `WulinYongDoubleBarrierEngine` alias for `SuoWangDoubleBarrierEngine`; + - the `settlementDate`, `incomeDiscountCurve`, `spotIncome`, + `spotValue`, `impliedYield` and `forwardValue` methods of + `ForwardRateAgreement`, as well as its protected + `underlyingIncome_`, `underlyingSpotValue_`, `settlementDays_`, + `payoff_` and `incomeDiscountCurve_` data members; + - constructors for `InflationTermStructure`, + `ZeroInflationTermStructure`, `InterpolatedZeroInflationCurve`, + `PiecewiseZeroInflationCurve` taking an `indexIsInterpolated` + parameter; + - the `indexIsInterpolated` method of `InflationTermStructure` and + its protected `indexIsInterpolated_` data member; + - some overloaded constructors of `SofrFutureRateHelper`. + - Deprecated the `DividendVanillaOption` and `DividendBarrierOption` + classes; use `VanillaOption` and `BarrierOption` instead (see + above). + - Deprecated the constructor of `AnalyticDividendEuropeanEngine` that + takes no dividend information; use the other overload instead. + - Deprecated the names `SwaptionVolCube1`, `SwaptionVolCube1x`, + `SwaptionVolCube1a` and `SwaptionVolCube2` (see above). + - Deprecated the protected `setCommon` method of + `CappedFlooredYoYInflationCoupon`. + + Thanks go also to Jonathan Sweemer, the Xcelerit Dev + Team, Fredrik Gerdin Börjesson, Klaus + Spanderen and Peter Caspers for a number + of smaller fixes and improvements, and to Matthias Groncki + and GitHub user `lukey8767` for raising issues. + + Release 1.29 - January 17th, 2023 PORTABILITY - End of support: as announced in the notes for the previous diff --git a/Docs/quantlib.doxy b/Docs/quantlib.doxy index e8b4dbfe79f..640a1e35472 100644 --- a/Docs/quantlib.doxy +++ b/Docs/quantlib.doxy @@ -1,4 +1,4 @@ -# Doxyfile 1.9.5 +# Doxyfile 1.9.7 #--------------------------------------------------------------------------- # Project related configuration options @@ -42,6 +42,7 @@ OPTIMIZE_OUTPUT_SLICE = NO EXTENSION_MAPPING = MARKDOWN_SUPPORT = YES TOC_INCLUDE_HEADINGS = 0 +MARKDOWN_ID_STYLE = DOXYGEN AUTOLINK_SUPPORT = YES BUILTIN_STL_SUPPORT = YES CPP_CLI_SUPPORT = NO @@ -55,6 +56,7 @@ INLINE_SIMPLE_STRUCTS = NO TYPEDEF_HIDES_STRUCT = NO LOOKUP_CACHE_SIZE = 0 NUM_PROC_THREADS = 1 +TIMESTAMP = NO #--------------------------------------------------------------------------- # Build related configuration options #--------------------------------------------------------------------------- @@ -107,6 +109,7 @@ WARN_IF_UNDOCUMENTED = NO WARN_IF_DOC_ERROR = YES WARN_IF_INCOMPLETE_DOC = NO WARN_NO_PARAMDOC = NO +WARN_IF_UNDOC_ENUM_VAL = NO WARN_AS_ERROR = YES WARN_FORMAT = "$file:$line: $text" WARN_LINE_FORMAT = "at line $line of file $file" @@ -170,7 +173,6 @@ HTML_COLORSTYLE = AUTO_LIGHT HTML_COLORSTYLE_HUE = 220 HTML_COLORSTYLE_SAT = 100 HTML_COLORSTYLE_GAMMA = 80 -HTML_TIMESTAMP = NO HTML_DYNAMIC_MENUS = YES HTML_DYNAMIC_SECTIONS = YES HTML_INDEX_NUM_ENTRIES = 100 @@ -187,6 +189,7 @@ GENERATE_CHI = NO CHM_INDEX_ENCODING = BINARY_TOC = NO TOC_EXPAND = NO +SITEMAP_URL = GENERATE_QHP = NO QCH_FILE = QHP_NAMESPACE = org.doxygen.Project @@ -240,7 +243,6 @@ USE_PDFLATEX = YES LATEX_BATCHMODE = NO LATEX_HIDE_INDICES = NO LATEX_BIB_STYLE = plain -LATEX_TIMESTAMP = NO LATEX_EMOJI_DIRECTORY = #--------------------------------------------------------------------------- # Configuration options related to the RTF output @@ -303,9 +305,8 @@ ALLEXTERNALS = NO EXTERNAL_GROUPS = YES EXTERNAL_PAGES = YES #--------------------------------------------------------------------------- -# Configuration options related to the dot tool +# Configuration options related to diagram generator tools #--------------------------------------------------------------------------- -DIA_PATH = HIDE_UNDOC_RELATIONS = NO HAVE_DOT = YES DOT_NUM_THREADS = 0 @@ -332,7 +333,7 @@ DOT_IMAGE_FORMAT = png INTERACTIVE_SVG = NO DOT_PATH = DOTFILE_DIRS = -MSCFILE_DIRS = +DIA_PATH = DIAFILE_DIRS = PLANTUML_JAR_PATH = PLANTUML_CFG_FILE = @@ -342,3 +343,5 @@ MAX_DOT_GRAPH_DEPTH = 2 DOT_MULTI_TARGETS = NO GENERATE_LEGEND = YES DOT_CLEANUP = YES +MSCGEN_TOOL = +MSCFILE_DIRS = diff --git a/Examples/FRA/FRA.cpp b/Examples/FRA/FRA.cpp index 9a032611492..a544d400f3f 100644 --- a/Examples/FRA/FRA.cpp +++ b/Examples/FRA/FRA.cpp @@ -191,9 +191,9 @@ int main(int, char* []) { Rate fraStrikeRate = threeMonthFraQuote[monthsToStart[i]]; - ForwardRateAgreement myFRA(fraValueDate, + ForwardRateAgreement myFRA(euribor3m, fraValueDate, fraFwdType,fraStrikeRate, - fraNotional, euribor3m); + fraNotional); cout << "3m Term FRA, Months to Start: " << monthsToStart[i] @@ -250,9 +250,9 @@ int main(int, char* []) { Rate fraStrikeRate = threeMonthFraQuote[monthsToStart[i]] - BpsShift; - ForwardRateAgreement myFRA(fraValueDate, + ForwardRateAgreement myFRA(euribor3m, fraValueDate, fraFwdType, fraStrikeRate, - fraNotional, euribor3m); + fraNotional); cout << "3m Term FRA, 100 notional, Months to Start = " << monthsToStart[i] diff --git a/Examples/Makefile.am b/Examples/Makefile.am index a43776b1497..bb2b3a5ffc6 100644 --- a/Examples/Makefile.am +++ b/Examples/Makefile.am @@ -23,6 +23,20 @@ EXAMPLES = \ Repo/Repo +if AUTO_SKIP_EXAMPLES + +EXTRA_DIST = CMakeLists.txt README.txt + +dist-hook: + for i in $(notdir $(EXAMPLES)); do \ + cp $(srcdir)/$$i/$$i.cpp $(distdir)/$$i/ && \ + cp $(srcdir)/$$i/$$i.vcxproj $(distdir)/$$i/ && \ + cp $(srcdir)/$$i/$$i.vcxproj.filters $(distdir)/$$i/ && \ + cp $(srcdir)/$$i/CMakeLists.txt $(distdir)/$$i/ \ + ; done + +else + if AUTO_EXAMPLES bin_PROGRAMS = $(EXAMPLES) TESTS = $(EXAMPLES) @@ -103,3 +117,4 @@ dist-hook: check-examples: $(EXAMPLES) for i in $(EXAMPLES); do echo "========" && echo $$i && $$i || break -1 ; done +endif diff --git a/Examples/MulticurveBootstrapping/MulticurveBootstrapping.cpp b/Examples/MulticurveBootstrapping/MulticurveBootstrapping.cpp index d1d0087148a..5d668170ded 100644 --- a/Examples/MulticurveBootstrapping/MulticurveBootstrapping.cpp +++ b/Examples/MulticurveBootstrapping/MulticurveBootstrapping.cpp @@ -450,7 +450,7 @@ int main(int, char* []) { << io::rate(fairRate); std::cout << std::endl; - // now let's say that the 5-years swap rate goes up to 0.009%. + // now let's say that the 5-years swap rate goes up to 0.90%. // A smarter market element--say, connected to a data source-- would // notice the change itself. Since we're using SimpleQuotes, // we'll have to change the value manually--which forces us to diff --git a/LICENSE.TXT b/LICENSE.TXT index 20aedb9503c..bdcd6f8f1bb 100644 --- a/LICENSE.TXT +++ b/LICENSE.TXT @@ -92,7 +92,7 @@ QuantLib is Copyright (C) 2010 Robert Philipp Copyright (C) 2010 Slava Mazur Copyright (C) 2010 SunTrust Bank - Copyright (C) 2010, 2011, 2012, 2013 Andre Miemiec + Copyright (C) 2010, 2011, 2012, 2013, 2023 Andre Miemiec Copyright (C) 2010, 2014 Cavit Hafizoglu Copyright (C) 2011, 2013, 2014 Fabien Le Floc'h @@ -159,8 +159,12 @@ QuantLib is Copyright (C) 2021, 2022 Ralf Konrad Eckel Copyright (C) 2021, 2022, 2023 Skandinaviska Enskilda Banken AB (publ) - Copyright (C) 2022 Jonghee Lee Copyright (C) 2022, 2023 Ignacio Anguita + Copyright (C) 2022, 2023 Jonghee Lee + + Copyright (C) 2023 Aditya Narayan Das + Copyright (C) 2023 Andrea Pellegatta + Copyright (C) 2023 Jonathan Sweemer QuantLib includes code taken from Peter Jäckel's book "Monte Carlo Methods in Finance". diff --git a/News.md b/News.md index af00988453a..23ed2dac515 100644 --- a/News.md +++ b/News.md @@ -1,142 +1,11 @@ -Changes for QuantLib 1.29: -========================== +Changes for QuantLib 1.31.1: +============================ -QuantLib 1.29 includes 42 pull requests from several contributors. +QuantLib 1.31.1 is a bug-fix release for QuantLib 1.31. -Some of the most notable changes are included below. -A detailed list of changes is available in ChangeLog.txt and at -. +It fixes a regression that could cause a segmentation fault when +bootstrapping an interest-rate curve using OIS rates. +Details are available at +. -Portability ------------ - -- **End of support:** as announced in the notes for the previous - release, this release no longer manages thread-local singletons via - a user-provided `sessionId` function, and therefore the latter is no - longer needed. Instead, the code now uses the built-in language - support for thread-local variables. Thanks go to Peter Caspers - (@pcaspers). - -- **Future end of support:** as announced in the notes for the - previous release, after the next couple of releases, using - `std::tuple`, `std::function` and `std::bind` (instead of their - `boost` counterparts) will become the default. If you're using - `ext::tuple` etc. in your code (which is suggested), this should be - a transparent change. If not, you'll still be able to choose the - `boost` versions via a configure switch for a while; but we do - suggest you start using `ext::tuple` etc. in the meantime. - -- Replaced internal usage of `boost::thread` with `std::thread`; - thanks to Jonathan Sweemer (@sweemer). This removed our last - dependency on Boost binaries and makes it possible to compile - QuantLib using a header-only Boost installation. - -- On Windows, it is now possible to use the MSVC dynamic runtime when - using cmake by passing - `-DCMAKE_MSVC_RUNTIME_LIBRARY=MultiThreadedDLL` - on the command line; thanks to Jonathan Sweemer (@sweemer). The - static runtime remains the default. - -- It is now possible to build QuantLib with Intel's `icpx` compiler - using cmake; thanks to Jonathan Sweemer (@sweemer). Note that in - order to get all the unit tests passing, `-fp-model=precise` must be - added to `CMAKE_CXX_FLAGS`. - - -Date/time ---------- - -- Updated Chinese holidays for 2023; thanks to Cheng Li - (@wegamekinglc). - -- Added in-lieu holiday for Christmas 2022 to South-African calendar; - thanks to Joshua Hayes (@JoshHayes). - -- Added King Charles III coronation holiday to UK calendar; thanks to - Fredrik Gerdin Börjesson (@gbfredrik). - -- Added holiday for National Day of Mourning to Australian calendar; - thanks to Fredrik Gerdin Börjesson (@gbfredrik). - - -Instruments ------------ - -- Added high performance/precision American engine based on - fixed-point iteration for the exercise boundary; thanks to Klaus - Spanderen (@klausspanderen). - -- Bonds with draw-down (i.e., increasing notionals) are now allowed; - thanks to Oleg Kulkov (@Borgomi42 ). - -- Added `withIndexedCoupons` and `withAtParCoupons` methods to - `MakeSwaption` for easier initialization; thanks to Ralf Konrad - (@ralfkonrad). - -- It is now possible to use the same pricing engine for vanilla and - dividend vanilla options, or for barrier and dividend barrier - options (@lballabio). - - -Indexes -------- - -- Creating a zero inflation index as "interpolated" is now deprecated; - thanks to Ralf Konrad (@ralfkonrad). The index should only return - monthly fixings. Interpolation is now the responsibility of - inflation-based coupons. - - -Term structures ---------------- - -- The `ConstantCPIVolatility` constructor can now take a handle to a - volatility quote, instead of just an immutable number (@lballabio). - - -Deprecated features -------------------- - -- **Removed** features deprecated in version 1.24: - - the `createAtParCoupons`, `createIndexedCoupons` and - `usingAtParCoupons` methods of `IborCoupon`; - - the `RiskyBond` class and its subclasses `RiskyFixedBond` and - `RiskyFloatingBond`; - - the `CrossCurrencyBasisSwapRateHelper` typedef; - - the `termStructure_` data member of `BlackCalibrationHelper`; - - the static `baseCurrency` and `conversionType` data members of `Money`; - - the `nominalTermStructure` method and the `nominalTermStructure_` - data member of `InflationTermStructure`; - - the constructor of the `UnitedStates` calendar not taking an - explicit market. - -- Deprecated the `argument_type`, `first_argument_type`, - `second_argument_type` and `result_type` typedefs in a number of - classes; use `auto` or `decltype` instead. - -- Deprecated the constructors of `InflationIndex`, - `ZeroInflationIndex`, `FRHICP`, `ZACPI`, `UKRPI`, `EUHICP`, - `EUHICPXT`, `USCPI`, `AUCPI` and `GenericCPI` taking an - `interpolated` parameter; use another constructor. - -- Deprecated the `interpolated` method and the `interpolated_` data - member of `InflationIndex`. - -- Deprecated the `ThreadKey` typedef. It was used in the signature of - `sessionId`, which is no longer needed after the changes in the - `Singleton` implementation. - -- Deprecated the `rateCurve_` data member of the - `InflationCouponPricer` base class. If you need it, provide it in - your derived class. - -- Deprecated the `npvbps` function taking NPV and BPS as references. - Use the overload returning a pair of `Real`s. - - -**Thanks go also** to Matthias Groncki (@mgroncki), Jonathan Sweemer -(@sweemer) and Nijaz Kovacevic (@NijazK) for a number of smaller fixes -and improvements, to the Xcelerit Dev Team (@xcelerit-dev) for -improvements to the automated CI builds, and to Vincenzo Ferrazzanno -(@vincferr), @alienbrett, @xuruilong100 and @philippb90 for raising issues. diff --git a/QuantLib.vcxproj b/QuantLib.vcxproj index 625f9bfe67e..6736e34a19f 100644 --- a/QuantLib.vcxproj +++ b/QuantLib.vcxproj @@ -135,7 +135,7 @@ QuantLib-x64-mt-s QuantLib-mt QuantLib-x64-mt - + MaxSpeed @@ -517,6 +517,7 @@ + @@ -833,6 +834,8 @@ + + @@ -852,6 +855,7 @@ + @@ -1010,7 +1014,6 @@ - @@ -1147,7 +1150,6 @@ - @@ -1175,7 +1177,6 @@ - @@ -1591,12 +1592,10 @@ - - @@ -1831,6 +1830,7 @@ + @@ -1842,15 +1842,14 @@ - + - @@ -1874,6 +1873,7 @@ + @@ -1911,6 +1911,7 @@ + @@ -2124,6 +2125,7 @@ + @@ -2790,6 +2792,7 @@ + @@ -2808,8 +2811,10 @@ + + @@ -2823,4 +2828,4 @@ - \ No newline at end of file + diff --git a/QuantLib.vcxproj.filters b/QuantLib.vcxproj.filters index 1db10bb7997..a835bb92082 100644 --- a/QuantLib.vcxproj.filters +++ b/QuantLib.vcxproj.filters @@ -399,9 +399,6 @@ methods\finitedifferences - - methods\finitedifferences - methods\finitedifferences @@ -441,9 +438,6 @@ methods\finitedifferences - - methods\finitedifferences - methods\finitedifferences @@ -642,6 +636,9 @@ indexes\ibor + + indexes\ibor + indexes\ibor @@ -987,9 +984,6 @@ math - - math - math @@ -2238,9 +2232,6 @@ utilities - - utilities - utilities @@ -2511,15 +2502,9 @@ pricingengines\vanilla - - pricingengines\vanilla - pricingengines\vanilla - - pricingengines\vanilla - pricingengines\vanilla @@ -3738,8 +3723,8 @@ pricingengines\barrier + - @@ -3764,6 +3749,7 @@ + @@ -4439,6 +4425,18 @@ instruments + + cashflows + + + time\daycounters + + + indexes\ibor + + + indexes\ibor + @@ -4576,6 +4574,9 @@ indexes\ibor + + indexes\ibor + indexes\ibor @@ -6628,8 +6629,10 @@ + + @@ -7168,5 +7171,11 @@ instruments + + cashflows + + + time\daycounters + - \ No newline at end of file + diff --git a/cmake/GenerateHeaders.cmake b/cmake/GenerateHeaders.cmake index 3cd49c7c2e4..b87ebb20d8e 100644 --- a/cmake/GenerateHeaders.cmake +++ b/cmake/GenerateHeaders.cmake @@ -11,7 +11,6 @@ function(generate_ql_header source_dir binary_dir) "#endif\n\n") file(GLOB children_hpp RELATIVE ${source_dir} "${source_dir}/ql/*.hpp") list(FILTER children_hpp EXCLUDE REGEX "auto_link.hpp") - list(FILTER children_hpp EXCLUDE REGEX "auto_ptr.hpp") list(FILTER children_hpp EXCLUDE REGEX "config.*.hpp") list(FILTER children_hpp EXCLUDE REGEX "mathconstants.hpp") list(FILTER children_hpp EXCLUDE REGEX "qldefines.hpp") @@ -38,12 +37,31 @@ function(generate_dir_headers source_dir binary_dir) set(children_all "") file(GLOB children_hpp RELATIVE ${source_dir} "${source_dir}/*.hpp") list(FILTER children_hpp EXCLUDE REGEX "all.hpp") - list(FILTER children_hpp EXCLUDE REGEX "initializers.hpp") - list(FILTER children_hpp EXCLUDE REGEX "onefactoroperator.hpp") - list(FILTER children_hpp EXCLUDE REGEX "fdshoutengine.hpp") - list(FILTER children_hpp EXCLUDE REGEX "fddividendshoutengine.hpp") - list(FILTER children_hpp EXCLUDE REGEX "americancondition.hpp") - list(FILTER children_hpp EXCLUDE REGEX "disposable.hpp") + list(FILTER children_hpp EXCLUDE REGEX "swaptionvolcube1.hpp") + list(FILTER children_hpp EXCLUDE REGEX "swaptionvolcube2.hpp") + list(FILTER children_hpp EXCLUDE REGEX "swaptionvolcube1a.hpp") + + # The ql/experimental/amortizingbonds have been moved to ql/instruments/bonds + # Therefore, we can ignore them as they only contain a warning and the new includes. + if (${source_dir} MATCHES "experimental" AND ${source_dir} MATCHES "amortizingbonds") + list(FILTER children_hpp EXCLUDE REGEX "amortizingfixedratebond.hpp") + list(FILTER children_hpp EXCLUDE REGEX "amortizingfloatingratebond.hpp") + list(FILTER children_hpp EXCLUDE REGEX "amortizingcmsratebond.hpp") + endif () + + list(FILTER children_hpp EXCLUDE REGEX "riskybond.hpp") + list(FILTER children_hpp EXCLUDE REGEX "composite.hpp") + list(FILTER children_hpp EXCLUDE REGEX "lexicographicalview.hpp") + list(FILTER children_hpp EXCLUDE REGEX "^curve.hpp") + list(FILTER children_hpp EXCLUDE REGEX "drifttermstructure.hpp") + list(FILTER children_hpp EXCLUDE REGEX "multicurvesensitivities.hpp") + list(FILTER children_hpp EXCLUDE REGEX "shoutcondition.hpp") + list(FILTER children_hpp EXCLUDE REGEX "fdcondition.hpp") + list(FILTER children_hpp EXCLUDE REGEX "pdeshortrate.hpp") + list(FILTER children_hpp EXCLUDE REGEX "fddividendengine.hpp") + list(FILTER children_hpp EXCLUDE REGEX "fdstepconditionengine.hpp") + list(FILTER children_hpp EXCLUDE REGEX "duffsdeviceinnerproduct.hpp") + file(GLOB children_dir RELATIVE ${source_dir} "${source_dir}/*") list(FILTER children_dir EXCLUDE REGEX "CMakeFiles") list(FILTER children_dir EXCLUDE REGEX "^\\..*") @@ -57,14 +75,12 @@ function(generate_dir_headers source_dir binary_dir) generate_dir_headers("${source_dir}/${child}" "${binary_dir}/${child}") endif() endforeach() - if (children_all) - file(WRITE "${binary_dir}/all.hpp" - "/* This file is automatically generated; do not edit. */\n\n") - foreach(child ${children_all}) - file(RELATIVE_PATH all_path ${SOURCE_DIR} ${child}) - file(APPEND "${binary_dir}/all.hpp" "#include <${all_path}>\n") - endforeach() - endif() + file(WRITE "${binary_dir}/all.hpp" + "/* This file is automatically generated; do not edit. */\n\n") + foreach(child ${children_all}) + file(RELATIVE_PATH all_path ${SOURCE_DIR} ${child}) + file(APPEND "${binary_dir}/all.hpp" "#include <${all_path}>\n") + endforeach() endfunction() # Call generate_dir_headers for each directory at this top level (ql/) diff --git a/cmake/Platform.cmake b/cmake/Platform.cmake index 9c21865d98d..1da2834bce3 100644 --- a/cmake/Platform.cmake +++ b/cmake/Platform.cmake @@ -17,6 +17,9 @@ if (MSVC) add_compile_definitions(NOMINMAX) + # caused by ql\time\date.cpp: warning C4996: 'localtime': This function or variable may be unsafe. Consider using localtime_s instead. + add_compile_definitions(_CRT_SECURE_NO_WARNINGS) + # /wd4267 # Suppress warnings: assignment of 64-bit value to 32-bit QuantLib::Integer (x64) @@ -27,4 +30,11 @@ if (MSVC) # Suppress warnings: "Prefer enum class over enum" (Enum.3) add_compile_options(/wd4267 /wd4819 /wd26812) + + # prevent warnings when using /std:c++17 and above + if(CMAKE_CXX_STANDARD GREATER_EQUAL 17) + # E.g. caused by #include + # In c++17 std::iterator is deprecated. As of boost 1.81 boost::ublas has not provided a fix for this. + add_compile_definitions(_SILENCE_CXX17_ITERATOR_BASE_CLASS_DEPRECATION_WARNING) + endif() endif() diff --git a/configure.ac b/configure.ac index dc0abe9e4e9..6b6bbd8d3d9 100644 --- a/configure.ac +++ b/configure.ac @@ -1,5 +1,5 @@ # Process this file with autoconf to produce a configure script. -AC_INIT([QuantLib], [1.30-dev], +AC_INIT([QuantLib], [1.32-dev], [quantlib-dev@lists.sourceforge.net], [QuantLib]) AC_PREREQ(2.62) @@ -285,6 +285,16 @@ AC_ARG_ENABLE([examples], AM_CONDITIONAL(AUTO_EXAMPLES, test "$ql_install_examples" != "no") AC_MSG_RESULT([$ql_install_examples]) +AC_MSG_CHECKING([whether to skip examples]) +AC_ARG_ENABLE([skip-examples], + AS_HELP_STRING([--enable-skip-examples], + [If enabled, examples are not built. + Disabled by default.]), + [ql_skip_examples=$enableval], + [ql_skip_examples=no]) +AM_CONDITIONAL(AUTO_SKIP_EXAMPLES, test "$ql_skip_examples" != "no") +AC_MSG_RESULT([$ql_skip_examples]) + AC_MSG_CHECKING([whether to install the benchmark]) AC_ARG_ENABLE([benchmark], AS_HELP_STRING([--enable-benchmark], @@ -331,6 +341,80 @@ if test "$ql_use_intraday" = "yes" ; then fi AC_MSG_RESULT([$ql_use_intraday]) +AC_MSG_CHECKING([whether to throw exceptions for notification cycles]) +AC_ARG_ENABLE([throwing-in-cycles], + AS_HELP_STRING([--enable-throwing-in-cycles], + [If enabled, lazy objects will raise an + exception when they detect a + notification cycle which would result in + an infinite recursion loop. If disabled + (the default), they will break the + recursion without throwing. Enabling + this option is recommended but might + cause existing code to throw.]), + [ql_throw_in_cycles=$enableval], + [ql_throw_in_cycles=no]) +if test "$ql_throw_in_cycles" = "yes" ; then + AC_DEFINE([QL_THROW_IN_CYCLES],[1], + [Define this if you want to throw an exception when a notification loop is detected.]) +fi +AC_MSG_RESULT([$ql_throw_in_cycles]) + +AC_MSG_CHECKING([whether to reduce the number of notifications from lazy objects]) +AC_ARG_ENABLE([faster-lazy-objects], + AS_HELP_STRING([--enable-faster-lazy-objects], + [If enabled, lazy objects will forward + the first notification received, and + discard the others until recalculated; + the rationale is that observers were + already notified, and don't need further + notifications until they recalculate, at + which point this object would be + recalculated too. After recalculation, + this object would again forward the + first notification received. Although + not always correct, this behavior is a + lot faster and thus is the current + default.]), + [ql_faster_lazy_objects=$enableval], + [ql_faster_lazy_objects=yes]) +if test "$ql_faster_lazy_objects" = "yes" ; then + AC_DEFINE([QL_FASTER_LAZY_OBJECTS],[1], + [Define this if you want lazy objects to forward fewer notifications.]) +fi +AC_MSG_RESULT([$ql_faster_lazy_objects]) + +AC_MSG_CHECKING([whether to enable std::any instead of boost::any]) +AC_ARG_ENABLE([std-any], + AS_HELP_STRING([--enable-std-any], + [If enabled, std::any and related classes and + functions will be used instead of boost::any. + This requires C++17. If disabled (the default) + the Boost facilities are used.]), + [ql_use_std_any=$enableval], + [ql_use_std_any=no]) +if test "$ql_use_std_any" = "yes" ; then + AC_DEFINE([QL_USE_STD_ANY],[1], + [Define this if you want to use std::any.]) +fi +AC_MSG_RESULT([$ql_use_std_any]) + +AC_MSG_CHECKING([whether to enable std::optional instead of boost::optional]) +AC_ARG_ENABLE([std-optional], + AS_HELP_STRING([--enable-std-optional], + [If enabled, std::optional and related + classes and functions will be used instead + of boost::optional. This requires C++17. + If disabled (the default) the Boost facilities + are used.]), + [ql_use_std_optional=$enableval], + [ql_use_std_optional=no]) +if test "$ql_use_std_optional" = "yes" ; then + AC_DEFINE([QL_USE_STD_OPTIONAL],[1], + [Define this if you want to use std::optional.]) +fi +AC_MSG_RESULT([$ql_use_std_optional]) + AC_MSG_CHECKING([whether to enable standard smart pointers]) AC_ARG_ENABLE([std-pointers], AS_HELP_STRING([--enable-std-pointers], @@ -352,12 +436,12 @@ AC_MSG_RESULT([$ql_use_std_pointers]) AC_MSG_CHECKING([whether to enable std::function]) AC_ARG_ENABLE([std-function], AS_HELP_STRING([--enable-std-function], - [If enabled, std::function and std::bind will be - used instead of boost::function and boost::bind. - If disabled (the default) the Boost facilities - are used.]), + [If enabled (the default), std::function + and std::bind will be used. If + disabled, the corresponding Boost + classes will be used instead.]), [ql_use_std_function=$enableval], - [ql_use_std_function=no]) + [ql_use_std_function=yes]) if test "$ql_use_std_function" = "yes" ; then AC_DEFINE([QL_USE_STD_FUNCTION],[1], [Define this if you want to use std::function and std::bind.]) @@ -367,17 +451,17 @@ AC_MSG_RESULT([$ql_use_std_function]) AC_MSG_CHECKING([whether to enable std::tuple]) AC_ARG_ENABLE([std-tuple], AS_HELP_STRING([--enable-std-tuple], - [If enabled, std::tuple and related functions - will be used instead of boost::tuple. - If disabled (the default) the Boost facilities - are used.]), + [If enabled (the default), std::tuple and + related functions will be used. If + disabled, the corresponding Boost + facilities will be used instead.]), [ql_use_std_tuple=$enableval], - [ql_use_std_tuple=no]) + [ql_use_std_tuple=yes]) if test "$ql_use_std_tuple" = "yes" ; then AC_DEFINE([QL_USE_STD_TUPLE],[1], [Define this if you want to use std::tuple.]) fi -AC_MSG_RESULT([$ql_use_std_pointers]) +AC_MSG_RESULT([$ql_use_std_tuple]) AC_MSG_CHECKING([whether to enable available std classes]) AC_ARG_ENABLE([std-classes], diff --git a/ql/CMakeLists.txt b/ql/CMakeLists.txt index 74c5657f159..9fa26342cda 100644 --- a/ql/CMakeLists.txt +++ b/ql/CMakeLists.txt @@ -16,6 +16,7 @@ set(QL_SOURCES cashflows/digitaliborcoupon.cpp cashflows/dividend.cpp cashflows/duration.cpp + cashflows/equitycashflow.cpp cashflows/fixedratecoupon.cpp cashflows/floatingratecoupon.cpp cashflows/iborcoupon.cpp @@ -236,6 +237,7 @@ set(QL_SOURCES indexes/bmaindex.cpp indexes/equityindex.cpp indexes/ibor/bibor.cpp + indexes/ibor/corra.cpp indexes/ibor/eonia.cpp indexes/ibor/estr.cpp indexes/ibor/euribor.cpp @@ -257,6 +259,7 @@ set(QL_SOURCES indexes/swap/jpyliborswap.cpp indexes/swap/usdliborswap.cpp indexes/swapindex.cpp + instrument.cpp instruments/asianoption.cpp instruments/assetswap.cpp instruments/averagetype.cpp @@ -644,6 +647,7 @@ set(QL_SOURCES models/volatility/constantestimator.cpp models/volatility/garch.cpp money.cpp + optional.cpp patterns/observable.cpp position.cpp prices.cpp @@ -910,6 +914,7 @@ set(QL_SOURCES time/daycounters/simpledaycounter.cpp time/daycounters/thirty360.cpp time/daycounters/thirty365.cpp + time/daycounters/yearfractiontodate.cpp time/ecb.cpp time/frequency.cpp time/imm.cpp @@ -925,8 +930,8 @@ set(QL_SOURCES ) set(QL_HEADERS + any.hpp auto_link.hpp - auto_ptr.hpp cashflow.hpp cashflows/averagebmacoupon.hpp cashflows/capflooredcoupon.hpp @@ -944,6 +949,7 @@ set(QL_HEADERS cashflows/digitaliborcoupon.hpp cashflows/dividend.hpp cashflows/duration.hpp + cashflows/equitycashflow.hpp cashflows/fixedratecoupon.hpp cashflows/floatingratecoupon.hpp cashflows/iborcoupon.hpp @@ -1245,6 +1251,8 @@ set(QL_HEADERS indexes/ibor/cadlibor.hpp indexes/ibor/cdor.hpp indexes/ibor/chflibor.hpp + indexes/ibor/corra.hpp + indexes/ibor/destr.hpp indexes/ibor/dkklibor.hpp indexes/ibor/eonia.hpp indexes/ibor/estr.hpp @@ -1264,6 +1272,7 @@ set(QL_HEADERS indexes/ibor/shibor.hpp indexes/ibor/sofr.hpp indexes/ibor/sonia.hpp + indexes/ibor/swestr.hpp indexes/ibor/thbfix.hpp indexes/ibor/tibor.hpp indexes/ibor/tona.hpp @@ -1415,7 +1424,6 @@ set(QL_HEADERS math/functional.hpp math/generallinearleastsquares.hpp math/incompletegamma.hpp - math/initializers.hpp math/integrals/discreteintegrals.hpp math/integrals/exponentialintegrals.hpp math/integrals/filonintegral.hpp @@ -1543,7 +1551,6 @@ set(QL_HEADERS math/statistics/statistics.hpp math/transformedgrid.hpp mathconstants.hpp - methods/finitedifferences/americancondition.hpp methods/finitedifferences/boundarycondition.hpp methods/finitedifferences/bsmoperator.hpp methods/finitedifferences/bsmtermoperator.hpp @@ -1570,7 +1577,6 @@ set(QL_HEADERS methods/finitedifferences/meshers/uniform1dmesher.hpp methods/finitedifferences/meshers/uniformgridmesher.hpp methods/finitedifferences/mixedscheme.hpp - methods/finitedifferences/onefactoroperator.hpp methods/finitedifferences/operators/fdm2dblackscholesop.hpp methods/finitedifferences/operators/fdmbatesop.hpp methods/finitedifferences/operators/fdmblackscholesfwdop.hpp @@ -1828,6 +1834,7 @@ set(QL_HEADERS money.hpp numericalmethod.hpp option.hpp + optional.hpp patterns/composite.hpp patterns/curiouslyrecurring.hpp patterns/lazyobject.hpp @@ -1949,12 +1956,10 @@ set(QL_HEADERS pricingengines/vanilla/fdcevvanillaengine.hpp pricingengines/vanilla/fdconditions.hpp pricingengines/vanilla/fddividendengine.hpp - pricingengines/vanilla/fddividendshoutengine.hpp pricingengines/vanilla/fdhestonhullwhitevanillaengine.hpp pricingengines/vanilla/fdhestonvanillaengine.hpp pricingengines/vanilla/fdmultiperiodengine.hpp pricingengines/vanilla/fdsabrvanillaengine.hpp - pricingengines/vanilla/fdshoutengine.hpp pricingengines/vanilla/fdsimplebsswingengine.hpp pricingengines/vanilla/fdstepconditionengine.hpp pricingengines/vanilla/fdvanillaengine.hpp @@ -2180,6 +2185,7 @@ set(QL_HEADERS time/daycounters/simpledaycounter.hpp time/daycounters/thirty360.hpp time/daycounters/thirty365.hpp + time/daycounters/yearfractiontodate.hpp time/ecb.hpp time/frequency.hpp time/imm.hpp @@ -2195,7 +2201,6 @@ set(QL_HEADERS utilities/clone.hpp utilities/dataformatters.hpp utilities/dataparsers.hpp - utilities/disposable.hpp utilities/null.hpp utilities/null_deleter.hpp utilities/observablevalue.hpp diff --git a/ql/Makefile.am b/ql/Makefile.am index 9cf55bb3212..1d752a5ce7a 100644 --- a/ql/Makefile.am +++ b/ql/Makefile.am @@ -21,8 +21,8 @@ AM_CPPFLAGS = -I${top_builddir} -I${top_srcdir} this_includedir=${includedir}/${subdir} this_include_HEADERS = \ + any.hpp \ auto_link.hpp \ - auto_ptr.hpp \ cashflow.hpp \ compounding.hpp \ config.hpp \ @@ -43,6 +43,7 @@ this_include_HEADERS = \ money.hpp \ numericalmethod.hpp \ option.hpp \ + optional.hpp \ payoff.hpp \ position.hpp \ prices.hpp \ @@ -71,8 +72,10 @@ cpp_files = \ exchangerate.cpp \ exercise.cpp \ index.cpp \ + instrument.cpp \ interestrate.cpp \ money.cpp \ + optional.cpp \ position.cpp \ prices.cpp \ rebatedexercise.cpp \ @@ -148,7 +151,6 @@ quantlib.hpp: Makefile.am for i in $(this_include_HEADERS); do \ case $$i in \ auto_link.hpp) continue;; \ - auto_ptr.hpp) continue;; \ config.hpp) continue;; \ mathconstants.hpp) continue;; \ qldefines.hpp) continue;; \ diff --git a/ql/auto_ptr.hpp b/ql/any.hpp similarity index 54% rename from ql/auto_ptr.hpp rename to ql/any.hpp index a024b7cc9d4..d9248dffb1f 100644 --- a/ql/auto_ptr.hpp +++ b/ql/any.hpp @@ -1,7 +1,7 @@ /* -*- mode: c++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /* - Copyright (C) 2018 StatPro Italia srl + Copyright (C) 2023 Jonathan Sweemer This file is part of QuantLib, a free-software/open-source library for financial quantitative analysts and developers - http://quantlib.org/ @@ -17,20 +17,35 @@ FOR A PARTICULAR PURPOSE. See the license for more details. */ -#ifndef quantlib_auto_ptr_hpp -#define quantlib_auto_ptr_hpp +/*! \file any.hpp + \brief Maps any to either the boost or std implementation +*/ + +#ifndef quantlib_any_hpp +#define quantlib_any_hpp #include -#pragma message("Warning: the deprecated QL_UNIQUE_OR_AUTO_PTR macro is no longer used. Replace it with std::unique_ptr.") -#pragma message(" For the time being, the QL_USE_STD_UNIQUE_PTR macro is set to 1. However, do not check for it, since it will disappear in a future release.") -#pragma message(" This file will also disappear in a future release; do not include it.") +#if defined(QL_USE_STD_ANY) +#include +#else +#include +#endif -/*! \deprecated Use std::unique_ptr instead. - Deprecated in version 1.27 -*/ -#define QL_UNIQUE_OR_AUTO_PTR std::unique_ptr +namespace QuantLib { + namespace ext { -#endif + #if defined(QL_USE_STD_ANY) + using std::any; // NOLINT(misc-unused-using-decls) + using std::any_cast; // NOLINT(misc-unused-using-decls) + #else + using boost::any; // NOLINT(misc-unused-using-decls) + using boost::any_cast; // NOLINT(misc-unused-using-decls) + #endif + + } +} + +#endif diff --git a/ql/cashflow.cpp b/ql/cashflow.cpp index 0100bb4fc00..b6ecca631d9 100644 --- a/ql/cashflow.cpp +++ b/ql/cashflow.cpp @@ -25,7 +25,7 @@ namespace QuantLib { bool CashFlow::hasOccurred(const Date& refDate, - boost::optional includeRefDate) const { + ext::optional includeRefDate) const { // easy and quick handling of most cases if (refDate != Date()) { @@ -40,7 +40,7 @@ namespace QuantLib { refDate == Settings::instance().evaluationDate()) { // today's date; we override the bool with the one // specified in the settings (if any) - boost::optional includeToday = + ext::optional includeToday = Settings::instance().includeTodaysCashFlows(); if (includeToday) // NOLINT(readability-implicit-bool-conversion) includeRefDate = *includeToday; diff --git a/ql/cashflow.hpp b/ql/cashflow.hpp index 29c26173e70..5de9a88d19c 100644 --- a/ql/cashflow.hpp +++ b/ql/cashflow.hpp @@ -27,6 +27,7 @@ #include #include +#include #include namespace QuantLib { @@ -47,7 +48,7 @@ namespace QuantLib { Settings::includeTodaysCashflows in account */ bool hasOccurred(const Date& refDate = Date(), - boost::optional includeRefDate = boost::none) const override; + ext::optional includeRefDate = ext::nullopt) const override; //@} //! \name CashFlow interface //@{ diff --git a/ql/cashflows/Makefile.am b/ql/cashflows/Makefile.am index 94bf8118374..5320f812c93 100644 --- a/ql/cashflows/Makefile.am +++ b/ql/cashflows/Makefile.am @@ -20,6 +20,7 @@ this_include_HEADERS = \ digitaliborcoupon.hpp \ dividend.hpp \ duration.hpp \ + equitycashflow.hpp \ fixedratecoupon.hpp \ floatingratecoupon.hpp \ iborcoupon.hpp \ @@ -54,6 +55,7 @@ cpp_files = \ digitaliborcoupon.cpp \ dividend.cpp \ duration.cpp \ + equitycashflow.cpp \ fixedratecoupon.cpp \ floatingratecoupon.cpp \ iborcoupon.cpp \ diff --git a/ql/cashflows/all.hpp b/ql/cashflows/all.hpp index 1dfce31205f..59ee0ab2e11 100644 --- a/ql/cashflows/all.hpp +++ b/ql/cashflows/all.hpp @@ -17,6 +17,7 @@ #include #include #include +#include #include #include #include diff --git a/ql/cashflows/capflooredcoupon.cpp b/ql/cashflows/capflooredcoupon.cpp index 9490cc461c9..78fa5fcb6bd 100644 --- a/ql/cashflows/capflooredcoupon.cpp +++ b/ql/cashflows/capflooredcoupon.cpp @@ -68,7 +68,7 @@ namespace QuantLib { ") less than floor level (" << floor << ")"); } - registerWith(underlying); + registerWith(underlying_); } void CappedFlooredCoupon::setPricer( @@ -77,7 +77,12 @@ namespace QuantLib { underlying_->setPricer(pricer); } - Rate CappedFlooredCoupon::rate() const { + void CappedFlooredCoupon::deepUpdate() { + update(); + underlying_->deepUpdate(); + } + + void CappedFlooredCoupon::performCalculations() const { QL_REQUIRE(underlying_->pricer(), "pricer not set"); Rate swapletRate = underlying_->rate(); Rate floorletRate = 0.; @@ -86,7 +91,12 @@ namespace QuantLib { Rate capletRate = 0.; if(isCapped_) capletRate = underlying_->pricer()->capletRate(effectiveCap()); - return swapletRate + floorletRate - capletRate; + rate_ = swapletRate + floorletRate - capletRate; + } + + Rate CappedFlooredCoupon::rate() const { + calculate(); + return rate_; } Rate CappedFlooredCoupon::convexityAdjustment() const { @@ -123,10 +133,6 @@ namespace QuantLib { return Null(); } - void CappedFlooredCoupon::update() { - notifyObservers(); - } - void CappedFlooredCoupon::accept(AcyclicVisitor& v) { typedef FloatingRateCoupon super; auto* v1 = dynamic_cast*>(&v); diff --git a/ql/cashflows/capflooredcoupon.hpp b/ql/cashflows/capflooredcoupon.hpp index fc360a82c91..1453bf89f5e 100644 --- a/ql/cashflows/capflooredcoupon.hpp +++ b/ql/cashflows/capflooredcoupon.hpp @@ -60,6 +60,14 @@ namespace QuantLib { const ext::shared_ptr& underlying, Rate cap = Null(), Rate floor = Null()); + //! \name Observer interface + //@{ + void deepUpdate() override; + //@} + //! \name LazyObject interface + //@{ + void performCalculations() const override; + //@} //! \name Coupon interface //@{ Rate rate() const override; @@ -74,10 +82,6 @@ namespace QuantLib { //! effective floor of fixing Rate effectiveFloor() const; //@} - //! \name Observer interface - //@{ - void update() override; - //@} //! \name Visitability //@{ void accept(AcyclicVisitor&) override; diff --git a/ql/cashflows/cashflows.hpp b/ql/cashflows/cashflows.hpp index 0ba2f2d8e1c..22595249671 100644 --- a/ql/cashflows/cashflows.hpp +++ b/ql/cashflows/cashflows.hpp @@ -66,7 +66,11 @@ namespace QuantLib { }; public: CashFlows() = delete; + CashFlows(CashFlows&&) = delete; CashFlows(const CashFlows&) = delete; + CashFlows& operator=(CashFlows&&) = delete; + CashFlows& operator=(const CashFlows&) = delete; + ~CashFlows() = default; //! \name Date functions //@{ diff --git a/ql/cashflows/conundrumpricer.cpp b/ql/cashflows/conundrumpricer.cpp index b4f9ac12a5a..585c91ea45f 100644 --- a/ql/cashflows/conundrumpricer.cpp +++ b/ql/cashflows/conundrumpricer.cpp @@ -1,6 +1,7 @@ /* Copyright (C) 2006 Giorgio Facchinetti Copyright (C) 2006 Mario Pucci + Copyright (C) 2023 Andre Miemiec This file is part of QuantLib, a free-software/open-source library for financial quantitative analysts and developers - http://quantlib.org/ @@ -40,10 +41,10 @@ namespace QuantLib { //===========================================================================// -// BlackVanillaOptionPricer // +// Market Quoted Options Pricer // //===========================================================================// - BlackVanillaOptionPricer::BlackVanillaOptionPricer( + MarketQuotedOptionPricer::MarketQuotedOptionPricer( Rate forwardValue, Date expiryDate, const Period& swapTenor, @@ -51,17 +52,23 @@ namespace QuantLib { forwardValue_(forwardValue), expiryDate_(expiryDate), swapTenor_(swapTenor), volatilityStructure_(volatilityStructure), smile_(volatilityStructure_->smileSection(expiryDate_, swapTenor_)) { - QL_REQUIRE(volatilityStructure->volatilityType() == ShiftedLognormal && - close_enough(volatilityStructure->shift(expiryDate,swapTenor),0.0), - "BlackVanillaOptionPricer: zero-shift lognormal volatility required"); + QL_REQUIRE((volatilityStructure->volatilityType() == Normal) || + (volatilityStructure->volatilityType() == ShiftedLognormal && + close_enough(volatilityStructure->shift(expiryDate, swapTenor), 0.0)), + "VanillaOptionPricer: a normal or a zero-shift lognormal volatility is required"); } - Real BlackVanillaOptionPricer::operator()(Real strike, + Real MarketQuotedOptionPricer::operator()(Real strike, Option::Type optionType, Real deflator) const { - const Real variance = smile_->variance(strike); - return deflator * blackFormula(optionType, strike, - forwardValue_, std::sqrt(variance)); + const Real variance = smile_->variance(strike); + if (volatilityStructure_->volatilityType() == ShiftedLognormal) { + return deflator * + blackFormula(optionType, strike, forwardValue_, std::sqrt(variance)); + } else { + return deflator * + bachelierBlackFormula(optionType, strike, forwardValue_, std::sqrt(variance)); + } } @@ -87,7 +94,7 @@ namespace QuantLib { fixingDate_ = coupon_->fixingDate(); paymentDate_ = coupon_->date(); const ext::shared_ptr& swapIndex = coupon_->swapIndex(); - rateCurve_ = *(swapIndex->forwardingTermStructure()); + rateCurve_ = swapIndex->discountingTermStructure().empty() ? *(swapIndex->forwardingTermStructure()) : *(swapIndex->discountingTermStructure()); Date today = Settings::instance().evaluationDate(); @@ -137,7 +144,7 @@ namespace QuantLib { QL_FAIL("unknown/illegal gFunction type"); } vanillaOptionPricer_= ext::shared_ptr(new - BlackVanillaOptionPricer(swapRateValue_, fixingDate_, swapTenor_, + MarketQuotedOptionPricer(swapRateValue_, fixingDate_, swapTenor_, *swaptionVolatility())); } } @@ -149,7 +156,7 @@ namespace QuantLib { } Real HaganPricer::capletPrice(Rate effectiveCap) const { - // caplet is equivalent to call option on fixing + // caplet is equivalent to call option on fixing Date today = Settings::instance().evaluationDate(); if (fixingDate_ <= today) { // the fixing is determined @@ -157,13 +164,23 @@ namespace QuantLib { std::max(coupon_->swapIndex()->fixing(fixingDate_)-effectiveCap, 0.); Rate price = (gearing_*Rs)*(coupon_->accrualPeriod()*discount_); return price; - } else { + } + else { + Real capletPrice = 0.0; + + if (swaptionVolatility()->volatilityType() == ShiftedLognormal) + { Real cutoffNearZero = 1e-10; - Real capletPrice = 0; + if (effectiveCap < cutoffForCaplet_) { - Rate effectiveStrikeForMax = std::max(effectiveCap,cutoffNearZero); + Rate effectiveStrikeForMax = std::max(effectiveCap, cutoffNearZero); capletPrice = optionletPrice(Option::Call, effectiveStrikeForMax); } + } + else + { + capletPrice = optionletPrice(Option::Call, effectiveCap); + } return gearing_ * capletPrice; } } @@ -181,17 +198,28 @@ namespace QuantLib { std::max(effectiveFloor-coupon_->swapIndex()->fixing(fixingDate_),0.); Rate price = (gearing_*Rs)*(coupon_->accrualPeriod()*discount_); return price; - } else { + } + else { + Real floorletPrice = 0.0; + if(swaptionVolatility()->volatilityType() == ShiftedLognormal) + { Real cutoffNearZero = 1e-10; - Real floorletPrice = 0; - if (effectiveFloor > cutoffForFloorlet_){ - Rate effectiveStrikeForMin = std::max(effectiveFloor,cutoffNearZero); - floorletPrice=optionletPrice(Option::Put, effectiveStrikeForMin); + + if (effectiveFloor > cutoffForFloorlet_) { + Rate effectiveStrikeForMin = std::max(effectiveFloor, cutoffNearZero); + floorletPrice = optionletPrice(Option::Put, effectiveStrikeForMin); } - return gearing_ * floorletPrice; + } + else + { + floorletPrice = optionletPrice(Option::Put, effectiveFloor); + } + + return gearing_ * floorletPrice; } } + Rate HaganPricer::floorletRate(Rate effectiveFloor) const { return floorletPrice(effectiveFloor)/(coupon_->accrualPeriod()*discount_); } @@ -246,67 +274,75 @@ namespace QuantLib { Real upperLimit, Real precision, Real hardUpperLimit) - : HaganPricer(swaptionVol, modelOfYieldCurve, meanReversion), upperLimit_(upperLimit), - lowerLimit_(lowerLimit), - - precision_(precision), - - hardUpperLimit_(hardUpperLimit) {} + : HaganPricer(swaptionVol, modelOfYieldCurve, meanReversion), + lowerLimit_(lowerLimit), upperLimit_(upperLimit), + precision_(precision), hardUpperLimit_(hardUpperLimit) {} Real NumericHaganPricer::integrate(Real a, Real b, const ConundrumIntegrand& integrand) const { - Real result =.0; - //double abserr =.0; - //double alpha = 1.0; - - - //double epsabs = precision_; - //double epsrel = 1.0; // we are interested only in absolute precision - //size_t neval =0; - - // we use the non adaptive algorithm only for semi infinite interval - if (a>0){ - - // we estimate the actual boudary by testing integrand values - Real upperBoundary = 2*a; - while(integrand(upperBoundary)>precision_) - upperBoundary *=2.0; - // sometimes b < a because of a wrong estimation of b based on stdev - if (b > a) - upperBoundary = std::min(upperBoundary, b); - - ext::function f; - GaussKronrodNonAdaptive - gaussKronrodNonAdaptive(precision_, 1000000, 1.0); - // if the integration intervall is wide enough we use the - // following change variable x -> a + (b-a)*(t/(a-b))^3 - upperBoundary = std::max(a,std::min(upperBoundary, hardUpperLimit_)); - if (upperBoundary > 2*a){ - Size k = 3; - ext::function temp = ext::cref(integrand); - VariableChange variableChange(temp, a, upperBoundary, k); - f = [&](Real _x) { return variableChange.value(_x); }; - result = gaussKronrodNonAdaptive(f, .0, 1.0); - } else { - f = ext::cref(integrand); - result = gaussKronrodNonAdaptive(f, a, upperBoundary); - } - - // if the expected precision has not been reached we use the old algorithm - if (!gaussKronrodNonAdaptive.integrationSuccess()){ - const GaussKronrodAdaptive integrator(precision_, 100000); - b = std::max(a,std::min(b, hardUpperLimit_)); - result = integrator(integrand,a , b); - } + Real result =.0; + //double abserr =.0; + //double alpha = 1.0; + //double epsabs = precision_; + //double epsrel = 1.0; // we are interested only in absolute precision + //size_t neval =0; + + // we use the non adaptive algorithm only for semi infinite interval + if (a > 0) { + + // we estimate the actual boundary by testing integrand values + Real upperBoundary = 2 * a; + while (integrand(upperBoundary) > precision_) + upperBoundary *= 2.0; + // sometimes b < a because of a wrong estimation of b based on stdev + if (b > a) + upperBoundary = std::min(upperBoundary, b); + + ext::function f; + GaussKronrodNonAdaptive + gaussKronrodNonAdaptive(precision_, 1000000, 1.0); + // if the integration intervall is wide enough we use the + // following change variable x -> a + (b-a)*(t/(a-b))^3 + upperBoundary = std::max(a, std::min(upperBoundary, hardUpperLimit_)); + if (upperBoundary > 2 * a) { + Size k = 3; + ext::function temp = ext::cref(integrand); + VariableChange variableChange(temp, a, upperBoundary, k); + f = [&](Real _x) { return variableChange.value(_x); }; + result = gaussKronrodNonAdaptive(f, .0, 1.0); + } + else { + f = ext::cref(integrand); + result = gaussKronrodNonAdaptive(f, a, upperBoundary); + } - } else { // if a < b we use the old algorithm - b = std::max(a,std::min(b,hardUpperLimit_)); + // if the expected precision has not been reached we use the old algorithm + if (!gaussKronrodNonAdaptive.integrationSuccess()) { const GaussKronrodAdaptive integrator(precision_, 100000); - result = integrator(integrand,a , b); + b = std::max(a, std::min(b, hardUpperLimit_)); + result = integrator(integrand, a, b); } - return result; + } + else { // if a < b we use the old algorithm + b = std::max(a, std::min(b, hardUpperLimit_)); + if (swaptionVolatility()->volatilityType() == ShiftedLognormal) { + const GaussKronrodAdaptive integrator(precision_, 100000); + result = integrator(integrand, a, b); + } + else //Normal and floorlet + { + const GaussKronrodNonAdaptive integrator(precision_, 100000, 1.0); + //Doing an integral from -inf to strike, where strike itself is negative, + //the GaussKronrodAdaptive quadrature rule throws an exceptions in + //GaussKronrodAdaptive::integrateRecursively due to maximum number of + //function evaluations exceed. + result = integrator(integrand, a, b); + } + } + return result; } + Real NumericHaganPricer::optionletPrice( Option::Type optionType, Real strike) const { @@ -315,6 +351,7 @@ namespace QuantLib { fixingDate_, paymentDate_, annuity_, swapRateValue_, strike, optionType)); stdDeviationsForUpperLimit_= requiredStdDeviations_; + stdDeviationsForLowerLimit_= requiredStdDeviations_; Real a, b, integralValue; if (optionType==Option::Call) { upperLimit_ = resetUpperLimit(stdDeviationsForUpperLimit_); @@ -325,6 +362,7 @@ namespace QuantLib { integralValue = integrate(strike, upperLimit_, *integrand); //refineIntegration(integralValue, *integrand); } else { + lowerLimit_ = resetLowerLimit(stdDeviationsForLowerLimit_); a = std::min(strike, lowerLimit_); b = strike; integralValue = integrate(a, b, *integrand); @@ -370,13 +408,30 @@ namespace QuantLib { return integralValue; } - Real NumericHaganPricer::resetUpperLimit( - Real stdDeviationsForUpperLimit) const { - //return 1.0; + Real NumericHaganPricer::resetUpperLimit(Real stdDeviationsForUpperLimit) const { + + // return 1.0; + Real variance = + swaptionVolatility()->blackVariance(fixingDate_, swapTenor_, swapRateValue_); + + if (swaptionVolatility()->volatilityType() == ShiftedLognormal) { + return swapRateValue_ * std::exp(stdDeviationsForUpperLimit * std::sqrt(variance)); + } else { + return swapRateValue_ + stdDeviationsForUpperLimit * std::sqrt(variance); + } + } + + + Real NumericHaganPricer::resetLowerLimit(Real stdDeviationsForUpperLimit) const { + // return -1.0; Real variance = - swaptionVolatility()->blackVariance(fixingDate_,swapTenor_,swapRateValue_); - return swapRateValue_ * - std::exp(stdDeviationsForUpperLimit*std::sqrt(variance)); + swaptionVolatility()->blackVariance(fixingDate_, swapTenor_, swapRateValue_); + + if (swaptionVolatility()->volatilityType() == ShiftedLognormal) { + return lowerLimit_; + } else { + return swapRateValue_ - stdDeviationsForUpperLimit * std::sqrt(variance); + } } @@ -454,37 +509,51 @@ namespace QuantLib { //Hagan, 3.5b, 3.5c Real AnalyticHaganPricer::optionletPrice(Option::Type optionType, - Real strike) const { + Real strike) const { Real variance = swaptionVolatility()->blackVariance(fixingDate_, swapTenor_, swapRateValue_); Real firstDerivativeOfGAtForwardValue = gFunction_->firstDerivative( swapRateValue_); - Real price = 0; + Real price = 0.0; Real CK = (*vanillaOptionPricer_)(strike, optionType, annuity_); price += (discount_/annuity_)*CK; - const Real sqrtSigma2T = std::sqrt(variance); - const Real lnRoverK = std::log(swapRateValue_/strike); - const Real d32 = (lnRoverK+1.5*variance)/sqrtSigma2T; - const Real d12 = (lnRoverK+.5*variance)/sqrtSigma2T; - const Real dminus12 = (lnRoverK-.5*variance)/sqrtSigma2T; - - CumulativeNormalDistribution cumulativeOfNormal; - auto sign = Integer(optionType); - const Real N32 = cumulativeOfNormal(sign * d32); - const Real N12 = cumulativeOfNormal(sign * d12); - const Real Nminus12 = cumulativeOfNormal(sign * dminus12); - - price += sign * firstDerivativeOfGAtForwardValue * annuity_ * - swapRateValue_ * (swapRateValue_ * std::exp(variance) * N32 - - (swapRateValue_ + strike) * N12 + strike * Nminus12); + + if (swaptionVolatility()->volatilityType() == ShiftedLognormal) { + const Real sqrtSigma2T = std::sqrt(variance); + const Real lnRoverK = std::log(swapRateValue_ / strike); + const Real d32 = (lnRoverK + 1.5*variance) / sqrtSigma2T; + const Real d12 = (lnRoverK + .5*variance) / sqrtSigma2T; + const Real dminus12 = (lnRoverK - .5*variance) / sqrtSigma2T; + + CumulativeNormalDistribution cumulativeOfNormal; + auto sign = Integer(optionType); + const Real N32 = cumulativeOfNormal(sign*d32); + const Real N12 = cumulativeOfNormal(sign*d12); + const Real Nminus12 = cumulativeOfNormal(sign*dminus12); + + price += sign * firstDerivativeOfGAtForwardValue * annuity_ * + swapRateValue_ * (swapRateValue_ * std::exp(variance) * N32 - + (swapRateValue_ + strike) * N12 + strike * Nminus12); + } else { + const Real sqrtSigma2T = std::sqrt(variance); + const Real d = (swapRateValue_ - strike) / sqrtSigma2T; + + CumulativeNormalDistribution cumulativeOfNormal; + auto sign = Integer(optionType); + + const Real N = cumulativeOfNormal(sign*d); + price += sign * firstDerivativeOfGAtForwardValue * annuity_ * variance * N; + } + price *= coupon_->accrualPeriod(); return price; } //Hagan 3.4c - Real AnalyticHaganPricer::swapletPrice() const { + Real AnalyticHaganPricer::swapletPrice() const + { Date today = Settings::instance().evaluationDate(); if (fixingDate_ <= today) { @@ -494,19 +563,24 @@ namespace QuantLib { return price; } else { Real variance(swaptionVolatility()->blackVariance(fixingDate_, - swapTenor_, - swapRateValue_)); + swapTenor_, + swapRateValue_)); Real firstDerivativeOfGAtForwardValue(gFunction_->firstDerivative( - swapRateValue_)); - Real price = 0; + swapRateValue_)); + Real price = 0.0; price += discount_*swapRateValue_; - price += firstDerivativeOfGAtForwardValue*annuity_*swapRateValue_* - swapRateValue_*(std::exp(variance)-1.); - return gearing_ * price * coupon_->accrualPeriod() + spreadLegValue_; + if (swaptionVolatility()->volatilityType()==ShiftedLognormal) { + price += firstDerivativeOfGAtForwardValue * annuity_*swapRateValue_* + swapRateValue_*(std::exp(variance) - 1.); + } else { + price += firstDerivativeOfGAtForwardValue * annuity_*variance; + } + return (gearing_ * price +spread_*discount_)* coupon_->accrualPeriod(); } } + //===========================================================================// // GFunctionStandard // //===========================================================================// diff --git a/ql/cashflows/conundrumpricer.hpp b/ql/cashflows/conundrumpricer.hpp index 96036e1cb69..a44591fb87d 100644 --- a/ql/cashflows/conundrumpricer.hpp +++ b/ql/cashflows/conundrumpricer.hpp @@ -1,6 +1,8 @@ /* Copyright (C) 2006 Giorgio Facchinetti Copyright (C) 2006 Mario Pucci + Copyright (C) 2023 Andre Miemiec + This file is part of QuantLib, a free-software/open-source library for financial quantitative analysts and developers - http://quantlib.org/ @@ -40,9 +42,9 @@ namespace QuantLib { Real deflator) const = 0; }; - class BlackVanillaOptionPricer : public VanillaOptionPricer { + class MarketQuotedOptionPricer : public VanillaOptionPricer { public: - BlackVanillaOptionPricer( + MarketQuotedOptionPricer( Rate forwardValue, Date expiryDate, const Period& swapTenor, @@ -59,6 +61,12 @@ namespace QuantLib { ext::shared_ptr smile_; }; + /*! \deprecated Renamed to MarketQuotedOptionPricer. + Deprecated in version 1.31. + */ + [[deprecated("Renamed to MarketQuotedOptionPricer")]] + typedef MarketQuotedOptionPricer BlackVanillaOptionPricer; + class GFunction { public: virtual ~GFunction() = default; @@ -254,6 +262,7 @@ namespace QuantLib { Real hardUpperLimit = QL_MAX_REAL); Real upperLimit() const { return upperLimit_; } + Real lowerLimit() const { return lowerLimit_; } Real stdDeviations() const { return stdDeviationsForUpperLimit_; } // private: @@ -312,10 +321,11 @@ namespace QuantLib { Real optionletPrice(Option::Type optionType, Rate strike) const override; Real swapletPrice() const override; Real resetUpperLimit(Real stdDeviationsForUpperLimit) const; + Real resetLowerLimit(Real stdDeviationsForLowerLimit) const; Real refineIntegration(Real integralValue, const ConundrumIntegrand& integrand) const; - mutable Real upperLimit_, stdDeviationsForUpperLimit_; - const Real lowerLimit_, requiredStdDeviations_ = 8, precision_, + mutable Real lowerLimit_, stdDeviationsForLowerLimit_, upperLimit_, stdDeviationsForUpperLimit_; + const Real requiredStdDeviations_ = 8, precision_, refiningIntegrationTolerance_ = .0001; const Real hardUpperLimit_; }; diff --git a/ql/cashflows/couponpricer.cpp b/ql/cashflows/couponpricer.cpp index 61b02d637e7..beaf87b66b3 100644 --- a/ql/cashflows/couponpricer.cpp +++ b/ql/cashflows/couponpricer.cpp @@ -31,6 +31,7 @@ #include /* internal */ #include #include +#include #include namespace QuantLib { @@ -41,7 +42,7 @@ namespace QuantLib { IborCouponPricer::IborCouponPricer( Handle v, - boost::optional useIndexedCoupon) + ext::optional useIndexedCoupon) : capletVol_(std::move(v)), useIndexedCoupon_(useIndexedCoupon ? *useIndexedCoupon : diff --git a/ql/cashflows/couponpricer.hpp b/ql/cashflows/couponpricer.hpp index 2c03f00b5ab..8236e5c2410 100644 --- a/ql/cashflows/couponpricer.hpp +++ b/ql/cashflows/couponpricer.hpp @@ -30,6 +30,7 @@ #include #include #include +#include #include #include #include @@ -66,7 +67,7 @@ namespace QuantLib { public: explicit IborCouponPricer( Handle v = Handle(), - boost::optional useIndexedCoupon = boost::none); + ext::optional useIndexedCoupon = ext::nullopt); bool useIndexedCoupon() const { return useIndexedCoupon_; } @@ -114,7 +115,7 @@ namespace QuantLib { const Handle& v = Handle(), const TimingAdjustment timingAdjustment = Black76, Handle correlation = Handle(ext::shared_ptr(new SimpleQuote(1.0))), - const boost::optional useIndexedCoupon = boost::none) + const ext::optional useIndexedCoupon = ext::nullopt) : IborCouponPricer(v, useIndexedCoupon), timingAdjustment_(timingAdjustment), correlation_(std::move(correlation)) { { // this additional scope seems required to avoid a misleading-indentation warning diff --git a/ql/cashflows/cpicoupon.cpp b/ql/cashflows/cpicoupon.cpp index dfa532326bc..1e72cae4854 100644 --- a/ql/cashflows/cpicoupon.cpp +++ b/ql/cashflows/cpicoupon.cpp @@ -2,6 +2,7 @@ /* Copyright (C) 2009 Chris Kenyon + Copyright (C) 2022 Quaternion Risk Management Ltd This file is part of QuantLib, a free-software/open-source library for financial quantitative analysts and developers - http://quantlib.org/ @@ -28,12 +29,66 @@ namespace QuantLib { + QL_DEPRECATED_DISABLE_WARNING + CPICoupon::CPICoupon(Real baseCPI, const Date& paymentDate, Real nominal, const Date& startDate, const Date& endDate, - const ext::shared_ptr& zeroIndex, + const ext::shared_ptr& index, + const Period& observationLag, + CPI::InterpolationType observationInterpolation, + const DayCounter& dayCounter, + Real fixedRate, + const Date& refPeriodStart, + const Date& refPeriodEnd, + const Date& exCouponDate) + : CPICoupon(baseCPI, paymentDate, nominal, startDate, endDate, index, + observationLag, observationInterpolation, dayCounter, + fixedRate, 0.0, refPeriodStart, refPeriodEnd, exCouponDate) {} + + CPICoupon::CPICoupon(const Date& baseDate, + const Date& paymentDate, + Real nominal, + const Date& startDate, + const Date& endDate, + const ext::shared_ptr& index, + const Period& observationLag, + CPI::InterpolationType observationInterpolation, + const DayCounter& dayCounter, + Real fixedRate, + const Date& refPeriodStart, + const Date& refPeriodEnd, + const Date& exCouponDate) + : CPICoupon(baseDate, paymentDate, nominal, startDate, endDate, index, + observationLag, observationInterpolation, dayCounter, + fixedRate, 0.0, refPeriodStart, refPeriodEnd, exCouponDate) {} + + CPICoupon::CPICoupon(Real baseCPI, + const Date& baseDate, + const Date& paymentDate, + Real nominal, + const Date& startDate, + const Date& endDate, + const ext::shared_ptr& index, + const Period& observationLag, + CPI::InterpolationType observationInterpolation, + const DayCounter& dayCounter, + Real fixedRate, + const Date& refPeriodStart, + const Date& refPeriodEnd, + const Date& exCouponDate) + : CPICoupon(baseCPI, baseDate, paymentDate, nominal, startDate, endDate, index, + observationLag, observationInterpolation, dayCounter, + fixedRate, 0.0, refPeriodStart, refPeriodEnd, exCouponDate) {} + + CPICoupon::CPICoupon(Real baseCPI, + const Date& paymentDate, + Real nominal, + const Date& startDate, + const Date& endDate, + const ext::shared_ptr& index, const Period& observationLag, CPI::InterpolationType observationInterpolation, const DayCounter& dayCounter, @@ -42,24 +97,35 @@ namespace QuantLib { const Date& refPeriodStart, const Date& refPeriodEnd, const Date& exCouponDate) - : InflationCoupon(paymentDate, nominal, startDate, endDate, - 0, zeroIndex, observationLag, - dayCounter, refPeriodStart, refPeriodEnd, exCouponDate), - baseCPI_(baseCPI), fixedRate_(fixedRate), spread_(spread), - observationInterpolation_(observationInterpolation) { + : CPICoupon(baseCPI, Null(), paymentDate, nominal, startDate, endDate, index, + observationLag, observationInterpolation, dayCounter, + fixedRate, spread, refPeriodStart, refPeriodEnd, exCouponDate) {} - QL_REQUIRE(zeroIndex, "no index provided"); - QL_REQUIRE(std::fabs(baseCPI_) > 1e-16, - "|baseCPI_| < 1e-16, future divide-by-zero problem"); - } + CPICoupon::CPICoupon(const Date& baseDate, + const Date& paymentDate, + Real nominal, + const Date& startDate, + const Date& endDate, + const ext::shared_ptr& index, + const Period& observationLag, + CPI::InterpolationType observationInterpolation, + const DayCounter& dayCounter, + Real fixedRate, + Spread spread, + const Date& refPeriodStart, + const Date& refPeriodEnd, + const Date& exCouponDate) + : CPICoupon(Null(), baseDate, paymentDate, nominal, startDate, endDate, index, + observationLag, observationInterpolation, dayCounter, + fixedRate, spread, refPeriodStart, refPeriodEnd, exCouponDate) {} CPICoupon::CPICoupon(Real baseCPI, + const Date& baseDate, const Date& paymentDate, Real nominal, const Date& startDate, const Date& endDate, - Natural fixingDays, - const ext::shared_ptr& zeroIndex, + const ext::shared_ptr& index, const Period& observationLag, CPI::InterpolationType observationInterpolation, const DayCounter& dayCounter, @@ -68,17 +134,21 @@ namespace QuantLib { const Date& refPeriodStart, const Date& refPeriodEnd, const Date& exCouponDate) - : InflationCoupon(paymentDate, nominal, startDate, endDate, - fixingDays, zeroIndex, observationLag, - dayCounter, refPeriodStart, refPeriodEnd, exCouponDate), + : InflationCoupon(paymentDate, nominal, startDate, endDate, 0, + index, observationLag, dayCounter, + refPeriodStart, refPeriodEnd, exCouponDate), baseCPI_(baseCPI), fixedRate_(fixedRate), spread_(spread), - observationInterpolation_(observationInterpolation) { + observationInterpolation_(observationInterpolation), baseDate_(baseDate) { - QL_REQUIRE(zeroIndex, "no index provided"); - QL_REQUIRE(std::fabs(baseCPI_) > 1e-16, + QL_REQUIRE(index_, "no index provided"); + QL_REQUIRE( + baseCPI_ != Null() || baseDate != Null(), + "baseCPI and baseDate can not be both null, provide a valid baseCPI or baseDate"); + QL_REQUIRE(baseCPI_ == Null() || std::fabs(baseCPI_) > 1e-16, "|baseCPI_| < 1e-16, future divide-by-zero problem"); } + QL_DEPRECATED_ENABLE_WARNING void CPICoupon::accept(AcyclicVisitor& v) { auto* v1 = dynamic_cast*>(&v); @@ -88,39 +158,40 @@ namespace QuantLib { InflationCoupon::accept(v); } - - bool CPICoupon::checkPricerImpl( - const ext::shared_ptr&pricer) const { - return static_cast( - ext::dynamic_pointer_cast(pricer)); + Real CPICoupon::accruedAmount(const Date& d) const { + if (d <= accrualStartDate_ || d > paymentDate_) { + return 0.0; + } else { + auto pricer = ext::dynamic_pointer_cast(pricer_); + QL_REQUIRE(pricer, "pricer not set or of wrong type"); + pricer->initialize(*this); + return nominal() * pricer->accruedRate(d) * accruedPeriod(d); + } } + Rate CPICoupon::indexRatio(Date d) const { - Rate CPICoupon::indexFixing(const Date &d) const { - // you may want to modify the interpolation of the index - // this gives you the chance + Rate I0 = baseCPI(); - Rate I1; - // what interpolation do we use? Index / flat / linear - if (observationInterpolation() == CPI::AsIndex) { - I1 = cpiIndex()->fixing(d); + if (I0 == Null()) { + I0 = CPI::laggedFixing(cpiIndex(), + baseDate() + observationLag(), + observationLag(), + observationInterpolation()); + } - } else { - // work out what it should be - std::pair dd = inflationPeriod(d, cpiIndex()->frequency()); - Real indexStart = cpiIndex()->fixing(dd.first); - if (observationInterpolation() == CPI::Linear) { - Real indexEnd = cpiIndex()->fixing(dd.second+Period(1,Days)); - // linear interpolation - I1 = indexStart + (indexEnd - indexStart) * (d - dd.first) - / (Real)( (dd.second+Period(1,Days)) - dd.first); // can't get to next period's value within current period - } else { - // no interpolation, i.e. flat = constant, so use start-of-period value - I1 = indexStart; - } + Rate I1 = CPI::laggedFixing(cpiIndex(), + d, + observationLag(), + observationInterpolation()); - } - return I1; + return I1 / I0; + } + + bool CPICoupon::checkPricerImpl( + const ext::shared_ptr&pricer) const { + return static_cast( + ext::dynamic_pointer_cast(pricer)); } @@ -138,29 +209,11 @@ namespace QuantLib { baseFixing_(baseFixing), observationDate_(observationDate), observationLag_(observationLag), interpolation_(interpolation), frequency_(index ? index->frequency() : NoFrequency) { QL_REQUIRE(index, "no index provided"); - QL_REQUIRE(std::fabs(baseFixing_)>1e-16, - "|baseFixing|<1e-16, future divide-by-zero error"); - } - - CPICashFlow::CPICashFlow(Real notional, - const ext::shared_ptr& index, - const Date& baseDate, - Real baseFixing, - const Date& fixingDate, - const Date& paymentDate, - bool growthOnly, - CPI::InterpolationType interpolation, - const Frequency& frequency) - : IndexedCashFlow(notional, index, baseDate, fixingDate, - paymentDate, growthOnly), - baseFixing_(baseFixing), interpolation_(interpolation), - frequency_(frequency) { - QL_REQUIRE(std::fabs(baseFixing_)>1e-16, - "|baseFixing|<1e-16, future divide-by-zero error"); - if (interpolation_ != CPI::AsIndex) { - QL_REQUIRE(frequency_ != QuantLib::NoFrequency, - "non-index interpolation w/o frequency"); - } + QL_REQUIRE( + baseFixing_ != Null() || baseDate != Null(), + "baseCPI and baseDate can not be both null, provide a valid baseCPI or baseDate"); + QL_REQUIRE(baseFixing_ == Null() || std::fabs(baseFixing_) > 1e-16, + "|baseCPI_| < 1e-16, future divide-by-zero problem"); } Date CPICashFlow::baseDate() const { @@ -186,6 +239,22 @@ namespace QuantLib { } } + Real CPICashFlow::amount() const { + Rate I0 = baseFixing(); + + // If BaseFixing is null, use the observed index fixing + if (I0 == Null()) { + I0 = IndexedCashFlow::baseFixing(); + } + + Rate I1 = indexFixing(); + + if (growthOnly()) + return notional() * (I1 / I0 - 1.0); + else + return notional() * (I1 / I0); + } + CPILeg::CPILeg(const Schedule& schedule, ext::shared_ptr index, const Real baseCPI, @@ -194,7 +263,7 @@ namespace QuantLib { observationLag_(observationLag), paymentDayCounter_(Thirty360(Thirty360::BondBasis)), paymentCalendar_(schedule.calendar()), - spreads_(std::vector(1, 0)) {} + spreads_(std::vector(1, 0)), baseDate_(Null()) {} CPILeg& CPILeg::withObservationInterpolation(CPI::InterpolationType interp) { @@ -243,14 +312,6 @@ namespace QuantLib { return *this; } - CPILeg& CPILeg::withFixingDays(Natural fixingDays) { - return *this; - } - - CPILeg& CPILeg::withFixingDays(const std::vector& fixingDays) { - return *this; - } - CPILeg& CPILeg::withSpreads(Spread spread) { spreads_ = std::vector(1,spread); return *this; @@ -293,6 +354,11 @@ namespace QuantLib { return *this; } + CPILeg& CPILeg::withBaseDate(const Date& baseDate) { + baseDate_ = baseDate; + return *this; + } + CPILeg::operator Leg() const { @@ -300,9 +366,18 @@ namespace QuantLib { Size n = schedule_.size()-1; Leg leg; leg.reserve(n+1); // +1 for notional, we always have some sort ... + + Date baseDate = baseDate_; + // BaseDate and baseCPI are not given, use the first date as startDate and the baseFixingg + // should be at startDate - observationLag + if (n>0) { QL_REQUIRE(!fixedRates_.empty() || !spreads_.empty(), "no fixedRates or spreads given"); + + if (baseDate_ == Null() && baseCPI_ == Null()) { + baseDate = schedule_.date(0) - observationLag_; + } Date refStart, start, refEnd, end; @@ -335,8 +410,10 @@ namespace QuantLib { paymentDayCounter_, start, end, refStart, refEnd, exCouponDate)); } else { // zero inflation coupon if (detail::noOption(caps_, floors_, i)) { // just swaplet + QL_DEPRECATED_DISABLE_WARNING leg.push_back(ext::make_shared (baseCPI_, // all have same base for ratio + baseDate, paymentDate, detail::get(notionals_, i, 0.0), start, end, @@ -346,6 +423,7 @@ namespace QuantLib { detail::get(fixedRates_, i, 0.0), detail::get(spreads_, i, 0.0), refStart, refEnd, exCouponDate)); + QL_DEPRECATED_ENABLE_WARNING } else { // cap/floorlet QL_FAIL("caps/floors on CPI coupons not implemented."); } @@ -357,7 +435,7 @@ namespace QuantLib { Date paymentDate = paymentCalendar_.adjust(schedule_.date(n), paymentAdjustment_); leg.push_back(ext::make_shared (detail::get(notionals_, n, 0.0), index_, - Date(), baseCPI_, // no base date provided + baseDate, baseCPI_, schedule_.date(n), observationLag_, observationInterpolation_, paymentDate, subtractInflationNominal_)); diff --git a/ql/cashflows/cpicoupon.hpp b/ql/cashflows/cpicoupon.hpp index 74ddfb41a1f..d8945e6944f 100644 --- a/ql/cashflows/cpicoupon.hpp +++ b/ql/cashflows/cpicoupon.hpp @@ -2,6 +2,7 @@ /* Copyright (C) 2011 Chris Kenyon + Copyright (C) 2022 Quaternion Risk Management Ltd This file is part of QuantLib, a free-software/open-source library for financial quantitative analysts and developers - http://quantlib.org/ @@ -53,7 +54,38 @@ namespace QuantLib { */ class CPICoupon : public InflationCoupon { public: + //! \name Constructors + //@{ + CPICoupon(Real baseCPI, + const Date& paymentDate, + Real nominal, + const Date& startDate, + const Date& endDate, + const ext::shared_ptr& index, + const Period& observationLag, + CPI::InterpolationType observationInterpolation, + const DayCounter& dayCounter, + Real fixedRate, + const Date& refPeriodStart = Date(), + const Date& refPeriodEnd = Date(), + const Date& exCouponDate = Date()); + + CPICoupon(const Date& baseDate, // user provided, could be arbitrary + const Date& paymentDate, + Real nominal, + const Date& startDate, + const Date& endDate, + const ext::shared_ptr& index, + const Period& observationLag, + CPI::InterpolationType observationInterpolation, + const DayCounter& dayCounter, + Real fixedRate, + const Date& refPeriodStart = Date(), + const Date& refPeriodEnd = Date(), + const Date& exCouponDate = Date()); + CPICoupon(Real baseCPI, // user provided, could be arbitrary + const Date& baseDate, const Date& paymentDate, Real nominal, const Date& startDate, @@ -62,45 +94,84 @@ namespace QuantLib { const Period& observationLag, CPI::InterpolationType observationInterpolation, const DayCounter& dayCounter, - Real fixedRate, // aka gearing - Spread spread = 0.0, + Real fixedRate, const Date& refPeriodStart = Date(), const Date& refPeriodEnd = Date(), const Date& exCouponDate = Date()); - /*! \deprecated Use the other constructor instead. - Deprecated in version 1.26. + /*! \deprecated Use one of the constructors without spread. + Deprecated in version 1.31. */ QL_DEPRECATED - CPICoupon(Real baseCPI, + CPICoupon(Real baseCPI, // user provided, could be arbitrary const Date& paymentDate, Real nominal, const Date& startDate, const Date& endDate, - Natural fixingDays, const ext::shared_ptr& index, const Period& observationLag, CPI::InterpolationType observationInterpolation, const DayCounter& dayCounter, - Real fixedRate, // aka gearing - Spread spread = 0.0, + Real fixedRate, + Spread spread, const Date& refPeriodStart = Date(), const Date& refPeriodEnd = Date(), const Date& exCouponDate = Date()); + /*! \deprecated Use one of the constructors without spread. + Deprecated in version 1.31. + */ + QL_DEPRECATED + CPICoupon(const Date& baseDate, // user provided, could be arbitrary + const Date& paymentDate, + Real nominal, + const Date& startDate, + const Date& endDate, + const ext::shared_ptr& index, + const Period& observationLag, + CPI::InterpolationType observationInterpolation, + const DayCounter& dayCounter, + Real fixedRate, + Spread spread, + const Date& refPeriodStart = Date(), + const Date& refPeriodEnd = Date(), + const Date& exCouponDate = Date()); + + /*! \deprecated Use one of the constructors without spread. + Deprecated in version 1.31. + */ + QL_DEPRECATED + CPICoupon(Real baseCPI, // user provided, could be arbitrary + const Date& baseDate, + const Date& paymentDate, + Real nominal, + const Date& startDate, + const Date& endDate, + const ext::shared_ptr& index, + const Period& observationLag, + CPI::InterpolationType observationInterpolation, + const DayCounter& dayCounter, + Real fixedRate, + Spread spread, + const Date& refPeriodStart = Date(), + const Date& refPeriodEnd = Date(), + const Date& exCouponDate = Date()); + //@} + + QL_DEPRECATED_DISABLE_WARNING + ~CPICoupon() override = default; + QL_DEPRECATED_ENABLE_WARNING + //! \name Inspectors //@{ //! fixed rate that will be inflated by the index ratio Real fixedRate() const; - //! spread paid over the fixing of the underlying index - Spread spread() const; - - //! the ratio between the end index fixing and the base CPI - /*! This might include adjustments calculated by the pricer */ - Rate adjustedIndexGrowth() const; - //! the index value observed (with a lag) at the end date - Rate indexFixing() const override; + /*! \deprecated Do not use this method. A spread doesn't make sense for this coupon. + Deprecated in version 1.31. + */ + [[deprecated("Do not use this method. A spread doesn't make sense for this coupon.")]] + Spread spread() const; //! base value for the CPI index /*! \warning make sure that the interpolation used to create @@ -108,25 +179,33 @@ namespace QuantLib { i.e. the observationInterpolation. */ Rate baseCPI() const; - //! how do you observe the index? as-is, flat, linear? - CPI::InterpolationType observationInterpolation() const; - /*! \deprecated Use CPI::laggedFixing instead. - Deprecated in version 1.26. - */ - QL_DEPRECATED - Rate indexObservation(const Date& onDate) const; + //! base date for the base fixing of the CPI index + Date baseDate() const; - /*! \deprecated Renamed to adjustedIndexGrowth. - Deprecated in version 1.26. - */ - QL_DEPRECATED - Rate adjustedFixing() const; + //! how do you observe the index? as-is, flat, linear? + CPI::InterpolationType observationInterpolation() const; //! index used ext::shared_ptr cpiIndex() const; //@} + //! \name Calculations + //@{ + Real accruedAmount(const Date&) const override; + + //! the index value observed (with a lag) at the end date + Rate indexFixing() const override; + + //! the ratio between the index fixing at the passed date and the base CPI + /*! No adjustments are applied */ + Rate indexRatio(Date d) const; + + //! the ratio between the end index fixing and the base CPI + /*! This might include adjustments calculated by the pricer */ + Rate adjustedIndexGrowth() const; + //@} + //! \name Visitability //@{ void accept(AcyclicVisitor&) override; @@ -134,16 +213,15 @@ namespace QuantLib { protected: Real baseCPI_; Real fixedRate_; + /*! \deprecated Don't use this data member. A spread doesn't make sense for this coupon. + Deprecated in version 1.31. + */ + [[deprecated("Do not use this data member. A spread doesn't make sense for this coupon.")]] Spread spread_; CPI::InterpolationType observationInterpolation_; + Date baseDate_; bool checkPricerImpl(const ext::shared_ptr&) const override; - - /*! \deprecated Use CPI::laggedFixing instead. - Deprecated in version 1.26. - */ - QL_DEPRECATED - Rate indexFixing(const Date &) const; }; @@ -161,20 +239,6 @@ namespace QuantLib { const Date& paymentDate, bool growthOnly = false); - /*! \deprecated Use the other constructor. - Deprecated in version 1.26. - */ - QL_DEPRECATED - CPICashFlow(Real notional, - const ext::shared_ptr& index, - const Date& baseDate, - Real baseFixing, - const Date& fixingDate, - const Date& paymentDate, - bool growthOnly = false, - CPI::InterpolationType interpolation = CPI::AsIndex, - const Frequency& frequency = QuantLib::NoFrequency); - //! value used on base date /*! This does not have to agree with index on that date. */ Real baseFixing() const override; @@ -193,6 +257,8 @@ namespace QuantLib { Real indexFixing() const override; + Real amount() const override; + protected: Real baseFixing_; Date observationDate_; @@ -205,10 +271,8 @@ namespace QuantLib { //! Helper class building a sequence of capped/floored CPI coupons. /*! Also allowing for the inflated notional at the end... especially if there is only one date in the schedule. - If a fixedRate is zero you get a FixedRateCoupon, otherwise + If the fixed rate is zero you get a FixedRateCoupon, otherwise you get a ZeroInflationCoupon. - - payoff is: spread + fixedRate x index */ class CPILeg { public: @@ -223,19 +287,17 @@ namespace QuantLib { CPILeg& withPaymentDayCounter(const DayCounter&); CPILeg& withPaymentAdjustment(BusinessDayConvention); CPILeg& withPaymentCalendar(const Calendar&); - /*! \deprecated No-op; do not use. - Deprecated in version 1.26. - */ - QL_DEPRECATED - CPILeg& withFixingDays(Natural fixingDays); - /*! \deprecated No-op; do not use. - Deprecated in version 1.26. - */ - QL_DEPRECATED - CPILeg& withFixingDays(const std::vector& fixingDays); CPILeg& withObservationInterpolation(CPI::InterpolationType); CPILeg& withSubtractInflationNominal(bool); + /*! \deprecated Do not use this method. A spread doesn't make sense for these coupons. + Deprecated in version 1.31. + */ + [[deprecated("Do not use this method. A spread doesn't make sense for these coupons.")]] CPILeg& withSpreads(Spread spread); + /*! \deprecated Do not use this method. A spread doesn't make sense for these coupons. + Deprecated in version 1.31. + */ + [[deprecated("Do not use this method. A spread doesn't make sense for these coupons.")]] CPILeg& withSpreads(const std::vector& spreads); CPILeg& withCaps(Rate cap); CPILeg& withCaps(const std::vector& caps); @@ -245,6 +307,8 @@ namespace QuantLib { const Calendar&, BusinessDayConvention, bool endOfMonth = false); + CPILeg& withBaseDate(const Date& baseDate); + operator Leg() const; private: @@ -253,7 +317,7 @@ namespace QuantLib { Real baseCPI_; Period observationLag_; std::vector notionals_; - std::vector fixedRates_; // aka gearing + std::vector fixedRates_; DayCounter paymentDayCounter_; BusinessDayConvention paymentAdjustment_ = ModifiedFollowing; Calendar paymentCalendar_; @@ -265,6 +329,7 @@ namespace QuantLib { Calendar exCouponCalendar_; BusinessDayConvention exCouponAdjustment_ = Following; bool exCouponEndOfMonth_ = false; + Date baseDate_ = Null(); }; @@ -275,11 +340,15 @@ namespace QuantLib { } inline Real CPICoupon::spread() const { + QL_DEPRECATED_DISABLE_WARNING return spread_; + QL_DEPRECATED_ENABLE_WARNING } inline Rate CPICoupon::adjustedIndexGrowth() const { + QL_DEPRECATED_DISABLE_WARNING return (rate()-spread())/fixedRate(); + QL_DEPRECATED_ENABLE_WARNING } inline Rate CPICoupon::indexFixing() const { @@ -290,18 +359,12 @@ namespace QuantLib { return baseCPI_; } - inline CPI::InterpolationType CPICoupon::observationInterpolation() const { - return observationInterpolation_; + inline Date CPICoupon::baseDate() const { + return baseDate_; } - inline Rate CPICoupon::indexObservation(const Date& onDate) const { - QL_DEPRECATED_DISABLE_WARNING - return indexFixing(onDate); - QL_DEPRECATED_ENABLE_WARNING - } - - inline Rate CPICoupon::adjustedFixing() const { - return adjustedIndexGrowth(); + inline CPI::InterpolationType CPICoupon::observationInterpolation() const { + return observationInterpolation_; } inline ext::shared_ptr CPICoupon::cpiIndex() const { diff --git a/ql/cashflows/cpicouponpricer.cpp b/ql/cashflows/cpicouponpricer.cpp index 20cb28828a1..afd937c9355 100644 --- a/ql/cashflows/cpicouponpricer.cpp +++ b/ql/cashflows/cpicouponpricer.cpp @@ -2,6 +2,7 @@ /* Copyright (C) 2009, 2011 Chris Kenyon + Copyright (C) 2022 Quaternion Risk Management Ltd This file is part of QuantLib, a free-software/open-source library for financial quantitative analysts and developers - http://quantlib.org/ @@ -22,6 +23,8 @@ namespace QuantLib { + QL_DEPRECATED_DISABLE_WARNING + CPICouponPricer::CPICouponPricer(Handle nominalTermStructure) : nominalTermStructure_(std::move(nominalTermStructure)) { registerWith(nominalTermStructure_); @@ -34,6 +37,7 @@ namespace QuantLib { registerWith(nominalTermStructure_); } + QL_DEPRECATED_ENABLE_WARNING void CPICouponPricer::setCapletVolatility( const Handle& capletVol) { @@ -99,27 +103,30 @@ namespace QuantLib { Real stdDev = std::sqrt(capletVolatility()->totalVariance(fixingDate, effStrike)); + QL_DEPRECATED_DISABLE_WARNING return optionletPriceImp(optionType, effStrike, adjustedFixing(), stdDev); + QL_DEPRECATED_ENABLE_WARNING } } Rate CPICouponPricer::adjustedFixing(Rate fixing) const { - if (fixing == Null()) - fixing = coupon_->indexFixing() / coupon_->baseCPI(); + if (fixing != Null()) + return fixing; - // no further adjustment - return fixing; + return coupon_->indexRatio(coupon_->accrualEndDate()); } void CPICouponPricer::initialize(const InflationCoupon& coupon) { coupon_ = dynamic_cast(&coupon); gearing_ = coupon_->fixedRate(); + QL_DEPRECATED_DISABLE_WARNING spread_ = coupon_->spread(); + QL_DEPRECATED_ENABLE_WARNING paymentDate_ = coupon_->date(); // past or future fixing is managed in YoYInflationIndex::fixing() @@ -143,11 +150,18 @@ namespace QuantLib { Rate CPICouponPricer::swapletRate() const { - // This way we do not require the index to have - // a yield curve, i.e. we do not get the problem - // that a discounting-instrument-pricer is used - // with a different yield curve + QL_DEPRECATED_DISABLE_WARNING return gearing_ * adjustedFixing() + spread_; + QL_DEPRECATED_ENABLE_WARNING + // after deprecating and removing adjustedFixing: + // return accruedRate(coupon_->accrualEndDate()); + } + + + Rate CPICouponPricer::accruedRate(Date settlementDate) const { + QL_DEPRECATED_DISABLE_WARNING + return gearing_ * coupon_->indexRatio(settlementDate) + spread_; + QL_DEPRECATED_ENABLE_WARNING } } diff --git a/ql/cashflows/cpicouponpricer.hpp b/ql/cashflows/cpicouponpricer.hpp index 9417df63b86..601d4f5aaee 100644 --- a/ql/cashflows/cpicouponpricer.hpp +++ b/ql/cashflows/cpicouponpricer.hpp @@ -43,6 +43,10 @@ namespace QuantLib { explicit CPICouponPricer(Handle capletVol, Handle nominalTermStructure = Handle()); + QL_DEPRECATED_DISABLE_WARNING + ~CPICouponPricer() override = default; + QL_DEPRECATED_ENABLE_WARNING + virtual Handle capletVolatility() const{ return capletVol_; } @@ -66,6 +70,7 @@ namespace QuantLib { void initialize(const InflationCoupon&) override; //@} + virtual Rate accruedRate(Date settlementDate) const; protected: virtual Real optionletPrice(Option::Type optionType, @@ -82,13 +87,22 @@ namespace QuantLib { */ virtual Real optionletPriceImp(Option::Type, Real strike, Real forward, Real stdDev) const; + + /*! \deprecated Don't use this method. In derived classes, override accruedRate. + Deprecated in version 1.31. + */ + [[deprecated("Do not use this method. In derived classes, override accruedRate.")]] virtual Rate adjustedFixing(Rate fixing = Null()) const; - //! data + // data Handle capletVol_; Handle nominalTermStructure_; const CPICoupon* coupon_; Real gearing_; + /*! \deprecated Don't use this data member. A spread doesn't make sense for this coupon. + Deprecated in version 1.31. + */ + [[deprecated("Do not use this data member. A spread doesn't make sense for these coupons.")]] Spread spread_; Real discount_; }; diff --git a/ql/cashflows/digitalcoupon.cpp b/ql/cashflows/digitalcoupon.cpp index 6e23959a9e4..72b8b15c4af 100644 --- a/ql/cashflows/digitalcoupon.cpp +++ b/ql/cashflows/digitalcoupon.cpp @@ -217,7 +217,12 @@ namespace QuantLib { return putOptionRate; } - Rate DigitalCoupon::rate() const { + void DigitalCoupon::deepUpdate() { + update(); + underlying_->deepUpdate(); + } + + void DigitalCoupon::performCalculations() const { QL_REQUIRE(underlying_->pricer(), "pricer not set"); @@ -229,18 +234,24 @@ namespace QuantLib { if (fixingDate < today || ((fixingDate == today) && enforceTodaysHistoricFixings)) { // must have been fixed - return underlyingRate + callCsi_ * callPayoff() + putCsi_ * putPayoff(); - } - if (fixingDate == today) { + rate_ = underlyingRate + callCsi_ * callPayoff() + putCsi_ * putPayoff(); + } else if (fixingDate == today) { // might have been fixed Rate pastFixing = IndexManager::instance().getHistory((underlying_->index())->name())[fixingDate]; if (pastFixing != Null()) { - return underlyingRate + callCsi_ * callPayoff() + putCsi_ * putPayoff(); - } else - return underlyingRate + callCsi_ * callOptionRate() + putCsi_ * putOptionRate(); + rate_ = underlyingRate + callCsi_ * callPayoff() + putCsi_ * putPayoff(); + } else { + rate_ = underlyingRate + callCsi_ * callOptionRate() + putCsi_ * putOptionRate(); + } + } else { + rate_ = underlyingRate + callCsi_ * callOptionRate() + putCsi_ * putOptionRate(); } - return underlyingRate + callCsi_ * callOptionRate() + putCsi_ * putOptionRate(); + } + + Rate DigitalCoupon::rate() const { + calculate(); + return rate_; } Rate DigitalCoupon::convexityAdjustment() const { @@ -275,10 +286,6 @@ namespace QuantLib { return Null(); } - void DigitalCoupon::update() { - notifyObservers(); - } - void DigitalCoupon::accept(AcyclicVisitor& v) { typedef FloatingRateCoupon super; auto* v1 = dynamic_cast*>(&v); diff --git a/ql/cashflows/digitalcoupon.hpp b/ql/cashflows/digitalcoupon.hpp index bcd61e5b719..542594156e0 100644 --- a/ql/cashflows/digitalcoupon.hpp +++ b/ql/cashflows/digitalcoupon.hpp @@ -94,6 +94,14 @@ namespace QuantLib { ext::shared_ptr(), bool nakedOption = false); + //@} + //! \name Obverver interface + //@{ + void deepUpdate() override; + //@} + //! \name LazyObject interface + //@{ + void performCalculations() const override; //@} //! \name Coupon interface //@{ @@ -122,10 +130,6 @@ namespace QuantLib { */ Rate putOptionRate() const; //@} - //! \name Observer interface - //@{ - void update() override; - //@} //! \name Visitability //@{ void accept(AcyclicVisitor&) override; diff --git a/ql/cashflows/equitycashflow.cpp b/ql/cashflows/equitycashflow.cpp new file mode 100644 index 00000000000..dcad33a1834 --- /dev/null +++ b/ql/cashflows/equitycashflow.cpp @@ -0,0 +1,135 @@ +/* -*- mode: c++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ + +/* + Copyright (C) 2023 Marcin Rybacki + + This file is part of QuantLib, a free-software/open-source library + for financial quantitative analysts and developers - http://quantlib.org/ + + QuantLib is free software: you can redistribute it and/or modify it + under the terms of the QuantLib license. You should have received a + copy of the license along with this program; if not, please email + . The license is also available online at + . + + This program is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS + FOR A PARTICULAR PURPOSE. See the license for more details. +*/ + +#include +#include +#include +#include +#include +#include +#include +#include + +namespace QuantLib { + + namespace { + Handle + configureDividendHandle(const Handle& dividendHandle) { + if (dividendHandle.empty()) { + ext::shared_ptr flatTs(ext::make_shared( + 0, NullCalendar(), Handle(ext::make_shared(0.0)), + Actual365Fixed())); + return Handle(flatTs); + } + return dividendHandle; + } + } + + void setCouponPricer(const Leg& leg, const ext::shared_ptr& p) { + for (const auto& i : leg) { + ext::shared_ptr c = + ext::dynamic_pointer_cast(i); + if (c != nullptr) + c->setPricer(p); + } + } + + EquityCashFlow::EquityCashFlow(Real notional, + ext::shared_ptr index, + const Date& baseDate, + const Date& fixingDate, + const Date& paymentDate, + bool growthOnly) + : IndexedCashFlow(notional, std::move(index), baseDate, fixingDate, paymentDate, growthOnly) {} + + void EquityCashFlow::setPricer(const ext::shared_ptr& pricer) { + if (pricer_ != nullptr) + unregisterWith(pricer_); + pricer_ = pricer; + if (pricer_ != nullptr) + registerWith(pricer_); + update(); + } + + Real EquityCashFlow::amount() const { + if (!pricer_) + return IndexedCashFlow::amount(); + pricer_->initialize(*this); + return notional() * pricer_->price(); + } + + EquityQuantoCashFlowPricer::EquityQuantoCashFlowPricer( + Handle quantoCurrencyTermStructure, + Handle equityVolatility, + Handle fxVolatility, + Handle correlation) + : quantoCurrencyTermStructure_(std::move(quantoCurrencyTermStructure)), + equityVolatility_(std::move(equityVolatility)), fxVolatility_(std::move(fxVolatility)), + correlation_(std::move(correlation)){ + registerWith(quantoCurrencyTermStructure_); + registerWith(equityVolatility_); + registerWith(fxVolatility_); + registerWith(correlation_); + } + + void EquityQuantoCashFlowPricer::initialize(const EquityCashFlow& cashFlow) { + index_ = ext::dynamic_pointer_cast(cashFlow.index()); + if (!index_) { + QL_FAIL("Equity index required."); + } + baseDate_ = cashFlow.baseDate(); + fixingDate_ = cashFlow.fixingDate(); + QL_REQUIRE(fixingDate_ >= baseDate_, "Fixing date cannot fall before base date."); + growthOnlyPayoff_ = cashFlow.growthOnly(); + + QL_REQUIRE(!quantoCurrencyTermStructure_.empty(), + "Quanto currency term structure handle cannot be empty."); + QL_REQUIRE(!equityVolatility_.empty(), + "Equity volatility term structure handle cannot be empty."); + QL_REQUIRE(!fxVolatility_.empty(), + "FX volatility term structure handle cannot be empty."); + QL_REQUIRE(!correlation_.empty(), "Correlation handle cannot be empty."); + + QL_REQUIRE(quantoCurrencyTermStructure_->referenceDate() == + equityVolatility_->referenceDate() && + equityVolatility_->referenceDate() == fxVolatility_->referenceDate(), + "Quanto currency term structure, equity and FX volatility need to have the same " + "reference date."); + } + + Real EquityQuantoCashFlowPricer::price() const { + Real strike = index_->fixing(fixingDate_); + Handle dividendHandle = + configureDividendHandle(index_->equityDividendCurve()); + + Handle quantoTermStructure(ext::make_shared( + dividendHandle, quantoCurrencyTermStructure_, + index_->equityInterestRateCurve(), equityVolatility_, strike, fxVolatility_, 1.0, + correlation_->value())); + ext::shared_ptr quantoIndex = + index_->clone(quantoCurrencyTermStructure_, quantoTermStructure, index_->spot()); + + Real I0 = quantoIndex->fixing(baseDate_); + Real I1 = quantoIndex->fixing(fixingDate_); + + if (growthOnlyPayoff_) + return I1 / I0 - 1.0; + return I1 / I0; + } +} \ No newline at end of file diff --git a/ql/cashflows/equitycashflow.hpp b/ql/cashflows/equitycashflow.hpp new file mode 100644 index 00000000000..4ae554f458c --- /dev/null +++ b/ql/cashflows/equitycashflow.hpp @@ -0,0 +1,107 @@ +/* -*- mode: c++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ + +/* + Copyright (C) 2023 Marcin Rybacki + + This file is part of QuantLib, a free-software/open-source library + for financial quantitative analysts and developers - http://quantlib.org/ + + QuantLib is free software: you can redistribute it and/or modify it + under the terms of the QuantLib license. You should have received a + copy of the license along with this program; if not, please email + . The license is also available online at + . + + This program is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS + FOR A PARTICULAR PURPOSE. See the license for more details. +*/ + +/*! \file equitycashflow.hpp + \brief equity cash flow +*/ + +#ifndef quantlib_equity_cash_flow_hpp +#define quantlib_equity_cash_flow_hpp + +#include +#include +#include +#include + +namespace QuantLib { + + class EquityIndex; + class EquityCashFlowPricer; + + class EquityCashFlow : public IndexedCashFlow { + public: + EquityCashFlow(Real notional, + ext::shared_ptr index, + const Date& baseDate, + const Date& fixingDate, + const Date& paymentDate, + bool growthOnly = true); + //! \name CashFlow interface + //@{ + Real amount() const override; + //@} + //! \name Visitability + //@{ + void accept(AcyclicVisitor&) override; + //@} + void setPricer(const ext::shared_ptr&); + const ext::shared_ptr& pricer() const { return pricer_; }; + + private: + ext::shared_ptr pricer_; + }; + + inline void EquityCashFlow::accept(AcyclicVisitor& v) { + auto* v1 = dynamic_cast*>(&v); + if (v1 != nullptr) + v1->visit(*this); + else + IndexedCashFlow::accept(v); + } + + void setCouponPricer(const Leg& leg, const ext::shared_ptr&); + + class EquityCashFlowPricer : public virtual Observer, public virtual Observable { + public: + EquityCashFlowPricer() = default; + //! \name Interface + //@{ + virtual Real price() const = 0; + virtual void initialize(const EquityCashFlow&) = 0; + //@} + + //! \name Observer interface + //@{ + void update() override { notifyObservers(); } + //@} + protected: + ext::shared_ptr index_; + Date baseDate_, fixingDate_; + bool growthOnlyPayoff_; + }; + + class EquityQuantoCashFlowPricer : public EquityCashFlowPricer { + public: + EquityQuantoCashFlowPricer(Handle quantoCurrencyTermStructure, + Handle equityVolatility, + Handle fxVolatility, + Handle correlation); + //! \name Interface + //@{ + Real price() const override; + void initialize(const EquityCashFlow&) override; + //@} + private: + Handle quantoCurrencyTermStructure_, quantoTermStructure; + Handle equityVolatility_, fxVolatility_; + Handle correlation_; + }; +} + +#endif \ No newline at end of file diff --git a/ql/cashflows/floatingratecoupon.cpp b/ql/cashflows/floatingratecoupon.cpp index a039d6b9c80..69cd4a70ab0 100644 --- a/ql/cashflows/floatingratecoupon.cpp +++ b/ql/cashflows/floatingratecoupon.cpp @@ -84,9 +84,14 @@ namespace QuantLib { } Rate FloatingRateCoupon::rate() const { + calculate(); + return rate_; + } + + void FloatingRateCoupon::performCalculations() const { QL_REQUIRE(pricer_, "pricer not set"); pricer_->initialize(*this); - return pricer_->swapletRate(); + rate_ = pricer_->swapletRate(); } Real FloatingRateCoupon::price(const Handle& discountingCurve) const { diff --git a/ql/cashflows/floatingratecoupon.hpp b/ql/cashflows/floatingratecoupon.hpp index bdd8e2201ba..d1d6ece9015 100644 --- a/ql/cashflows/floatingratecoupon.hpp +++ b/ql/cashflows/floatingratecoupon.hpp @@ -31,6 +31,7 @@ #include #include +#include #include #include @@ -41,8 +42,7 @@ namespace QuantLib { class FloatingRateCouponPricer; //! base floating-rate coupon class - class FloatingRateCoupon : public Coupon, - public Observer { + class FloatingRateCoupon : public Coupon, public LazyObject { public: FloatingRateCoupon(const Date& paymentDate, Real nominal, @@ -58,6 +58,10 @@ namespace QuantLib { bool isInArrears = false, const Date& exCouponDate = Date()); + //! \name LazyObject interface + //@{ + void performCalculations() const override; + //@} //! \name CashFlow interface //@{ Real amount() const override { return rate() * accrualPeriod() * nominal(); } @@ -93,11 +97,6 @@ namespace QuantLib { bool isInArrears() const { return isInArrears_; } //@} - //! \name Observer interface - //@{ - void update() override { notifyObservers(); } - //@} - //! \name Visitability //@{ void accept(AcyclicVisitor&) override; @@ -115,6 +114,7 @@ namespace QuantLib { Spread spread_; bool isInArrears_; ext::shared_ptr pricer_; + mutable Real rate_; }; // inline definitions diff --git a/ql/cashflows/iborcoupon.cpp b/ql/cashflows/iborcoupon.cpp index bd986b05dd7..bab3d3f5298 100644 --- a/ql/cashflows/iborcoupon.cpp +++ b/ql/cashflows/iborcoupon.cpp @@ -27,6 +27,7 @@ #include #include #include +#include #include namespace QuantLib { @@ -255,7 +256,7 @@ namespace QuantLib { return *this; } - IborLeg& IborLeg::withIndexedCoupons(boost::optional b) { + IborLeg& IborLeg::withIndexedCoupons(ext::optional b) { useIndexedCoupons_ = b; return *this; } diff --git a/ql/cashflows/iborcoupon.hpp b/ql/cashflows/iborcoupon.hpp index 88478d2be0e..1f85f195dd9 100644 --- a/ql/cashflows/iborcoupon.hpp +++ b/ql/cashflows/iborcoupon.hpp @@ -33,6 +33,7 @@ #include #include #include +#include namespace QuantLib { @@ -154,7 +155,7 @@ namespace QuantLib { const Calendar&, BusinessDayConvention, bool endOfMonth = false); - IborLeg& withIndexedCoupons(boost::optional b = true); + IborLeg& withIndexedCoupons(ext::optional b = true); IborLeg& withAtParCoupons(bool b = true); operator Leg() const; @@ -175,7 +176,7 @@ namespace QuantLib { Calendar exCouponCalendar_; BusinessDayConvention exCouponAdjustment_ = Unadjusted; bool exCouponEndOfMonth_ = false; - boost::optional useIndexedCoupons_; + ext::optional useIndexedCoupons_; }; } diff --git a/ql/cashflows/zeroinflationcashflow.cpp b/ql/cashflows/zeroinflationcashflow.cpp index 0d677b233b1..a79600e36c8 100644 --- a/ql/cashflows/zeroinflationcashflow.cpp +++ b/ql/cashflows/zeroinflationcashflow.cpp @@ -38,23 +38,6 @@ namespace QuantLib { zeroInflationIndex_(index), observationInterpolation_(observationInterpolation), startDate_(startDate), endDate_(endDate), observationLag_(observationLag) {} - ZeroInflationCashFlow::ZeroInflationCashFlow(Real notional, - const ext::shared_ptr& index, - CPI::InterpolationType observationInterpolation, - const Date& startDate, - const Date& endDate, - const Period& observationLag, - const Calendar& calendar, - BusinessDayConvention convention, - const Date& paymentDate, - bool growthOnly) - : IndexedCashFlow(notional, index, - calendar.adjust(startDate - observationLag, convention), - calendar.adjust(endDate - observationLag, convention), - paymentDate, growthOnly), - zeroInflationIndex_(index), observationInterpolation_(observationInterpolation), - startDate_(startDate), endDate_(endDate), observationLag_(observationLag) {} - Real ZeroInflationCashFlow::amount() const { Real I0, I1; diff --git a/ql/cashflows/zeroinflationcashflow.hpp b/ql/cashflows/zeroinflationcashflow.hpp index 6bd8d4296e4..cfb4f6deb88 100644 --- a/ql/cashflows/zeroinflationcashflow.hpp +++ b/ql/cashflows/zeroinflationcashflow.hpp @@ -49,21 +49,6 @@ namespace QuantLib { const Date& paymentDate, bool growthOnly = false); - /*! \deprecated Use the other constructor. - Deprecated in version 1.26. - */ - QL_DEPRECATED - ZeroInflationCashFlow(Real notional, - const ext::shared_ptr& index, - CPI::InterpolationType observationInterpolation, - const Date& startDate, - const Date& endDate, - const Period& observationLag, - const Calendar& calendar, - BusinessDayConvention convention, - const Date& paymentDate, - bool growthOnly = false); - //! \name ZeroInflationCashFlow interface //@{ ext::shared_ptr zeroInflationIndex() const { diff --git a/ql/config.hpp.cfg b/ql/config.hpp.cfg index c8a848b7f05..068123c8f86 100644 --- a/ql/config.hpp.cfg +++ b/ql/config.hpp.cfg @@ -35,7 +35,11 @@ #cmakedefine QL_ERROR_LINES #cmakedefine QL_EXTRA_SAFETY_CHECKS #cmakedefine QL_HIGH_RESOLUTION_DATE +#cmakedefine QL_FASTER_LAZY_OBJECTS +#cmakedefine QL_THROW_IN_CYCLES #cmakedefine QL_USE_INDEXED_COUPON +#cmakedefine QL_USE_STD_ANY +#cmakedefine QL_USE_STD_OPTIONAL #cmakedefine QL_USE_STD_SHARED_PTR #cmakedefine QL_USE_STD_FUNCTION #cmakedefine QL_USE_STD_TUPLE diff --git a/ql/currencies/africa.cpp b/ql/currencies/africa.cpp index 0b5e6aa5c08..cf0ab088953 100644 --- a/ql/currencies/africa.cpp +++ b/ql/currencies/africa.cpp @@ -108,9 +108,6 @@ namespace QuantLib { } // South-African rand - /* The ISO three-letter code is ZAR; the numeric code is 710. - It is divided into 100 cents. - */ ZARCurrency::ZARCurrency() { static ext::shared_ptr zarData( new Data("South-African rand", "ZAR", 710, "R", "", 100, Rounding(), "%3% %1$.2f")); @@ -123,4 +120,5 @@ namespace QuantLib { new Data("Zambian kwacha", "ZMW", 967, "ZMW", "", 100, Rounding(), "1$.2f %3%")); data_ = zmwData; } + } diff --git a/ql/currencies/africa.hpp b/ql/currencies/africa.hpp index 365700e1b2f..2f07b9da341 100644 --- a/ql/currencies/africa.hpp +++ b/ql/currencies/africa.hpp @@ -39,7 +39,7 @@ namespace QuantLib { // Angolan kwanza /*! The ISO three-letter code is AOA; the numeric code is 973. - It is divided into 100 cêntimo. + It is divided into 100 cêntimo. \ingroup currencies */ class AOACurrency : public Currency { @@ -177,6 +177,7 @@ namespace QuantLib { public: ZMWCurrency(); }; + } #if defined(QL_PATCH_MSVC) diff --git a/ql/currencies/europe.cpp b/ql/currencies/europe.cpp index 8f157858276..f83c990a5ae 100644 --- a/ql/currencies/europe.cpp +++ b/ql/currencies/europe.cpp @@ -94,7 +94,7 @@ namespace QuantLib { // Danish krone /* The ISO three-letter code is DKK; the numeric code is 208. - It is divided in 100 øre. + It is divided in 100 øre. */ DKKCurrency::DKKCurrency() { static ext::shared_ptr dkkData( @@ -198,7 +198,7 @@ namespace QuantLib { // Norwegian krone /* The ISO three-letter code is NOK; the numeric code is 578. - It is divided in 100 øre. + It is divided in 100 øre. */ NOKCurrency::NOKCurrency() { static ext::shared_ptr nokData( @@ -265,7 +265,7 @@ namespace QuantLib { // Swedish krona /* The ISO three-letter code is SEK; the numeric code is 752. - It is divided in 100 öre. + It is divided in 100 öre. */ SEKCurrency::SEKCurrency() { static ext::shared_ptr sekData( @@ -376,7 +376,7 @@ namespace QuantLib { // Finnish markka /* The ISO three-letter code was FIM; the numeric code was 246. - It was divided in 100 penniä. + It was divided in 100 penniä. */ FIMCurrency::FIMCurrency() { static ext::shared_ptr fimData( diff --git a/ql/currencies/exchangeratemanager.cpp b/ql/currencies/exchangeratemanager.cpp index b625a95b39b..c5dc8579460 100644 --- a/ql/currencies/exchangeratemanager.cpp +++ b/ql/currencies/exchangeratemanager.cpp @@ -22,6 +22,7 @@ #include #include #include +#include namespace QuantLib { diff --git a/ql/event.cpp b/ql/event.cpp index a5edf97fa2c..bc764b4df86 100644 --- a/ql/event.cpp +++ b/ql/event.cpp @@ -20,12 +20,13 @@ #include #include +#include #include namespace QuantLib { bool Event::hasOccurred(const Date& d, // refDate - boost::optional includeRefDate) const { + ext::optional includeRefDate) const { Date refDate = d != Date() ? d : Settings::instance().evaluationDate(); bool includeRefDateEvent = includeRefDate ? // NOLINT(readability-implicit-bool-conversion) diff --git a/ql/event.hpp b/ql/event.hpp index 65609d6774e..8275cb3f136 100644 --- a/ql/event.hpp +++ b/ql/event.hpp @@ -27,7 +27,7 @@ #include #include -#include +#include namespace QuantLib { @@ -37,7 +37,7 @@ namespace QuantLib { /*! This class acts as a base class for the actual event implementations. */ - class Event : public Observable { + class Event : public virtual Observable { public: ~Event() override = default; //! \name Event interface @@ -52,7 +52,7 @@ namespace QuantLib { */ virtual bool hasOccurred( const Date& refDate = Date(), - boost::optional includeRefDate = boost::none) const; + ext::optional includeRefDate = ext::nullopt) const; //@} //! \name Visitability diff --git a/ql/experimental/Makefile.am b/ql/experimental/Makefile.am index 60a5e653e62..00a74072a40 100644 --- a/ql/experimental/Makefile.am +++ b/ql/experimental/Makefile.am @@ -47,7 +47,7 @@ all.hpp: Makefile.am echo "/* This file is automatically generated; do not edit. */" > ${srcdir}/$@ echo "/* Add the files to be included into Makefile.am instead. */" >> ${srcdir}/$@ echo >> ${srcdir}/$@ - subdirs='$(filter-out amortizingbonds, $(SUBDIRS))'; for i in $$subdirs; do \ + subdirs='$(SUBDIRS)'; for i in $$subdirs; do \ echo "#include <${subdir}/$$i/all.hpp>" >> ${srcdir}/$@; \ done diff --git a/ql/experimental/all.hpp b/ql/experimental/all.hpp index d0d18f44d89..2cee89b8091 100644 --- a/ql/experimental/all.hpp +++ b/ql/experimental/all.hpp @@ -1,6 +1,7 @@ /* This file is automatically generated; do not edit. */ /* Add the files to be included into Makefile.am instead. */ +#include #include #include #include diff --git a/ql/experimental/amortizingbonds/Makefile.am b/ql/experimental/amortizingbonds/Makefile.am index 769fe770d73..6038bde40bd 100644 --- a/ql/experimental/amortizingbonds/Makefile.am +++ b/ql/experimental/amortizingbonds/Makefile.am @@ -12,7 +12,7 @@ all.hpp: Makefile.am echo "/* This file is automatically generated; do not edit. */" > ${srcdir}/$@ echo "/* Add the files to be included into Makefile.am instead. */" >> ${srcdir}/$@ echo >> ${srcdir}/$@ - for i in $(filter-out all.hpp, $(this_include_HEADERS)); do \ + for i in $(filter-out all.hpp amortizingcmsratebond.hpp amortizingfixedratebond.hpp amortizingfloatingratebond.hpp, $(this_include_HEADERS)); do \ echo "#include <${subdir}/$$i>" >> ${srcdir}/$@; \ done echo >> ${srcdir}/$@ diff --git a/ql/experimental/amortizingbonds/all.hpp b/ql/experimental/amortizingbonds/all.hpp index ba4d2e579e1..e4b7634c770 100644 --- a/ql/experimental/amortizingbonds/all.hpp +++ b/ql/experimental/amortizingbonds/all.hpp @@ -1,7 +1,4 @@ /* This file is automatically generated; do not edit. */ /* Add the files to be included into Makefile.am instead. */ -#include -#include -#include diff --git a/ql/experimental/amortizingbonds/amortizingcmsratebond.hpp b/ql/experimental/amortizingbonds/amortizingcmsratebond.hpp index 8f09cd72c7e..43a67c6ad73 100644 --- a/ql/experimental/amortizingbonds/amortizingcmsratebond.hpp +++ b/ql/experimental/amortizingbonds/amortizingcmsratebond.hpp @@ -18,6 +18,6 @@ */ // Deprecated in version 1.28 -#pragma message("Warning: this file will disappear in a future release; include .") +#pragma message("Warning: this file will disappear in a future release; include instead.") #include diff --git a/ql/experimental/amortizingbonds/amortizingfixedratebond.hpp b/ql/experimental/amortizingbonds/amortizingfixedratebond.hpp index 24e1dea2ac4..7c803eafca2 100644 --- a/ql/experimental/amortizingbonds/amortizingfixedratebond.hpp +++ b/ql/experimental/amortizingbonds/amortizingfixedratebond.hpp @@ -18,6 +18,6 @@ */ // Deprecated in version 1.28 -#pragma message("Warning: this file will disappear in a future release; include .") +#pragma message("Warning: this file will disappear in a future release; include instead.") #include diff --git a/ql/experimental/amortizingbonds/amortizingfloatingratebond.hpp b/ql/experimental/amortizingbonds/amortizingfloatingratebond.hpp index 6c105f97156..bc9777c0000 100644 --- a/ql/experimental/amortizingbonds/amortizingfloatingratebond.hpp +++ b/ql/experimental/amortizingbonds/amortizingfloatingratebond.hpp @@ -18,6 +18,6 @@ */ // Deprecated in version 1.28 -#pragma message("Warning: this file will disappear in a future release; include .") +#pragma message("Warning: this file will disappear in a future release; include instead.") #include diff --git a/ql/experimental/asian/analytic_cont_geom_av_price_heston.hpp b/ql/experimental/asian/analytic_cont_geom_av_price_heston.hpp index 5df92eea347..e3a54f29f28 100644 --- a/ql/experimental/asian/analytic_cont_geom_av_price_heston.hpp +++ b/ql/experimental/asian/analytic_cont_geom_av_price_heston.hpp @@ -30,6 +30,7 @@ #include #include #include +#include namespace QuantLib { diff --git a/ql/experimental/asian/analytic_discr_geom_av_price_heston.hpp b/ql/experimental/asian/analytic_discr_geom_av_price_heston.hpp index 10ba8a1b290..b8f5b6abf25 100644 --- a/ql/experimental/asian/analytic_discr_geom_av_price_heston.hpp +++ b/ql/experimental/asian/analytic_discr_geom_av_price_heston.hpp @@ -29,6 +29,7 @@ #include #include #include +#include namespace QuantLib { diff --git a/ql/experimental/averageois/arithmeticoisratehelper.cpp b/ql/experimental/averageois/arithmeticoisratehelper.cpp index bf6dc03eba7..b0bb3d2b7a8 100644 --- a/ql/experimental/averageois/arithmeticoisratehelper.cpp +++ b/ql/experimental/averageois/arithmeticoisratehelper.cpp @@ -20,14 +20,11 @@ #include #include #include +#include #include namespace QuantLib { - namespace { - void no_deletion(YieldTermStructure*) {} - } - ArithmeticOISRateHelper::ArithmeticOISRateHelper(Natural settlementDays, const Period& tenor, // swap maturity Frequency fixedLegPaymentFrequency, @@ -75,7 +72,7 @@ namespace QuantLib { // force recalculation when needed bool observer = false; - ext::shared_ptr temp(t, no_deletion); + ext::shared_ptr temp(t, null_deleter()); termStructureHandle_.linkTo(temp, observer); if (discountHandle_.empty()) diff --git a/ql/experimental/averageois/arithmeticoisratehelper.hpp b/ql/experimental/averageois/arithmeticoisratehelper.hpp index e465628edca..c97e0b4e27a 100644 --- a/ql/experimental/averageois/arithmeticoisratehelper.hpp +++ b/ql/experimental/averageois/arithmeticoisratehelper.hpp @@ -52,6 +52,7 @@ namespace QuantLib { //@} //! \name inspectors //@{ + // NOLINTNEXTLINE(cppcoreguidelines-noexcept-swap,performance-noexcept-swap) ext::shared_ptr swap() const { return swap_; } //@} //! \name Visitability diff --git a/ql/experimental/barrieroption/vannavolgabarrierengine.cpp b/ql/experimental/barrieroption/vannavolgabarrierengine.cpp index b4822023a13..42645279a2d 100644 --- a/ql/experimental/barrieroption/vannavolgabarrierengine.cpp +++ b/ql/experimental/barrieroption/vannavolgabarrierengine.cpp @@ -130,10 +130,13 @@ namespace QuantLib { Real strikeVol = interpolation(payoff->strike()); //vanilla option price + Real forward = x0Quote->value() * foreignTS_->discount(T_) / domesticTS_->discount(T_); Real vanillaOption = blackFormula(payoff->optionType(), payoff->strike(), - x0Quote->value()* foreignTS_->discount(T_)/ domesticTS_->discount(T_), + forward, strikeVol * sqrt(T_), domesticTS_->discount(T_)); + results_.additionalResults["Forward"] = forward; + results_.additionalResults["StrikeVol"] = strikeVol; //spot > barrier up&out 0 if(x0Quote->value() >= arguments_.barrier && arguments_.barrierType == Barrier::UpOut){ @@ -190,49 +193,49 @@ namespace QuantLib { Real priceBS = barrierOption.NPV(); Real priceAtmCallBS = blackFormula(Option::Call,atmStrike, - x0Quote->value()* foreignTS_->discount(T_)/ domesticTS_->discount(T_), + forward, atmVol_->value() * sqrt(T_), domesticTS_->discount(T_)); Real price25CallBS = blackFormula(Option::Call,call25Strike, - x0Quote->value()* foreignTS_->discount(T_)/ domesticTS_->discount(T_), + forward, atmVol_->value() * sqrt(T_), domesticTS_->discount(T_)); Real price25PutBS = blackFormula(Option::Put,put25Strike, - x0Quote->value()* foreignTS_->discount(T_)/ domesticTS_->discount(T_), + forward, atmVol_->value() * sqrt(T_), domesticTS_->discount(T_)); //market price Real priceAtmCallMkt = blackFormula(Option::Call,atmStrike, - x0Quote->value()* foreignTS_->discount(T_)/ domesticTS_->discount(T_), + forward, atmVol_->value() * sqrt(T_), domesticTS_->discount(T_)); Real price25CallMkt = blackFormula(Option::Call,call25Strike, - x0Quote->value()* foreignTS_->discount(T_)/ domesticTS_->discount(T_), + forward, call25Vol * sqrt(T_), domesticTS_->discount(T_)); Real price25PutMkt = blackFormula(Option::Put,put25Strike, - x0Quote->value()* foreignTS_->discount(T_)/ domesticTS_->discount(T_), + forward, put25Vol * sqrt(T_), domesticTS_->discount(T_)); //Analytical Black Scholes formula for vanilla option NormalDistribution norm; - Real d1atm = (std::log(x0Quote->value()* foreignTS_->discount(T_)/ domesticTS_->discount(T_)/atmStrike) + Real d1atm = (std::log(forward/atmStrike) + 0.5*std::pow(atmVolQuote->value(),2.0) * T_)/(atmVolQuote->value() * sqrt(T_)); Real vegaAtm_Analytical = x0Quote->value() * norm(d1atm) * sqrt(T_) * foreignTS_->discount(T_); Real vannaAtm_Analytical = vegaAtm_Analytical/x0Quote->value() *(1.0 - d1atm/(atmVolQuote->value()*sqrt(T_))); Real volgaAtm_Analytical = vegaAtm_Analytical * d1atm * (d1atm - atmVolQuote->value() * sqrt(T_))/atmVolQuote->value(); - Real d125call = (std::log(x0Quote->value()* foreignTS_->discount(T_)/ domesticTS_->discount(T_)/call25Strike) + Real d125call = (std::log(forward/call25Strike) + 0.5*std::pow(atmVolQuote->value(),2.0) * T_)/(atmVolQuote->value() * sqrt(T_)); Real vega25Call_Analytical = x0Quote->value() * norm(d125call) * sqrt(T_) * foreignTS_->discount(T_); Real vanna25Call_Analytical = vega25Call_Analytical/x0Quote->value() *(1.0 - d125call/(atmVolQuote->value()*sqrt(T_))); Real volga25Call_Analytical = vega25Call_Analytical * d125call * (d125call - atmVolQuote->value() * sqrt(T_))/atmVolQuote->value(); - Real d125Put = (std::log(x0Quote->value()* foreignTS_->discount(T_)/ domesticTS_->discount(T_)/put25Strike) + Real d125Put = (std::log(forward/put25Strike) + 0.5*std::pow(atmVolQuote->value(),2.0) * T_)/(atmVolQuote->value() * sqrt(T_)); Real vega25Put_Analytical = x0Quote->value() * norm(d125Put) * sqrt(T_) * foreignTS_->discount(T_); Real vanna25Put_Analytical = vega25Put_Analytical/x0Quote->value() *(1.0 - d125Put/(atmVolQuote->value()*sqrt(T_))); diff --git a/ql/experimental/callablebonds/callablebond.cpp b/ql/experimental/callablebonds/callablebond.cpp index abe24dbeb89..ec9c79c5153 100644 --- a/ql/experimental/callablebonds/callablebond.cpp +++ b/ql/experimental/callablebonds/callablebond.cpp @@ -157,7 +157,7 @@ namespace QuantLib { namespace { template - class RestoreVal { + class RestoreVal { // NOLINT(cppcoreguidelines-special-member-functions) T orig_; T &ref_; public: @@ -511,7 +511,7 @@ namespace QuantLib { : CallableBond(settlementDays, schedule.dates().back(), schedule.calendar(), accrualDayCounter, faceAmount, issueDate, putCallSchedule) { - frequency_ = schedule.tenor().frequency(); + frequency_ = schedule.hasTenor() ? schedule.tenor().frequency() : NoFrequency; cashflows_ = FixedRateLeg(schedule) diff --git a/ql/experimental/catbonds/montecarlocatbondengine.cpp b/ql/experimental/catbonds/montecarlocatbondengine.cpp index fdc8bd4dd5b..601eabc4582 100644 --- a/ql/experimental/catbonds/montecarlocatbondengine.cpp +++ b/ql/experimental/catbonds/montecarlocatbondengine.cpp @@ -19,6 +19,7 @@ #include #include +#include #include #include @@ -27,7 +28,7 @@ namespace QuantLib { MonteCarloCatBondEngine::MonteCarloCatBondEngine( ext::shared_ptr catRisk, Handle discountCurve, - const boost::optional& includeSettlementDateFlows) + const ext::optional& includeSettlementDateFlows) : catRisk_(std::move(catRisk)), discountCurve_(std::move(discountCurve)), includeSettlementDateFlows_(includeSettlementDateFlows) { registerWith(discountCurve_); diff --git a/ql/experimental/catbonds/montecarlocatbondengine.hpp b/ql/experimental/catbonds/montecarlocatbondengine.hpp index d5ad54d0c88..d20f98f3d13 100644 --- a/ql/experimental/catbonds/montecarlocatbondengine.hpp +++ b/ql/experimental/catbonds/montecarlocatbondengine.hpp @@ -24,6 +24,7 @@ #ifndef quantlib_montecarlo_catbond_engine_hpp #define quantlib_montecarlo_catbond_engine_hpp +#include #include namespace QuantLib { @@ -35,7 +36,7 @@ namespace QuantLib { explicit MonteCarloCatBondEngine( ext::shared_ptr catRisk, Handle discountCurve = Handle(), - const boost::optional& includeSettlementDateFlows = boost::none); + const ext::optional& includeSettlementDateFlows = ext::nullopt); void calculate() const override; Handle discountCurve() const { return discountCurve_; } protected: @@ -56,7 +57,7 @@ namespace QuantLib { private: ext::shared_ptr catRisk_; Handle discountCurve_; - boost::optional includeSettlementDateFlows_; + ext::optional includeSettlementDateFlows_; }; } diff --git a/ql/experimental/commodities/commodity.hpp b/ql/experimental/commodities/commodity.hpp index 56cf6a514b4..92dddb9d4b9 100644 --- a/ql/experimental/commodities/commodity.hpp +++ b/ql/experimental/commodities/commodity.hpp @@ -24,6 +24,7 @@ #ifndef quantlib_commodity_hpp #define quantlib_commodity_hpp +#include #include #include #include @@ -32,7 +33,7 @@ namespace QuantLib { - typedef std::map SecondaryCosts; + typedef std::map SecondaryCosts; typedef std::map SecondaryCostAmounts; std::ostream& operator<<(std::ostream& out, diff --git a/ql/experimental/commodities/energycommodity.cpp b/ql/experimental/commodities/energycommodity.cpp index 2205ee1c8ad..4ade5b1361d 100644 --- a/ql/experimental/commodities/energycommodity.cpp +++ b/ql/experimental/commodities/energycommodity.cpp @@ -144,16 +144,16 @@ namespace QuantLib { try { for (SecondaryCosts::const_iterator i = secondaryCosts_->begin(); i != secondaryCosts_->end(); ++i) { - if (boost::any_cast(&i->second) != nullptr) { + if (ext::any_cast(&i->second) != nullptr) { Real value = calculateUnitCost( commodityType, - boost::any_cast(i->second), + ext::any_cast(i->second), evaluationDate) * totalQuantityValue; secondaryCostAmounts_[i->first] = Money(baseCurrency, value); - } else if (boost::any_cast(&i->second) != nullptr) { - const Money& amount = boost::any_cast(i->second); + } else if (ext::any_cast(&i->second) != nullptr) { + const Money& amount = ext::any_cast(i->second); Real fxConversionFactor = calculateFxConversionFactor(amount.currency(), baseCurrency, diff --git a/ql/experimental/coupons/lognormalcmsspreadpricer.cpp b/ql/experimental/coupons/lognormalcmsspreadpricer.cpp index 33dcf92a62a..769b0f16967 100644 --- a/ql/experimental/coupons/lognormalcmsspreadpricer.cpp +++ b/ql/experimental/coupons/lognormalcmsspreadpricer.cpp @@ -25,9 +25,9 @@ #include #include #include +#include #include - using std::sqrt; namespace QuantLib { @@ -47,7 +47,7 @@ namespace QuantLib { const Handle& correlation, Handle couponDiscountCurve, const Size integrationPoints, - const boost::optional& volatilityType, + const ext::optional& volatilityType, const Real shift1, const Real shift2) : CmsSpreadCouponPricer(correlation), cmsPricer_(cmsPricer), @@ -66,7 +66,7 @@ namespace QuantLib { cnd_ = ext::make_shared(0.0, 1.0); - if(volatilityType == boost::none) { + if (!volatilityType) { QL_REQUIRE(shift1 == Null() && shift2 == Null(), "if volatility type is inherited, no shifts should be " "specified"); diff --git a/ql/experimental/coupons/lognormalcmsspreadpricer.hpp b/ql/experimental/coupons/lognormalcmsspreadpricer.hpp index 2ab0af81bdd..3328875c8cd 100644 --- a/ql/experimental/coupons/lognormalcmsspreadpricer.hpp +++ b/ql/experimental/coupons/lognormalcmsspreadpricer.hpp @@ -31,6 +31,7 @@ #include #include #include +#include namespace QuantLib { @@ -64,7 +65,7 @@ namespace QuantLib { const Handle& correlation, Handle couponDiscountCurve = Handle(), Size IntegrationPoints = 16, - const boost::optional& volatilityType = boost::none, + const ext::optional& volatilityType = ext::nullopt, Real shift1 = Null(), Real shift2 = Null()); diff --git a/ql/experimental/coupons/strippedcapflooredcoupon.cpp b/ql/experimental/coupons/strippedcapflooredcoupon.cpp index e6d8ca615c4..5f81fc72e9b 100644 --- a/ql/experimental/coupons/strippedcapflooredcoupon.cpp +++ b/ql/experimental/coupons/strippedcapflooredcoupon.cpp @@ -34,11 +34,15 @@ namespace QuantLib { underlying->referencePeriodEnd(), underlying->dayCounter(), underlying->isInArrears()), underlying_(underlying) { - registerWith(underlying); + registerWith(underlying_); } - Rate StrippedCappedFlooredCoupon::rate() const { + void StrippedCappedFlooredCoupon::deepUpdate() { + update(); + underlying_->deepUpdate(); + } + void StrippedCappedFlooredCoupon::performCalculations() const { QL_REQUIRE(underlying_->underlying()->pricer() != nullptr, "pricer not set"); underlying_->underlying()->pricer()->initialize(*underlying_->underlying()); Rate floorletRate = 0.0; @@ -53,9 +57,14 @@ namespace QuantLib { // if the underlying is collared we return the value of the embedded // collar, otherwise the value of a long floor or a long cap respectively - return (underlying_->isFloored() && underlying_->isCapped()) - ? Real(floorletRate - capletRate) - : Real(floorletRate + capletRate); + rate_ = (underlying_->isFloored() && underlying_->isCapped()) ? + Real(floorletRate - capletRate) : + Real(floorletRate + capletRate); + } + + Rate StrippedCappedFlooredCoupon::rate() const { + calculate(); + return rate_; } Rate StrippedCappedFlooredCoupon::convexityAdjustment() const { @@ -76,8 +85,6 @@ namespace QuantLib { return underlying_->effectiveFloor(); } - void StrippedCappedFlooredCoupon::update() { notifyObservers(); } - void StrippedCappedFlooredCoupon::accept(AcyclicVisitor &v) { underlying_->accept(v); auto* v1 = dynamic_cast*>(&v); diff --git a/ql/experimental/coupons/strippedcapflooredcoupon.hpp b/ql/experimental/coupons/strippedcapflooredcoupon.hpp index 1de288f53e3..338879232ae 100644 --- a/ql/experimental/coupons/strippedcapflooredcoupon.hpp +++ b/ql/experimental/coupons/strippedcapflooredcoupon.hpp @@ -34,6 +34,15 @@ namespace QuantLib { explicit StrippedCappedFlooredCoupon(const ext::shared_ptr &underlying); + //! \name Obverver interface + //@{ + void deepUpdate() override; + //@} + + //! \name LazyObject interface + //@{ + void performCalculations() const override; + //@} //! Coupon interface Rate rate() const override; Rate convexityAdjustment() const override; @@ -46,9 +55,6 @@ namespace QuantLib { //! effective floor Rate effectiveFloor() const; - //! Observer interface - void update() override; - //! Visitability void accept(AcyclicVisitor&) override; diff --git a/ql/experimental/credit/basket.cpp b/ql/experimental/credit/basket.cpp index 0e4bf54ed68..36e22251993 100644 --- a/ql/experimental/credit/basket.cpp +++ b/ql/experimental/credit/basket.cpp @@ -22,6 +22,7 @@ #include #include #include +#include #include #include diff --git a/ql/experimental/credit/homogeneouspooldef.hpp b/ql/experimental/credit/homogeneouspooldef.hpp index 2eb6ab829ff..fe1ea97452a 100644 --- a/ql/experimental/credit/homogeneouspooldef.hpp +++ b/ql/experimental/credit/homogeneouspooldef.hpp @@ -51,7 +51,7 @@ namespace QuantLib { Size nBuckets, Real max = 5., Real min = -5., - Real nSteps = 50) + Size nSteps = 50) : copula_(copula), nBuckets_(nBuckets), max_(max), min_(min), nSteps_(nSteps), delta_((max - min)/nSteps) @@ -92,7 +92,7 @@ namespace QuantLib { // multifactor version const Real max_;// redundant? const Real min_; - const Real nSteps_; + const Size nSteps_; const Real delta_; }; // \todo Add other loss distribution statistics diff --git a/ql/experimental/credit/inhomogeneouspooldef.hpp b/ql/experimental/credit/inhomogeneouspooldef.hpp index d8e20e1ecc4..1b2a0e1e73e 100644 --- a/ql/experimental/credit/inhomogeneouspooldef.hpp +++ b/ql/experimental/credit/inhomogeneouspooldef.hpp @@ -58,7 +58,7 @@ namespace QuantLib { Size nBuckets, Real max = 5., Real min = -5., - Real nSteps = 50) + Size nSteps = 50) : copula_(copula), nBuckets_(nBuckets), max_(max), min_(min), nSteps_(nSteps), delta_((max - min)/nSteps) @@ -100,7 +100,7 @@ namespace QuantLib { // multifactor version const Real max_;// redundant? const Real min_; - const Real nSteps_; + const Size nSteps_; const Real delta_; }; // \todo Add other loss distribution statistics diff --git a/ql/experimental/credit/randomdefaultlatentmodel.hpp b/ql/experimental/credit/randomdefaultlatentmodel.hpp index 2051b3d54c7..eb45fef55ee 100644 --- a/ql/experimental/credit/randomdefaultlatentmodel.hpp +++ b/ql/experimental/credit/randomdefaultlatentmodel.hpp @@ -613,7 +613,7 @@ namespace QuantLib { lowerPercentile = rankLosses[r]; upperPercentile = rankLosses[s]; - return {quantileValue, lowerPercentile, upperPercentile}; + return ext::make_tuple(quantileValue, lowerPercentile, upperPercentile); } diff --git a/ql/experimental/credit/syntheticcdo.cpp b/ql/experimental/credit/syntheticcdo.cpp index 0c50579f873..8d0cdeaadcb 100644 --- a/ql/experimental/credit/syntheticcdo.cpp +++ b/ql/experimental/credit/syntheticcdo.cpp @@ -27,6 +27,7 @@ #include #include #include +#include using namespace std; @@ -39,9 +40,9 @@ namespace QuantLib { Rate runningRate, const DayCounter& dayCounter, BusinessDayConvention paymentConvention, - boost::optional notional) + ext::optional notional) : basket_(basket), side_(side), upfrontRate_(upfrontRate), runningRate_(runningRate), - leverageFactor_(notional ? notional.get() / basket->trancheNotional() : Real(1.)), // NOLINT(readability-implicit-bool-conversion) + leverageFactor_(notional ? *notional / basket->trancheNotional() : Real(1.)), // NOLINT(readability-implicit-bool-conversion) dayCounter_(dayCounter), paymentConvention_(paymentConvention) { QL_REQUIRE(!basket->names().empty(), "basket is empty"); // Basket inception must lie before contract protection start. diff --git a/ql/experimental/credit/syntheticcdo.hpp b/ql/experimental/credit/syntheticcdo.hpp index 378785645ba..50e7dedc4d5 100644 --- a/ql/experimental/credit/syntheticcdo.hpp +++ b/ql/experimental/credit/syntheticcdo.hpp @@ -30,6 +30,7 @@ #include #include +#include #include #include @@ -123,7 +124,7 @@ namespace QuantLib { Rate runningRate, const DayCounter& dayCounter, BusinessDayConvention paymentConvention, - boost::optional notional = boost::none); + ext::optional notional = ext::nullopt); const ext::shared_ptr& basket() const { return basket_; } diff --git a/ql/experimental/finitedifferences/fdmextendedornsteinuhlenbeckop.cpp b/ql/experimental/finitedifferences/fdmextendedornsteinuhlenbeckop.cpp index 9e934649048..3c077e2252e 100644 --- a/ql/experimental/finitedifferences/fdmextendedornsteinuhlenbeckop.cpp +++ b/ql/experimental/finitedifferences/fdmextendedornsteinuhlenbeckop.cpp @@ -52,12 +52,8 @@ namespace QuantLib { void FdmExtendedOrnsteinUhlenbeckOp::setTime(Time t1, Time t2) { const Rate r = rTS_->forwardRate(t1, t2, Continuous).rate(); - const ext::shared_ptr layout=mesher_->layout(); - const FdmLinearOpIterator endIter = layout->end(); - - Array drift(layout->size()); - for (FdmLinearOpIterator iter = layout->begin(); - iter!=endIter; ++iter) { + Array drift(mesher_->layout()->size()); + for (const auto& iter : *mesher_->layout()) { const Size i = iter.index(); drift[i] = process_->drift(0.5*(t1+t2), x_[i]); } diff --git a/ql/experimental/finitedifferences/fdmextoujumpop.cpp b/ql/experimental/finitedifferences/fdmextoujumpop.cpp index b4238888a0d..f83903e22b9 100644 --- a/ql/experimental/finitedifferences/fdmextoujumpop.cpp +++ b/ql/experimental/finitedifferences/fdmextoujumpop.cpp @@ -72,18 +72,12 @@ namespace QuantLib { integroPart_ = SparseMatrix(mesher_->layout()->size(), mesher_->layout()->size()); - const ext::shared_ptr layout = mesher_->layout(); - const FdmLinearOpIterator endIter = layout->end(); - Array yLoc(mesher_->layout()->dim()[1]); - for (FdmLinearOpIterator iter = layout->begin(); iter != endIter; - ++iter) { + for (const auto& iter : *mesher_->layout()) { yLoc[iter.coordinates()[1]] = mesher_->location(iter, 1); } - for (FdmLinearOpIterator iter = layout->begin(); iter != endIter; - ++iter) { - + for (const auto& iter : *mesher_->layout()) { const Size diag = iter.index(); integroPart_(diag, diag) -= lambda; @@ -99,9 +93,9 @@ namespace QuantLib { yLoc.end()-1, ys) - yLoc.begin()-1; const Real s = (ys-yLoc[l])/(yLoc[l+1]-yLoc[l]); - integroPart_(diag, layout->neighbourhood(iter, 1, l-yIndex)) + integroPart_(diag, mesher_->layout()->neighbourhood(iter, 1, l-yIndex)) += weight*lambda*(1-s); - integroPart_(diag, layout->neighbourhood(iter, 1, l+1-yIndex)) + integroPart_(diag, mesher_->layout()->neighbourhood(iter, 1, l+1-yIndex)) += weight*lambda*s; } } diff --git a/ql/experimental/finitedifferences/fdmvppstepcondition.cpp b/ql/experimental/finitedifferences/fdmvppstepcondition.cpp index 450ea712222..8ad09cd76bb 100644 --- a/ql/experimental/finitedifferences/fdmvppstepcondition.cpp +++ b/ql/experimental/finitedifferences/fdmvppstepcondition.cpp @@ -64,27 +64,24 @@ namespace QuantLib { void FdmVPPStepCondition::applyTo(Array& a, Time t) const { - ext::shared_ptr layout = mesher_->layout(); + const Size nStates = mesher_->layout()->dim()[stateDirection_]; - const Size nStates = layout->dim()[stateDirection_]; - const FdmLinearOpIterator endIter = layout->end(); - - for (FdmLinearOpIterator iter=layout->begin();iter != endIter; ++iter) { + for (const auto& iter : *mesher_->layout()) { a[iter.index()] += evolve(iter, t); } - for (FdmLinearOpIterator iter=layout->begin();iter != endIter; ++iter) { + for (const auto& iter : *mesher_->layout()) { if (iter.coordinates()[stateDirection_] == 0U) { Array x(nStates); for (Size i=0; i < nStates; ++i) { - x[i] = a[layout->neighbourhood(iter, stateDirection_, i)]; + x[i] = a[mesher_->layout()->neighbourhood(iter, stateDirection_, i)]; } const Real gasPrice = gasPrice_->innerValue(iter, t); x = changeState(gasPrice, x, t); for (Size i=0; i < nStates; ++i) { - a[layout->neighbourhood(iter, stateDirection_, i)] = x[i]; + a[mesher_->layout()->neighbourhood(iter, stateDirection_, i)] = x[i]; } } } diff --git a/ql/experimental/forward/analytichestonforwardeuropeanengine.cpp b/ql/experimental/forward/analytichestonforwardeuropeanengine.cpp index 74a8f5ca948..de658619d4e 100644 --- a/ql/experimental/forward/analytichestonforwardeuropeanengine.cpp +++ b/ql/experimental/forward/analytichestonforwardeuropeanengine.cpp @@ -18,6 +18,7 @@ */ #include +#include #include namespace QuantLib { diff --git a/ql/experimental/inflation/genericindexes.hpp b/ql/experimental/inflation/genericindexes.hpp index a3187288282..b75c73b6000 100644 --- a/ql/experimental/inflation/genericindexes.hpp +++ b/ql/experimental/inflation/genericindexes.hpp @@ -69,7 +69,7 @@ namespace QuantLib { }; - //! Genuine year-on-year Generic CPI (i.e. not a ratio) + //! Quoted year-on-year Generic CPI (i.e. not a ratio) class YYGenericCPI : public YoYInflationIndex { public: YYGenericCPI(Frequency frequency, @@ -82,15 +82,19 @@ namespace QuantLib { GenericRegion(), revised, interpolated, - false, frequency, lag, ccy, ts) {} }; - //! Fake year-on-year GenericCPI (i.e. a ratio) - class YYGenericCPIr : public YoYInflationIndex { + QL_DEPRECATED_DISABLE_WARNING + + //! Year-on-year GenericCPI (i.e. a ratio) + /*! \deprecated Pass a zero-inflation index to YoYInflationIndex instead. + Deprecated in version 1.31. + */ + class [[deprecated("Pass a zero-inflation index to YoYInflationIndex instead")]] YYGenericCPIr : public YoYInflationIndex { public: YYGenericCPIr(Frequency frequency, bool revised, @@ -109,6 +113,7 @@ namespace QuantLib { ts) {} }; + QL_DEPRECATED_ENABLE_WARNING } #endif diff --git a/ql/experimental/math/convolvedstudentt.cpp b/ql/experimental/math/convolvedstudentt.cpp index 042f9134144..e42a340907c 100644 --- a/ql/experimental/math/convolvedstudentt.cpp +++ b/ql/experimental/math/convolvedstudentt.cpp @@ -172,7 +172,7 @@ namespace QuantLib { // (q is very close to 1.), in a bad combination fails around 1.-1.e-7 Real xMax = 1.e6; return sign * - Brent().solve([&](Real x){ return distrib_(x) - effectiveq; }, + Brent().solve([&](Real x) -> Real { return distrib_(x) - effectiveq; }, accuracy_, (xMin+xMax)/2., xMin, xMax); } diff --git a/ql/experimental/math/gaussiancopulapolicy.hpp b/ql/experimental/math/gaussiancopulapolicy.hpp index bda2ef38c33..039ae7a692b 100644 --- a/ql/experimental/math/gaussiancopulapolicy.hpp +++ b/ql/experimental/math/gaussiancopulapolicy.hpp @@ -84,7 +84,7 @@ namespace QuantLib { */ Probability density(const std::vector& m) const { return std::accumulate(m.begin(), m.end(), Real(1.), - [&](Real x, Real y){ return x*density_(y); }); + [&](Real x, Real y) -> Real { return x*density_(y); }); } /*! Returns the inverse of the cumulative distribution of the (modelled) latent variable (as indexed by iVariable). The normal stability avoids diff --git a/ql/experimental/math/gaussiannoncentralchisquaredpolynomial.cpp b/ql/experimental/math/gaussiannoncentralchisquaredpolynomial.cpp index 03d68646fc2..085fb863be3 100644 --- a/ql/experimental/math/gaussiannoncentralchisquaredpolynomial.cpp +++ b/ql/experimental/math/gaussiannoncentralchisquaredpolynomial.cpp @@ -82,8 +82,7 @@ namespace QuantLib { } std::vector > - GaussNonCentralChiSquaredPolynomial::moments = - std::vector >(); + GaussNonCentralChiSquaredPolynomial::moments = {}; GaussNonCentralChiSquaredPolynomial::GaussNonCentralChiSquaredPolynomial( Real nu, Real lambda) diff --git a/ql/experimental/math/multidimquadrature.hpp b/ql/experimental/math/multidimquadrature.hpp index 63b7a6f0484..1e7a3404210 100644 --- a/ql/experimental/math/multidimquadrature.hpp +++ b/ql/experimental/math/multidimquadrature.hpp @@ -60,7 +60,7 @@ namespace QuantLib { Integer i = order()-1; std::vector term = f(x_[i]);// potential copy! @#$%^!!! std::for_each(term.begin(), term.end(), - [&](Real x){ return x * w_[i]; }); + [&](Real x) -> Real { return x * w_[i]; }); std::vector sum = term; for (i--; i >= 0; --i) { @@ -68,7 +68,7 @@ namespace QuantLib { // sum[j] += term[j] * w_[i]; std::transform(term.begin(), term.end(), sum.begin(), sum.begin(), - [&](Real x, Real y){ return w_[i]*x + y; }); + [&](Real x, Real y) -> Real { return w_[i]*x + y; }); } return sum; } diff --git a/ql/experimental/shortrate/generalizedhullwhite.hpp b/ql/experimental/shortrate/generalizedhullwhite.hpp index bbde51e4551..1f594eca320 100644 --- a/ql/experimental/shortrate/generalizedhullwhite.hpp +++ b/ql/experimental/shortrate/generalizedhullwhite.hpp @@ -36,7 +36,7 @@ namespace QuantLib { //! Parameter that holds an interpolation object class InterpolationParameter : public Parameter { private: - class Impl : public Parameter::Impl { + class Impl final : public Parameter::Impl { public: Real value(const Array&, Time t) const override { return interpolator_(t); } void reset(const Interpolation& interp) { interpolator_ = interp; } @@ -79,10 +79,8 @@ namespace QuantLib { const std::vector& volstructure, const std::vector& speed, const std::vector& vol, - const ext::function& f = - ext::function(), - const ext::function& fInverse = - ext::function()); + const ext::function& f = {}, + const ext::function& fInverse = {}); template GeneralizedHullWhite( @@ -93,10 +91,8 @@ namespace QuantLib { const std::vector& vol, const SpeedInterpolationTraits &speedtraits, const VolInterpolationTraits &voltraits, - const ext::function& f = - ext::function(), - const ext::function& fInverse = - ext::function()) : + const ext::function& f = {}, + const ext::function& fInverse = {}) : OneFactorAffineModel(2), TermStructureConsistentModel(yieldtermStructure), speedstructure_(speedstructure), volstructure_(volstructure), a_(arguments_[0]), sigma_(arguments_[1]), @@ -274,7 +270,7 @@ namespace QuantLib { class GeneralizedHullWhite::FittingParameter : public TermStructureFittingParameter { private: - class Impl : public Parameter::Impl { + class Impl final : public Parameter::Impl { public: Impl(Handle termStructure, Real a, Real sigma) : termStructure_(std::move(termStructure)), a_(a), sigma_(sigma) {} diff --git a/ql/experimental/swaptions/haganirregularswaptionengine.cpp b/ql/experimental/swaptions/haganirregularswaptionengine.cpp index c317494b43d..2d6621c6904 100644 --- a/ql/experimental/swaptions/haganirregularswaptionengine.cpp +++ b/ql/experimental/swaptions/haganirregularswaptionengine.cpp @@ -1,18 +1,15 @@ /* -*- mode: c++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /* - Copyright (C) 2011, 2012, 2013 Andre Miemiec + Copyright (C) 2011, 2012, 2013, 2023 Andre Miemiec Copyright (C) 2012 Samuel Tebege - This file is part of QuantLib, a free-software/open-source library for financial quantitative analysts and developers - http://quantlib.org/ - QuantLib is free software: you can redistribute it and/or modify it under the terms of the QuantLib license. You should have received a copy of the license along with this program; if not, please email . The license is also available online at . - This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the license for more details. @@ -105,32 +102,32 @@ namespace QuantLib { } - //computes a replication of the swap in terms of a basket of vanilla swaps - //by solving a linear system of equation + // computes a replication of the swap in terms of a basket of vanilla swaps + // by solving a linear system of equation Array HaganIrregularSwaptionEngine::Basket::compute(Rate lambda) const { - //update members + // update members lambda_ = lambda; Size n = swap_->fixedLeg().size(); - //build linear system of equations - Matrix arr(n,n,0.0); - Array rhs(n); + // build linear system of equations + Matrix arr(n, n, 0.0); + Array rhs(n); - //fill the matrix describing the linear system of equations by looping over rows - for(Size r = 0; r < n; ++r) - { + // fill the matrix describing the linear system of equations by looping over rows + for (Size r = 0; r < n; ++r) { - ext::shared_ptr cpn_r = ext::dynamic_pointer_cast(swap_->fixedLeg()[r]); - QL_REQUIRE(cpn_r,"Cast to fixed rate coupon failed."); + ext::shared_ptr cpn_r = + ext::dynamic_pointer_cast(swap_->fixedLeg()[r]); + QL_REQUIRE(cpn_r, "Cast to fixed rate coupon failed."); - //looping over columns - for(Size c = r; c < n; ++c){ + // looping over columns + for (Size c = r; c < n; ++c) { - //set homogenous part of lse - arr[r][c] = ( fairRates_[c] + lambda_ ) * cpn_r->accrualPeriod(); + // set homogenous part of lse + arr[r][c] = (fairRates_[c] + lambda_) * cpn_r->accrualPeriod(); } // add nominal repayment for i-th swap @@ -138,16 +135,17 @@ namespace QuantLib { } - for(Size r = 0; r < n; ++r) - { - ext::shared_ptr cpn_r = ext::dynamic_pointer_cast(swap_->fixedLeg()[r]); + for (Size r = 0; r < n; ++r) { + ext::shared_ptr cpn_r = + ext::dynamic_pointer_cast(swap_->fixedLeg()[r]); // set inhomogenity of lse Real N_r = cpn_r->nominal(); - if(r < n - 1){ + if (r < n - 1) { - ext::shared_ptr cpn_rp1 = ext::dynamic_pointer_cast(swap_->fixedLeg()[r+1]); + ext::shared_ptr cpn_rp1 = + ext::dynamic_pointer_cast(swap_->fixedLeg()[r + 1]); Real N_rp1 = cpn_rp1->nominal(); @@ -156,9 +154,7 @@ namespace QuantLib { } else { rhs[r] = N_r * (cpn_r->rate()) * cpn_r->accrualPeriod() + N_r; - - } - + } } @@ -168,54 +164,52 @@ namespace QuantLib { } - Real HaganIrregularSwaptionEngine::Basket::operator()(Rate lambda) const { Array weights = compute(lambda); Real defect = -targetNPV_; - for (Size i=0; i< weights.size();++i) - defect -= Integer(swap_->type()) * lambda*weights[i] * annuities_[i]; + for (Size i = 0; i < weights.size(); ++i) + defect -= Integer(swap_->type()) * lambda * weights[i] * annuities_[i]; return defect; } - - - //creates a standard swap by deducing its conventions from market data objects + // creates a standard swap by deducing its conventions from market data objects ext::shared_ptr HaganIrregularSwaptionEngine::Basket::component(Size i) const { - ext::shared_ptr iborCpn = ext::dynamic_pointer_cast(swap_->floatingLeg()[0]); - QL_REQUIRE(iborCpn,"dynamic cast of float leg coupon failed. Can't find index."); - ext::shared_ptr iborIndex = iborCpn->iborIndex(); + ext::shared_ptr iborCpn = + ext::dynamic_pointer_cast(swap_->floatingLeg()[0]); + QL_REQUIRE(iborCpn, "dynamic cast of float leg coupon failed. Can't find index."); + ext::shared_ptr iborIndex = iborCpn->iborIndex(); - Period dummySwapLength = Period(1,Years); - - ext::shared_ptr memberSwap_ = MakeVanillaSwap(dummySwapLength,iborIndex) - .withType(swap_->type()) - .withEffectiveDate(swap_->startDate()) - .withTerminationDate(expiries_[i]) - .withRule(DateGeneration::Backward) - .withDiscountingTermStructure(termStructure_); + Period dummySwapLength = Period(1, Years); - Real stdAnnuity = 10000*CashFlows::bps(memberSwap_->fixedLeg(),**termStructure_,true); + ext::shared_ptr memberSwap_ = + MakeVanillaSwap(dummySwapLength, iborIndex) + .withType(swap_->type()) + .withEffectiveDate(swap_->startDate()) + .withTerminationDate(expiries_[i]) + .withRule(DateGeneration::Backward) + .withDiscountingTermStructure(termStructure_); - //compute annuity transformed rate - Rate transformedRate = (fairRates_[i]+lambda_)*annuities_[i]/stdAnnuity; + Real stdAnnuity = 10000 * CashFlows::bps(memberSwap_->fixedLeg(), **termStructure_, true); - memberSwap_ = MakeVanillaSwap(dummySwapLength,iborIndex,transformedRate) - .withType(swap_->type()) - .withEffectiveDate(swap_->startDate()) - .withTerminationDate(expiries_[i]) - .withRule(DateGeneration::Backward) - .withDiscountingTermStructure(termStructure_); + // compute annuity transformed rate + Rate transformedRate = (fairRates_[i] + lambda_) * annuities_[i] / stdAnnuity; + memberSwap_ = MakeVanillaSwap(dummySwapLength, iborIndex, transformedRate) + .withType(swap_->type()) + .withEffectiveDate(swap_->startDate()) + .withTerminationDate(expiries_[i]) + .withRule(DateGeneration::Backward) + .withDiscountingTermStructure(termStructure_); - return memberSwap_; + return memberSwap_; } @@ -236,95 +230,80 @@ namespace QuantLib { void HaganIrregularSwaptionEngine::calculate() const { - //check exercise type + // check exercise type ext::shared_ptr exercise_ = this->arguments_.exercise; - QL_REQUIRE(exercise_->type() == QuantLib::Exercise::European,"swaption must be european"); + QL_REQUIRE(exercise_->type() == QuantLib::Exercise::European, "swaption must be european"); - //extract the underlying irregular swap - ext::shared_ptr swap_ = this->arguments_.swap; + // extract the underlying irregular swap + ext::shared_ptr swap_ = this->arguments_.swap; - - //Reshuffle spread from float to fixed (, i.e. remove spread from float side by finding the adjusted fixed coupon - //such that the NPV of the swap stays constant). - Leg fixedLeg = swap_->fixedLeg(); - Real fxdLgBPS = CashFlows::bps(fixedLeg,**termStructure_,true); - Leg floatLeg = swap_->floatingLeg(); - Real fltLgNPV = CashFlows::npv(floatLeg,**termStructure_,true); - Real fltLgBPS = CashFlows::bps(floatLeg,**termStructure_,true); - + // Reshuffle spread from float to fixed (, i.e. remove spread from float side by finding the + // adjusted fixed coupon such that the NPV of the swap stays constant). + Leg fixedLeg = swap_->fixedLeg(); + Real fxdLgBPS = CashFlows::bps(fixedLeg, **termStructure_, true); - Leg floatCFS,fixedCFS; + Leg floatLeg = swap_->floatingLeg(); + Real fltLgNPV = CashFlows::npv(floatLeg, **termStructure_, true); + Real fltLgBPS = CashFlows::bps(floatLeg, **termStructure_, true); + + + Leg floatCFS, fixedCFS; floatCFS.clear(); for (auto& j : floatLeg) { - //retrieve ibor coupon from floating leg + // retrieve ibor coupon from floating leg ext::shared_ptr coupon = ext::dynamic_pointer_cast(j); - QL_REQUIRE(coupon,"dynamic cast of float leg coupon failed."); - - ext::shared_ptr newCpn = ext::shared_ptr ( - new IborCoupon(coupon->date(), - coupon->nominal(), - coupon->accrualStartDate(), - coupon->accrualEndDate(), - coupon->fixingDays(), - coupon->iborIndex(), - coupon->gearing(), - 0.0, - coupon->referencePeriodStart(), - coupon->referencePeriodEnd(), - coupon->dayCounter(), - coupon->isInArrears())); + QL_REQUIRE(coupon, "dynamic cast of float leg coupon failed."); + + ext::shared_ptr newCpn = ext::shared_ptr(new IborCoupon( + coupon->date(), coupon->nominal(), coupon->accrualStartDate(), + coupon->accrualEndDate(), coupon->fixingDays(), coupon->iborIndex(), + coupon->gearing(), 0.0, coupon->referencePeriodStart(), + coupon->referencePeriodEnd(), coupon->dayCounter(), coupon->isInArrears())); if (!newCpn->isInArrears()) newCpn->setPricer( - ext::shared_ptr( - new BlackIborCouponPricer())); + ext::shared_ptr(new BlackIborCouponPricer())); floatCFS.push_back(newCpn); } - Real sprdLgNPV = fltLgNPV - CashFlows::npv(floatCFS,**termStructure_,true); - Rate avgSpread = sprdLgNPV/fltLgBPS/10000; - - Rate cpn_adjustment = avgSpread*fltLgBPS/fxdLgBPS; + Real sprdLgNPV = fltLgNPV - CashFlows::npv(floatCFS, **termStructure_, true); + Rate avgSpread = sprdLgNPV / fltLgBPS / 10000; + + Rate cpn_adjustment = avgSpread * fltLgBPS / fxdLgBPS; fixedCFS.clear(); for (auto& i : fixedLeg) { - //retrieve fixed rate coupon from fixed leg + // retrieve fixed rate coupon from fixed leg ext::shared_ptr coupon = ext::dynamic_pointer_cast(i); - QL_REQUIRE(coupon,"dynamic cast of fixed leg coupon failed."); - - ext::shared_ptr newCpn = ext::make_shared ( - coupon->date(), - coupon->nominal(), - coupon->rate()-cpn_adjustment, - coupon->dayCounter(), - coupon->accrualStartDate(), - coupon->accrualEndDate(), - coupon->referencePeriodStart(), - coupon->referencePeriodEnd()); + QL_REQUIRE(coupon, "dynamic cast of fixed leg coupon failed."); + + ext::shared_ptr newCpn = ext::make_shared( + coupon->date(), coupon->nominal(), coupon->rate() - cpn_adjustment, + coupon->dayCounter(), coupon->accrualStartDate(), coupon->accrualEndDate(), + coupon->referencePeriodStart(), coupon->referencePeriodEnd()); fixedCFS.push_back(newCpn); } - //this is the irregular swap with spread removed - swap_ = ext::make_shared(arguments_.swap->type(),fixedCFS,floatCFS); - + // this is the irregular swap with spread removed + swap_ = ext::make_shared(arguments_.swap->type(), fixedCFS, floatCFS); - //Sets up the basket by implementing the methodology described in - //P.S.Hagan "Callable Swaps and Bermudan 'Exercise into Swaptions'" - Basket basket(swap_,termStructure_,volatilityStructure_); + // Sets up the basket by implementing the methodology described in + // P.S.Hagan "Callable Swaps and Bermudan 'Exercise into Swaptions'" + Basket basket(swap_, termStructure_, volatilityStructure_); /////////////////////////////////////////////////////////////////////////////////////////////////// - //find lambda // + // find lambda // /////////////////////////////////////////////////////////////////////////////////////////////////// Bisection s1d; @@ -334,48 +313,50 @@ namespace QuantLib { s1d.setMaxEvaluations(10000); s1d.setLowerBound(minLambda); s1d.setUpperBound(maxLambda); - s1d.solve(basket,1.0e-8,0.01, minLambda, maxLambda); + s1d.solve(basket, 1.0e-8, 0.01, minLambda, maxLambda); ///////////////////////////////////////////////////////////////////////////////////////////////// - // compute the price of the irreg swaption as the sum of the prices of the regular swaptions // + // compute the price of the irreg swaption as the sum of the prices of the regular + // swaptions // ///////////////////////////////////////////////////////////////////////////////////////////////// - results_.value = HKPrice(basket,exercise_); + results_.value = HKPrice(basket, exercise_); } - ///////////////////////////////////////////////////////////////////////////////////////// // Computes irregular swaption price according to P.J. Hunt, J.E. Kennedy: // - // "Implied interest rate pricing models", Finance Stochast. 2, 275–293 (1998) // + // "Implied interest rate pricing models", Finance Stochast. 2, 275-293 (1998) // ///////////////////////////////////////////////////////////////////////////////////////// - Real HaganIrregularSwaptionEngine::HKPrice(Basket& basket,ext::shared_ptr& exercise) const { + Real HaganIrregularSwaptionEngine::HKPrice(Basket& basket, + ext::shared_ptr& exercise) const { + + // Swaption Engine: assumes that the swaptions exercise date equals the swap start date + QL_REQUIRE((volatilityStructure_->volatilityType() == Normal), + "swaptionEngine: only normal volatility implemented."); + - // Black 76 Swaption Engine: assumes that the swaptions exercise date equals the swap start date - ext::shared_ptr blackSwaptionEngine = - ext::shared_ptr(new BlackSwaptionEngine(termStructure_,volatilityStructure_)); + ext::shared_ptr swaptionEngine = ext::shared_ptr( + new BachelierSwaptionEngine(termStructure_, volatilityStructure_)); - //retrieve weights of underlying swaps + + // retrieve weights of underlying swaps Array weights = basket.weights(); Real npv = 0.0; - for(Size i=0; i pvSwap_ = basket.component(i); - Swaption swaption = Swaption(pvSwap_,exercise); - swaption.setPricingEngine(blackSwaptionEngine); - npv += weights[i]*swaption.NPV(); + Swaption swaption = Swaption(pvSwap_, exercise); + swaption.setPricingEngine(swaptionEngine); + npv += weights[i] * swaption.NPV(); } return npv; - } - - } diff --git a/ql/experimental/swaptions/haganirregularswaptionengine.hpp b/ql/experimental/swaptions/haganirregularswaptionengine.hpp index 632fdd58ff8..26ac41f2d88 100644 --- a/ql/experimental/swaptions/haganirregularswaptionengine.hpp +++ b/ql/experimental/swaptions/haganirregularswaptionengine.hpp @@ -39,7 +39,7 @@ namespace QuantLib { 1. P.S. Hagan: "Methodology for Callable Swaps and Bermudan 'Exercise into Swaptions'" 2. P.J. Hunt, J.E. Kennedy: "Implied interest rate pricing - models", Finance Stochast. 2, 275–293 (1998) + models", Finance Stochast. 2, 275-293 (1998) \warning Currently a spread is not handled correctly; it should be a minor exercise to account for this @@ -67,6 +67,7 @@ namespace QuantLib { ext::shared_ptr component(Size i) const; Array weights() const { return compute(lambda_); }; Real& lambda() const { return lambda_; }; + // NOLINTNEXTLINE(cppcoreguidelines-noexcept-swap,performance-noexcept-swap) ext::shared_ptr swap() const { return swap_; }; private: ext::shared_ptr swap_; diff --git a/ql/experimental/swaptions/irregularswap.hpp b/ql/experimental/swaptions/irregularswap.hpp index c378a7692d6..5257d6f44ad 100644 --- a/ql/experimental/swaptions/irregularswap.hpp +++ b/ql/experimental/swaptions/irregularswap.hpp @@ -32,7 +32,6 @@ #include #include #include -#include namespace QuantLib { diff --git a/ql/experimental/swaptions/irregularswaption.cpp b/ql/experimental/swaptions/irregularswaption.cpp index d3127db5038..601018d164c 100644 --- a/ql/experimental/swaptions/irregularswaption.cpp +++ b/ql/experimental/swaptions/irregularswaption.cpp @@ -21,6 +21,7 @@ FOR A PARTICULAR PURPOSE. See the license for more details. */ +#include #include #include #include @@ -79,7 +80,7 @@ namespace QuantLib { auto vega_ = results_->additionalResults.find("vega"); QL_REQUIRE(vega_ != results_->additionalResults.end(), "vega not provided"); - return boost::any_cast(vega_->second); + return ext::any_cast(vega_->second); } } diff --git a/ql/experimental/termstructures/Makefile.am b/ql/experimental/termstructures/Makefile.am index d7b9bfabaa1..8c4743d0d3b 100644 --- a/ql/experimental/termstructures/Makefile.am +++ b/ql/experimental/termstructures/Makefile.am @@ -39,7 +39,7 @@ all.hpp: Makefile.am echo "/* This file is automatically generated; do not edit. */" > ${srcdir}/$@ echo "/* Add the files to be included into Makefile.am instead. */" >> ${srcdir}/$@ echo >> ${srcdir}/$@ - for i in $(filter-out all.hpp, $(this_include_HEADERS)); do \ + for i in $(filter-out all.hpp multicurvesensitivities.hpp, $(this_include_HEADERS)); do \ echo "#include <${subdir}/$$i>" >> ${srcdir}/$@; \ done echo >> ${srcdir}/$@ diff --git a/ql/experimental/termstructures/all.hpp b/ql/experimental/termstructures/all.hpp index b64202a2929..507a677f88b 100644 --- a/ql/experimental/termstructures/all.hpp +++ b/ql/experimental/termstructures/all.hpp @@ -3,5 +3,4 @@ #include #include -#include diff --git a/ql/experimental/termstructures/basisswapratehelpers.cpp b/ql/experimental/termstructures/basisswapratehelpers.cpp index 894b9a56159..d850912754f 100644 --- a/ql/experimental/termstructures/basisswapratehelpers.cpp +++ b/ql/experimental/termstructures/basisswapratehelpers.cpp @@ -95,8 +95,6 @@ namespace QuantLib { } void IborIborBasisSwapRateHelper::setTermStructure(YieldTermStructure* t) { - // do not set the relinkable handle as an observer - - // force recalculation when needed---the index is not lazy bool observer = false; ext::shared_ptr temp(t, null_deleter()); @@ -106,7 +104,7 @@ namespace QuantLib { } Real IborIborBasisSwapRateHelper::impliedQuote() const { - swap_->recalculate(); + swap_->deepUpdate(); return - (swap_->NPV() / swap_->legBPS(0)) * 1.0e-4; } @@ -185,7 +183,7 @@ namespace QuantLib { } Real OvernightIborBasisSwapRateHelper::impliedQuote() const { - swap_->recalculate(); + swap_->deepUpdate(); return - (swap_->NPV() / swap_->legBPS(0)) * 1.0e-4; } diff --git a/ql/experimental/termstructures/multicurvesensitivities.hpp b/ql/experimental/termstructures/multicurvesensitivities.hpp index 7d16a480b7a..14d22630baf 100644 --- a/ql/experimental/termstructures/multicurvesensitivities.hpp +++ b/ql/experimental/termstructures/multicurvesensitivities.hpp @@ -17,150 +17,10 @@ FOR A PARTICULAR PURPOSE. See the license for more details. */ -/*! \file multicurvesensitivities.hpp - \brief compute piecewise-curve sensitivities to the input instruments. -*/ - #ifndef quantlib_multicurve_sensitivity_hpp #define quantlib_multicurve_sensitivity_hpp -#include -#include -#include -#include -#include -#include - -namespace { - inline QuantLib::Real secondElement(const std::pair& p) { - return p.second; - } -} - -namespace QuantLib { - -//! Multi curve sensitivities -/*! This class provides a simple (yet most likely not the fastest) way to create sensitivities - to the par quotes, provided in the piecewiseyieldcurve for stripping. If constructed with more -than one curve, the class iterates over all quotes of the provided curves and shifts each quote of all provided curves -taking interdependence into account. - -The class computes the sensitvities as a QuantLib Matrix class in the form: -\f[ -\frac{\partial z_i}{\partial q_j} -\f] -where the \f$(z_i)_{i\in \{1,...,n\}}\f$'s are the implied values (being the traits used during curve -constructions, e.g. ZeroYield, Discountfactors or ForwardRates) and the the \f$(q_i)_{i\in \{1,...,n\}}\f$'s are the -quoted par rates. - - -\note It's the users job to provide all curves that influence the implied rates. - - \deprecated To be removed as unused. - Copy it in your codebase if you need it. - Deprecated in version 1.27. - -*/ -class QL_DEPRECATED MultiCurveSensitivities : public LazyObject { -private: - typedef std::map< std::string, Handle< YieldTermStructure > > curvespec; - -public: - //! Multi curve sensitivties - /*! @param curves std::map of string (curve name) and handle to piecewiseyieldcurve - */ - - explicit MultiCurveSensitivities(curvespec curves) : curves_(std::move(curves)) { - for (curvespec::const_iterator it = curves_.begin(); it != curves_.end(); ++it) - registerWith((*it).second); - for (curvespec::const_iterator it = curves_.begin(); it != curves_.end(); ++it) { - ext::shared_ptr > curve = - ext::dynamic_pointer_cast >( - it->second.currentLink()); - QL_REQUIRE(curve != nullptr, "Couldn't cast curvename: " << it->first); - for (auto& instrument : curve->instruments_) { - allQuotes_.push_back(instrument->quote()); - std::stringstream tmp; - tmp << QuantLib::io::iso_date(instrument->latestRelevantDate()); - headers_.push_back(it->first + "_" + tmp.str()); - } - } - } - - Matrix sensitivities() const; - Matrix inverseSensitivities() const; - std::vector< std::string > headers() const { return headers_; } - -private: - //! \name LazyObject interface - //@{ - void performCalculations() const override; - //@} - // methods - std::vector< Real > allZeros() const; - std::vector< std::pair< Date, Real > > allNodes() const; - mutable std::vector< Rate > origZeros_; - std::vector< Handle< Quote > > allQuotes_; - std::vector< std::pair< Date, Real > > origNodes_; - mutable Matrix sensi_, invSensi_; - curvespec curves_; - std::vector< std::string > headers_; -}; - -inline void MultiCurveSensitivities::performCalculations() const { - std::vector< Rate > sensiVector; - origZeros_ = allZeros(); - for (const auto& allQuote : allQuotes_) { - Rate bps = +1e-4; - Rate origQuote = allQuote->value(); - ext::shared_ptr q = - ext::dynamic_pointer_cast(allQuote.currentLink()); - q->setValue(origQuote + bps); - try { - std::vector tmp(allZeros()); - for (Size i = 0; i < tmp.size(); ++i) - sensiVector.push_back((tmp[i] - origZeros_[i]) / bps); - q->setValue(origQuote); - } catch (...) { - q->setValue(origQuote); - QL_FAIL("Application of shift to quote led to exception."); - } - } - Matrix result(origZeros_.size(), origZeros_.size(), sensiVector.begin(), sensiVector.end()); - sensi_ = result; - invSensi_ = inverse(sensi_); -} - -inline Matrix MultiCurveSensitivities::sensitivities() const { - calculate(); - return sensi_; -} - -inline Matrix MultiCurveSensitivities::inverseSensitivities() const { - calculate(); - return invSensi_; -} - -inline std::vector< std::pair< Date, Real > > MultiCurveSensitivities::allNodes() const { - std::vector< std::pair< Date, Real > > result; - for (const auto& it : curves_) { - ext::shared_ptr > curve = - ext::dynamic_pointer_cast >( - it.second.currentLink()); - result.reserve(result.size() + curve->nodes().size() - 1); - for (std::vector >::const_iterator p = curve->nodes().begin() + 1; - p != curve->nodes().end(); ++p) - result.push_back(*p); - } - return result; -} - -inline std::vector< Real > MultiCurveSensitivities::allZeros() const { - std::vector< std::pair< Date, Real > > result = allNodes(); - std::vector< Real > zeros; - std::transform(result.begin(), result.end(), std::back_inserter(zeros), secondElement); - return zeros; -} -} +// Deprecated in version 1.32 +#pragma message("Warning: this file is empty and will disappear in a future release; do not include it.") #endif diff --git a/ql/experimental/variancegamma/fftvanillaengine.hpp b/ql/experimental/variancegamma/fftvanillaengine.hpp index 6106aeae03c..1a18cf79dd4 100644 --- a/ql/experimental/variancegamma/fftvanillaengine.hpp +++ b/ql/experimental/variancegamma/fftvanillaengine.hpp @@ -26,6 +26,7 @@ FOR A PARTICULAR PURPOSE. See the license for more details. #include #include +#include namespace QuantLib { diff --git a/ql/experimental/variancegamma/fftvariancegammaengine.cpp b/ql/experimental/variancegamma/fftvariancegammaengine.cpp index 0e6ec8f140a..e5d1d316988 100644 --- a/ql/experimental/variancegamma/fftvariancegammaengine.cpp +++ b/ql/experimental/variancegamma/fftvariancegammaengine.cpp @@ -19,7 +19,6 @@ FOR A PARTICULAR PURPOSE. See the license for more details. #include #include -#include namespace QuantLib { diff --git a/ql/experimental/variancegamma/fftvariancegammaengine.hpp b/ql/experimental/variancegamma/fftvariancegammaengine.hpp index 82dc6a66ad6..ab44ca75abf 100644 --- a/ql/experimental/variancegamma/fftvariancegammaengine.hpp +++ b/ql/experimental/variancegamma/fftvariancegammaengine.hpp @@ -26,6 +26,7 @@ FOR A PARTICULAR PURPOSE. See the license for more details. #include #include +#include namespace QuantLib { diff --git a/ql/experimental/volatility/Makefile.am b/ql/experimental/volatility/Makefile.am index c956434ee6a..024a027985d 100644 --- a/ql/experimental/volatility/Makefile.am +++ b/ql/experimental/volatility/Makefile.am @@ -72,7 +72,7 @@ all.hpp: Makefile.am echo "/* This file is automatically generated; do not edit. */" > ${srcdir}/$@ echo "/* Add the files to be included into Makefile.am instead. */" >> ${srcdir}/$@ echo >> ${srcdir}/$@ - for i in $(filter-out all.hpp, $(this_include_HEADERS)); do \ + for i in $(filter-out all.hpp swaptionvolcube1a.hpp, $(this_include_HEADERS)); do \ echo "#include <${subdir}/$$i>" >> ${srcdir}/$@; \ done echo >> ${srcdir}/$@ diff --git a/ql/experimental/volatility/all.hpp b/ql/experimental/volatility/all.hpp index 776e9403cd1..cd8f49a3fdb 100644 --- a/ql/experimental/volatility/all.hpp +++ b/ql/experimental/volatility/all.hpp @@ -18,7 +18,6 @@ #include #include #include -#include #include #include #include diff --git a/ql/experimental/volatility/interestratevolsurface.hpp b/ql/experimental/volatility/interestratevolsurface.hpp index ab218aa4383..d8d0714b493 100644 --- a/ql/experimental/volatility/interestratevolsurface.hpp +++ b/ql/experimental/volatility/interestratevolsurface.hpp @@ -25,7 +25,6 @@ #define quantlib_interest_rate_vol_surface_hpp #include -#include #include namespace QuantLib { diff --git a/ql/experimental/volatility/zabr.cpp b/ql/experimental/volatility/zabr.cpp index f5e87a8d797..72e1e02fa40 100644 --- a/ql/experimental/volatility/zabr.cpp +++ b/ql/experimental/volatility/zabr.cpp @@ -130,11 +130,20 @@ std::vector ZabrModel::fdPrice(const std::vector &strikes) const { (Size)std::ceil(expiryTime_ * 24); // number of steps in dimension t const Size dampingSteps = 5; // thereof damping steps +#if defined(__GNUC__) && (__GNUC__ >= 12) +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Warray-bounds" +#endif + // Layout std::vector dim(1, size); const ext::shared_ptr layout( new FdmLinearOpLayout(dim)); +#if defined(__GNUC__) && (__GNUC__ >= 12) +#pragma GCC diagnostic pop +#endif + // Mesher const ext::shared_ptr m1(new Concentrating1dMesher( start, end, size, std::pair(forward_, density), true)); @@ -154,8 +163,7 @@ std::vector ZabrModel::fdPrice(const std::vector &strikes) const { // initial values Array rhs(mesher->layout()->size()); - for (FdmLinearOpIterator iter = layout->begin(); iter != layout->end(); - ++iter) { + for (const auto& iter : *layout) { Real k = mesher->location(iter, 0); rhs[iter.index()] = std::max(forward_ - k, 0.0); } @@ -266,8 +274,7 @@ Real ZabrModel::fullFdPrice(const Real strike) const { Array rhs(mesher->layout()->size()); std::vector f_; std::vector v_; - for (FdmLinearOpIterator iter = layout->begin(); iter != layout->end(); - ++iter) { + for (const auto& iter : *layout) { Real f = mesher->location(iter, 0); // Real v = mesher->location(iter, 0); rhs[iter.index()] = std::max(f - strike, 0.0); diff --git a/ql/functional.hpp b/ql/functional.hpp index cfa6ad3a598..b4624ddc223 100644 --- a/ql/functional.hpp +++ b/ql/functional.hpp @@ -46,6 +46,10 @@ namespace QuantLib { namespace placeholders { using namespace std::placeholders; // NOLINT(misc-unused-using-decls) } + /*! \deprecated To check if a function is empty, use it in a bool context + instead of comparing it to QL_NULL_FUNCTION. + Deprecated in version 1.32. + */ #define QL_NULL_FUNCTION nullptr #else using boost::function; // NOLINT(misc-unused-using-decls) @@ -67,6 +71,10 @@ namespace QuantLib { using ::_9; // NOLINT(misc-unused-using-decls) #endif } + /*! \deprecated To check if a function is empty, use it in a bool context + instead of comparing it to QL_NULL_FUNCTION. + Deprecated in version 1.32. + */ #define QL_NULL_FUNCTION 0 #endif diff --git a/ql/indexes/ibor/Makefile.am b/ql/indexes/ibor/Makefile.am index 3935c2294d9..cc7721a4c0c 100644 --- a/ql/indexes/ibor/Makefile.am +++ b/ql/indexes/ibor/Makefile.am @@ -12,6 +12,8 @@ this_include_HEADERS = \ cadlibor.hpp \ cdor.hpp \ chflibor.hpp \ + corra.hpp \ + destr.hpp \ dkklibor.hpp \ eonia.hpp \ estr.hpp \ @@ -31,6 +33,7 @@ this_include_HEADERS = \ shibor.hpp \ sofr.hpp \ sonia.hpp \ + swestr.hpp \ tibor.hpp \ tona.hpp \ thbfix.hpp \ @@ -41,6 +44,7 @@ this_include_HEADERS = \ cpp_files = \ bibor.cpp \ + corra.cpp \ eonia.cpp \ estr.cpp \ euribor.cpp \ diff --git a/ql/indexes/ibor/all.hpp b/ql/indexes/ibor/all.hpp index d393a988785..4dbae78eaa9 100644 --- a/ql/indexes/ibor/all.hpp +++ b/ql/indexes/ibor/all.hpp @@ -9,6 +9,8 @@ #include #include #include +#include +#include #include #include #include @@ -28,6 +30,7 @@ #include #include #include +#include #include #include #include diff --git a/ql/pricingengines/vanilla/fddividendshoutengine.hpp b/ql/indexes/ibor/corra.cpp similarity index 71% rename from ql/pricingengines/vanilla/fddividendshoutengine.hpp rename to ql/indexes/ibor/corra.cpp index 83cf3da8d46..e77a3b7b784 100644 --- a/ql/pricingengines/vanilla/fddividendshoutengine.hpp +++ b/ql/indexes/ibor/corra.cpp @@ -1,8 +1,7 @@ /* -*- mode: c++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /* - Copyright (C) 2005 Joseph Wang - Copyright (C) 2009 StatPro Italia srl + Copyright (C) 2023 Aditya Narayan Das This file is part of QuantLib, a free-software/open-source library for financial quantitative analysts and developers - http://quantlib.org/ @@ -18,11 +17,11 @@ FOR A PARTICULAR PURPOSE. See the license for more details. */ -#ifndef quantlib_fd_dividend_shout_engine_hpp -#define quantlib_fd_dividend_shout_engine_hpp +#include +#include +#include -// Deprecated in version 1.27 -#pragma message("Warning: this file is empty and will disappear in a future release; do not include it.") - - -#endif +namespace QuantLib { + Corra::Corra(const Handle& h) + : OvernightIndex("CORRA", 0, CADCurrency(), Canada(), Actual365Fixed(), h) {} +} \ No newline at end of file diff --git a/ql/pricingengines/vanilla/fdshoutengine.hpp b/ql/indexes/ibor/corra.hpp similarity index 73% rename from ql/pricingengines/vanilla/fdshoutengine.hpp rename to ql/indexes/ibor/corra.hpp index d68f44a78c2..7904307f201 100644 --- a/ql/pricingengines/vanilla/fdshoutengine.hpp +++ b/ql/indexes/ibor/corra.hpp @@ -1,8 +1,7 @@ /* -*- mode: c++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /* - Copyright (C) 2005 Joseph Wang - Copyright (C) 2009 StatPro Italia srl + Copyright (C) 2023 Aditya Narayan Das This file is part of QuantLib, a free-software/open-source library for financial quantitative analysts and developers - http://quantlib.org/ @@ -18,11 +17,17 @@ FOR A PARTICULAR PURPOSE. See the license for more details. */ -#ifndef quantlib_fd_shout_engine_hpp -#define quantlib_fd_shout_engine_hpp +#ifndef quantlib_corra_hpp +#define quantlib_corra_hpp -// Deprecated in version 1.27 -#pragma message("Warning: this file is empty and will disappear in a future release; do not include it.") +#include + +namespace QuantLib { + class Corra : public OvernightIndex { + public: + explicit Corra(const Handle& h = {}); + }; +} #endif diff --git a/ql/methods/finitedifferences/onefactoroperator.hpp b/ql/indexes/ibor/destr.hpp similarity index 56% rename from ql/methods/finitedifferences/onefactoroperator.hpp rename to ql/indexes/ibor/destr.hpp index 4c280a76484..18562b88de2 100644 --- a/ql/methods/finitedifferences/onefactoroperator.hpp +++ b/ql/indexes/ibor/destr.hpp @@ -1,7 +1,7 @@ /* -*- mode: c++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /* - Copyright (C) 2001, 2002, 2003 Sadruddin Rejeb + Copyright (C) 2023 Skandinaviska Enskilda Banken AB (publ) This file is part of QuantLib, a free-software/open-source library for financial quantitative analysts and developers - http://quantlib.org/ @@ -17,11 +17,27 @@ FOR A PARTICULAR PURPOSE. See the license for more details. */ -#ifndef quantlib_finite_differences_one_factor_operator_hpp -#define quantlib_finite_differences_one_factor_operator_hpp +/*! \file destr.hpp + \brief %DESTR index +*/ + +#ifndef quantlib_destr_hpp +#define quantlib_destr_hpp + +#include +#include +#include +#include + +namespace QuantLib { -// Deprecated in version 1.27 -#pragma message("Warning: this file is empty and will disappear in a future release; do not include it.") + //! %Destr (Denmark Short-Term Rate) index. + class Destr : public OvernightIndex { + public: + explicit Destr(const Handle& h = {}) + : OvernightIndex("DESTR", 0, DKKCurrency(), Denmark(), Actual360(), h) {} + }; +} #endif diff --git a/ql/indexes/ibor/sofr.cpp b/ql/indexes/ibor/sofr.cpp index 8948c4e5216..99333a22c87 100644 --- a/ql/indexes/ibor/sofr.cpp +++ b/ql/indexes/ibor/sofr.cpp @@ -26,7 +26,7 @@ namespace QuantLib { Sofr::Sofr(const Handle& h) : OvernightIndex("SOFR", 0, USDCurrency(), - UnitedStates(UnitedStates::GovernmentBond), + UnitedStates(UnitedStates::SOFR), Actual360(), h) {} } diff --git a/ql/indexes/ibor/swestr.hpp b/ql/indexes/ibor/swestr.hpp new file mode 100644 index 00000000000..e96ca2900de --- /dev/null +++ b/ql/indexes/ibor/swestr.hpp @@ -0,0 +1,43 @@ +/* -*- mode: c++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ + +/* + Copyright (C) 2023 Skandinaviska Enskilda Banken AB (publ) + + This file is part of QuantLib, a free-software/open-source library + for financial quantitative analysts and developers - http://quantlib.org/ + + QuantLib is free software: you can redistribute it and/or modify it + under the terms of the QuantLib license. You should have received a + copy of the license along with this program; if not, please email + . The license is also available online at + . + + This program is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS + FOR A PARTICULAR PURPOSE. See the license for more details. +*/ + +/*! \file swestr.hpp + \brief %SWESTR index +*/ + +#ifndef quantlib_swestr_hpp +#define quantlib_swestr_hpp + +#include +#include +#include +#include + +namespace QuantLib { + + //! %Swestr (Swedish krona Short Term Rate) index. + class Swestr : public OvernightIndex { + public: + explicit Swestr(const Handle& h = {}) + : OvernightIndex("SWESTR", 0, SEKCurrency(), Sweden(), Actual360(), h) {} + }; + +} + +#endif diff --git a/ql/indexes/indexmanager.cpp b/ql/indexes/indexmanager.cpp index b9ee3b34973..19f4c4f77de 100644 --- a/ql/indexes/indexmanager.cpp +++ b/ql/indexes/indexmanager.cpp @@ -18,43 +18,39 @@ */ #include -#include - -using boost::algorithm::to_upper_copy; -using std::string; namespace QuantLib { - bool IndexManager::hasHistory(const string& name) const { - return data_.find(to_upper_copy(name)) != data_.end(); + bool IndexManager::hasHistory(const std::string& name) const { + return data_.find(name) != data_.end(); } - const TimeSeries& IndexManager::getHistory(const string& name) const { - return data_[to_upper_copy(name)].value(); + const TimeSeries& IndexManager::getHistory(const std::string& name) const { + return data_[name].value(); } - void IndexManager::setHistory(const string& name, TimeSeries history) { - data_[to_upper_copy(name)] = std::move(history); + void IndexManager::setHistory(const std::string& name, TimeSeries history) { + data_[name] = std::move(history); } - ext::shared_ptr IndexManager::notifier(const string& name) const { - return data_[to_upper_copy(name)]; + ext::shared_ptr IndexManager::notifier(const std::string& name) const { + return data_[name]; } - std::vector IndexManager::histories() const { - std::vector temp; + std::vector IndexManager::histories() const { + std::vector temp; temp.reserve(data_.size()); for (const auto& i : data_) temp.push_back(i.first); return temp; } - void IndexManager::clearHistory(const string& name) { data_.erase(to_upper_copy(name)); } + void IndexManager::clearHistory(const std::string& name) { data_.erase(name); } void IndexManager::clearHistories() { data_.clear(); } bool IndexManager::hasHistoricalFixing(const std::string& name, const Date& fixingDate) const { - auto const& indexIter = data_.find(to_upper_copy(name)); + auto const& indexIter = data_.find(name); return (indexIter != data_.end()) && ((*indexIter).second.value()[fixingDate] != Null()); } diff --git a/ql/indexes/indexmanager.hpp b/ql/indexes/indexmanager.hpp index d08ad0f87d6..0115aabfe93 100644 --- a/ql/indexes/indexmanager.hpp +++ b/ql/indexes/indexmanager.hpp @@ -27,7 +27,8 @@ #include #include #include - +#include +#include namespace QuantLib { @@ -58,7 +59,15 @@ namespace QuantLib { bool hasHistoricalFixing(const std::string& name, const Date& fixingDate) const; private: - mutable std::map>> data_; + struct CaseInsensitiveCompare { + bool operator()(const std::string& s1, const std::string& s2) const { + return std::lexicographical_compare(s1.begin(), s1.end(), s2.begin(), s2.end(), [](const auto& c1, const auto& c2) { + return std::toupper(static_cast(c1)) < std::toupper(static_cast(c2)); + }); + } + }; + + mutable std::map>, CaseInsensitiveCompare> data_; }; } diff --git a/ql/indexes/inflation/aucpi.hpp b/ql/indexes/inflation/aucpi.hpp index 0fea1a80b71..435396e31c9 100644 --- a/ql/indexes/inflation/aucpi.hpp +++ b/ql/indexes/inflation/aucpi.hpp @@ -55,7 +55,7 @@ namespace QuantLib { }; - //! Genuine year-on-year AU CPI (i.e. not a ratio) + //! Quoted year-on-year AU CPI (i.e. not a ratio) class YYAUCPI : public YoYInflationIndex { public: YYAUCPI(Frequency frequency, @@ -66,7 +66,6 @@ namespace QuantLib { AustraliaRegion(), revised, interpolated, - false, frequency, Period(2, Months), AUDCurrency(), @@ -74,8 +73,13 @@ namespace QuantLib { }; - //! Fake year-on-year AUCPI (i.e. a ratio) - class YYAUCPIr : public YoYInflationIndex { + QL_DEPRECATED_DISABLE_WARNING + + //! Year-on-year AUCPI (i.e. a ratio) + /*! \deprecated Pass the AUCPI index to YoYInflationIndex instead. + Deprecated in version 1.31. + */ + class [[deprecated("Pass the AUCPI index to YoYInflationIndex instead")]] YYAUCPIr : public YoYInflationIndex { public: YYAUCPIr(Frequency frequency, bool revised, @@ -91,6 +95,8 @@ namespace QuantLib { AUDCurrency(), ts) {} }; + + QL_DEPRECATED_ENABLE_WARNING } #endif diff --git a/ql/indexes/inflation/euhicp.hpp b/ql/indexes/inflation/euhicp.hpp index 700dc031510..c93a0cee870 100644 --- a/ql/indexes/inflation/euhicp.hpp +++ b/ql/indexes/inflation/euhicp.hpp @@ -84,7 +84,7 @@ namespace QuantLib { }; - //! Genuine year-on-year EU HICP (i.e. not a ratio of EU HICP) + //! Quoted year-on-year EU HICP (i.e. not a ratio of EU HICP) class YYEUHICP : public YoYInflationIndex { public: explicit YYEUHICP( @@ -94,14 +94,13 @@ namespace QuantLib { EURegion(), false, interpolated, - false, Monthly, Period(1, Months), EURCurrency(), ts) {} }; - //! Genuine year-on-year EU HICPXT + //! Quoted year-on-year EU HICPXT class YYEUHICPXT : public YoYInflationIndex { public: explicit YYEUHICPXT( @@ -111,7 +110,6 @@ namespace QuantLib { EURegion(), false, interpolated, - false, Monthly, Period(1, Months), EURCurrency(), @@ -119,8 +117,13 @@ namespace QuantLib { }; - //! Fake year-on-year EU HICP (i.e. a ratio of EU HICP) - class YYEUHICPr : public YoYInflationIndex { + QL_DEPRECATED_DISABLE_WARNING + + //! Year-on-year EU HICP (i.e. a ratio of EU HICP) + /*! \deprecated Pass the EUHICP index to YoYInflationIndex instead. + Deprecated in version 1.31. + */ + class [[deprecated("Pass the EUHICP index to YoYInflationIndex instead")]] YYEUHICPr : public YoYInflationIndex { public: explicit YYEUHICPr( bool interpolated, @@ -136,6 +139,7 @@ namespace QuantLib { ts) {} }; + QL_DEPRECATED_ENABLE_WARNING } diff --git a/ql/indexes/inflation/frhicp.hpp b/ql/indexes/inflation/frhicp.hpp index f1410b8fbd2..70371417990 100644 --- a/ql/indexes/inflation/frhicp.hpp +++ b/ql/indexes/inflation/frhicp.hpp @@ -52,7 +52,7 @@ namespace QuantLib { }; - //! Genuine year-on-year FR HICP (i.e. not a ratio) + //! Quoted year-on-year FR HICP (i.e. not a ratio) class YYFRHICP : public YoYInflationIndex { public: explicit YYFRHICP( @@ -62,7 +62,6 @@ namespace QuantLib { FranceRegion(), false, interpolated, - false, Monthly, Period(1, Months), EURCurrency(), @@ -70,8 +69,13 @@ namespace QuantLib { }; - //! Fake year-on-year FR HICP (i.e. a ratio) - class YYFRHICPr : public YoYInflationIndex { + QL_DEPRECATED_DISABLE_WARNING + + //! Year-on-year FR HICP (i.e. a ratio) + /*! \deprecated Pass the FRHICP index to YoYInflationIndex instead. + Deprecated in version 1.31. + */ + class [[deprecated("Pass the FRHICP index to YoYInflationIndex instead")]] YYFRHICPr : public YoYInflationIndex { public: explicit YYFRHICPr( bool interpolated, @@ -87,6 +91,7 @@ namespace QuantLib { ts) {} }; + QL_DEPRECATED_ENABLE_WARNING } #endif diff --git a/ql/indexes/inflation/ukrpi.hpp b/ql/indexes/inflation/ukrpi.hpp index d2c986309de..02c2175bc1a 100644 --- a/ql/indexes/inflation/ukrpi.hpp +++ b/ql/indexes/inflation/ukrpi.hpp @@ -52,7 +52,7 @@ namespace QuantLib { }; - //! Genuine year-on-year UK RPI (i.e. not a ratio of UK RPI) + //! Quoted year-on-year UK RPI (i.e. not a ratio of UK RPI) class YYUKRPI : public YoYInflationIndex { public: explicit YYUKRPI( @@ -62,7 +62,6 @@ namespace QuantLib { UKRegion(), false, interpolated, - false, Monthly, Period(1, Months), GBPCurrency(), @@ -70,8 +69,13 @@ namespace QuantLib { }; - //! Fake year-on-year UK RPI (i.e. a ratio of UK RPI) - class YYUKRPIr : public YoYInflationIndex { + QL_DEPRECATED_DISABLE_WARNING + + //! Year-on-year UK RPI (i.e. a ratio of UK RPI) + /*! \deprecated Pass the UKRPI index to YoYInflationIndex instead. + Deprecated in version 1.31. + */ + class [[deprecated("Pass the UKRPI index to YoYInflationIndex instead")]] YYUKRPIr : public YoYInflationIndex { public: explicit YYUKRPIr( bool interpolated, @@ -87,6 +91,7 @@ namespace QuantLib { ts) {} }; + QL_DEPRECATED_ENABLE_WARNING } diff --git a/ql/indexes/inflation/uscpi.hpp b/ql/indexes/inflation/uscpi.hpp index a8a81446d6e..96b573b367f 100644 --- a/ql/indexes/inflation/uscpi.hpp +++ b/ql/indexes/inflation/uscpi.hpp @@ -57,7 +57,7 @@ namespace QuantLib { }; - //! Genuine year-on-year US CPI (i.e. not a ratio of US CPI) + //! Quoted year-on-year US CPI (i.e. not a ratio of US CPI) class YYUSCPI : public YoYInflationIndex { public: explicit YYUSCPI( @@ -67,7 +67,6 @@ namespace QuantLib { USRegion(), false, interpolated, - false, Monthly, Period(1, Months), USDCurrency(), @@ -75,8 +74,13 @@ namespace QuantLib { }; - //! Fake year-on-year US CPI (i.e. a ratio of US CPI) - class YYUSCPIr : public YoYInflationIndex { + QL_DEPRECATED_DISABLE_WARNING + + //! Year-on-year US CPI (i.e. a ratio of US CPI) + /*! \deprecated Pass the USCPI index to YoYInflationIndex instead. + Deprecated in version 1.31. + */ + class [[deprecated("Pass the USCPI index to YoYInflationIndex instead")]] YYUSCPIr : public YoYInflationIndex { public: explicit YYUSCPIr( bool interpolated, @@ -92,6 +96,7 @@ namespace QuantLib { ts) {} }; + QL_DEPRECATED_ENABLE_WARNING } diff --git a/ql/indexes/inflation/zacpi.hpp b/ql/indexes/inflation/zacpi.hpp index d31d9adf356..8f3813c9d34 100644 --- a/ql/indexes/inflation/zacpi.hpp +++ b/ql/indexes/inflation/zacpi.hpp @@ -52,7 +52,7 @@ namespace QuantLib { }; - //! Genuine year-on-year South African CPI (i.e. not a ratio of ZA CPI) + //! Quoted year-on-year South African CPI (i.e. not a ratio of ZA CPI) class YYZACPI : public YoYInflationIndex { public: explicit YYZACPI( @@ -62,7 +62,6 @@ namespace QuantLib { ZARegion(), false, interpolated, - false, Monthly, Period(1, Months), ZARCurrency(), @@ -70,8 +69,13 @@ namespace QuantLib { }; - //! Fake year-on-year South African CPI (i.e. a ratio of ZA CPI) - class YYZACPIr : public YoYInflationIndex { + QL_DEPRECATED_DISABLE_WARNING + + //! Year-on-year South African CPI (i.e. a ratio of ZA CPI) + /*! \deprecated Pass the ZACPI index to YoYInflationIndex instead. + Deprecated in version 1.31. + */ + class [[deprecated("Pass the ZACPI index to YoYInflationIndex instead")]] YYZACPIr : public YoYInflationIndex { public: explicit YYZACPIr( bool interpolated, @@ -87,6 +91,7 @@ namespace QuantLib { ts) {} }; + QL_DEPRECATED_ENABLE_WARNING } diff --git a/ql/indexes/inflationindex.cpp b/ql/indexes/inflationindex.cpp index dbade053303..5f03a19f1e1 100644 --- a/ql/indexes/inflationindex.cpp +++ b/ql/indexes/inflationindex.cpp @@ -283,7 +283,33 @@ namespace QuantLib { return clonedIndex; } - // these still need to be fixed to latest versions + + YoYInflationIndex::YoYInflationIndex(const ext::shared_ptr& underlyingIndex, + bool interpolated, + Handle yoyInflation) + : InflationIndex("YYR_" + underlyingIndex->familyName(), underlyingIndex->region(), + underlyingIndex->revised(), underlyingIndex->frequency(), + underlyingIndex->availabilityLag(), underlyingIndex->currency()), + interpolated_(interpolated), ratio_(true), underlyingIndex_(underlyingIndex), + yoyInflation_(std::move(yoyInflation)) { + registerWith(underlyingIndex_); + registerWith(yoyInflation_); + } + + QL_DEPRECATED_DISABLE_WARNING + + YoYInflationIndex::YoYInflationIndex(const std::string& familyName, + const Region& region, + bool revised, + bool interpolated, + Frequency frequency, + const Period& availabilityLag, + const Currency& currency, + Handle yoyInflation) + : YoYInflationIndex(familyName, region, revised, interpolated, false, + frequency, availabilityLag, currency, std::move(yoyInflation)) {} + + QL_DEPRECATED_ENABLE_WARNING YoYInflationIndex::YoYInflationIndex(const std::string& familyName, const Region& region, @@ -296,6 +322,9 @@ namespace QuantLib { Handle yoyInflation) : InflationIndex(familyName, region, revised, frequency, availabilityLag, currency), interpolated_(interpolated), ratio_(ratio), yoyInflation_(std::move(yoyInflation)) { + if (ratio) + underlyingIndex_ = ext::make_shared(familyName, region, revised, + frequency, availabilityLag, currency); registerWith(yoyInflation_); } @@ -311,7 +340,6 @@ namespace QuantLib { Date flatMustForecastOn = lastFix+1; Date interpMustForecastOn = lastFix+1 - Period(frequency_); - if (interpolated() && fixingDate >= interpMustForecastOn) { return forecastFixing(fixingDate); } @@ -320,54 +348,15 @@ namespace QuantLib { return forecastFixing(fixingDate); } - // four cases with ratio() and interpolated() - const TimeSeries& ts = timeSeries(); if (ratio()) { - if(interpolated()){ // IS ratio, IS interpolated + auto interpolationType = interpolated() ? CPI::Linear : CPI::Flat; - std::pair lim = inflationPeriod(fixingDate, frequency_); - Date fixMinus1Y = NullCalendar().advance(fixingDate, -1*Years, ModifiedFollowing); - std::pair limBef = inflationPeriod(fixMinus1Y, frequency_); - Real dp = lim.second + 1 - lim.first; - Real dpBef = limBef.second + 1 - limBef.first; - Real dl = fixingDate-lim.first; - // potentially does not work on 29th Feb - Real dlBef = fixMinus1Y - limBef.first; - // get the four relevant fixings - Rate limFirstFix = ts[lim.first]; - QL_REQUIRE(limFirstFix != Null(), - "Missing " << name() << " fixing for " << lim.first ); - Rate limSecondFix = ts[lim.second+1]; - QL_REQUIRE(limSecondFix != Null(), - "Missing " << name() << " fixing for " << lim.second+1 ); - Rate limBefFirstFix = ts[limBef.first]; - QL_REQUIRE(limBefFirstFix != Null(), - "Missing " << name() << " fixing for " << limBef.first ); - Rate limBefSecondFix = ts[limBef.second+1]; - QL_REQUIRE(limBefSecondFix != Null(), - "Missing " << name() << " fixing for " << limBef.second+1 ); + Rate pastFixing = CPI::laggedFixing(underlyingIndex_, fixingDate, Period(0, Months), interpolationType); + Rate previousFixing = CPI::laggedFixing(underlyingIndex_, fixingDate - 1*Years, Period(0, Months), interpolationType); - Real linearNow = limFirstFix + (limSecondFix-limFirstFix)*dl/dp; - Real linearBef = limBefFirstFix + (limBefSecondFix-limBefFirstFix)*dlBef/dpBef; - Rate wasYES = linearNow / linearBef - 1.0; - - return wasYES; - - } else { // IS ratio, NOT interpolated - std::pair lim = inflationPeriod(fixingDate, frequency_); - Rate pastFixing = ts[lim.first]; - QL_REQUIRE(pastFixing != Null(), - "Missing " << name() << " fixing for " << fixingDate); - Date previousDate = fixingDate - 1*Years; - std::pair limBef = inflationPeriod(previousDate, frequency_); - Rate previousFixing = ts[limBef.first]; - QL_REQUIRE(previousFixing != Null(), - "Missing " << name() << " fixing for " << limBef.first ); - - return pastFixing/previousFixing - 1.0; - } + return pastFixing/previousFixing - 1.0; } else { // NOT ratio @@ -418,10 +407,13 @@ namespace QuantLib { ext::shared_ptr YoYInflationIndex::clone( const Handle& h) const { - return ext::make_shared( - familyName_, region_, revised_, - interpolated_, ratio_, frequency_, - availabilityLag_, currency_, h); + if (ratio_) { + return ext::make_shared(underlyingIndex_, interpolated_, h); + } else { + return ext::make_shared(familyName_, region_, revised_, + interpolated_, frequency_, + availabilityLag_, currency_, h); + } } diff --git a/ql/indexes/inflationindex.hpp b/ql/indexes/inflationindex.hpp index a75debb4355..c359e04e7ce 100644 --- a/ql/indexes/inflationindex.hpp +++ b/ql/indexes/inflationindex.hpp @@ -186,7 +186,7 @@ namespace QuantLib { Frequency frequency, const Period& availabilityLag, const Currency& currency, - Handle ts = Handle()); + Handle ts = {}); /*! \deprecated Use the constructor without the "interpolated" parameter. Deprecated in version 1.29. @@ -200,7 +200,7 @@ namespace QuantLib { Frequency frequency, const Period& availabilityLag, const Currency& currency, - Handle ts = Handle()); + Handle ts = {}); //! \name Index interface //@{ @@ -212,8 +212,7 @@ namespace QuantLib { //! \name Other methods //@{ Handle zeroInflationTermStructure() const; - ext::shared_ptr clone( - const Handle& h) const; + ext::shared_ptr clone(const Handle& h) const; //@} private: bool needsForecast(const Date& fixingDate) const; @@ -221,13 +220,52 @@ namespace QuantLib { Handle zeroInflation_; }; + //! Base class for year-on-year inflation indices. - /*! These may be genuine indices published on, say, Bloomberg, or - "fake" indices that are defined as the ratio of an index at - different time points. + /*! These may be quoted indices published on, say, Bloomberg, or can be + defined as the ratio of an index at different time points. */ class YoYInflationIndex : public InflationIndex { public: + //! \name Constructors + //@{ + //! Constructor for year-on-year indices defined as a ratio. + /*! An index build with this constructor doesn't need to store + past fixings of its own; they will be calculated as a + ratio from the past fixings stored in the underlying index. + */ + YoYInflationIndex( + const ext::shared_ptr& underlyingIndex, + bool interpolated, + Handle ts = {}); + + //! Constructor for quoted year-on-year indices. + /*! An index built with this constructor needs its past + fixings (i.e., the past year-on-year values) to be stored + via the `addFixing` or `addFixings` method. + */ + YoYInflationIndex( + const std::string& familyName, + const Region& region, + bool revised, + bool interpolated, + Frequency frequency, + const Period& availabilityLag, + const Currency& currency, + Handle ts = {}); + + //! Old generic constructor for year-on-year indices. + /*! An index built with this constructor needs its past + fixings to be stored via the `addFixing` or `addFixings` + method. Care must be taken about what to store: if + `ratio` is false, the stored values must be the + year-on-year values; if `ratio` is true, they must be the + past fixings of the underlying index. + + \deprecated Use one of the other constructors instead. + Deprecated in version 1.31. + */ + QL_DEPRECATED YoYInflationIndex( const std::string& familyName, const Region& region, @@ -237,7 +275,9 @@ namespace QuantLib { Frequency frequency, const Period& availabilityLag, const Currency& currency, - Handle ts = Handle()); + Handle ts = {}); + //@} + //! \name Index interface //@{ /*! \warning the forecastTodaysFixing parameter (required by @@ -251,10 +291,10 @@ namespace QuantLib { // Override the deprecation above bool interpolated() const; bool ratio() const; + ext::shared_ptr underlyingIndex() const; Handle yoyInflationTermStructure() const; - ext::shared_ptr clone( - const Handle& h) const; + ext::shared_ptr clone(const Handle& h) const; //@} protected: @@ -264,6 +304,7 @@ namespace QuantLib { private: Rate forecastFixing(const Date& fixingDate) const; bool ratio_; + ext::shared_ptr underlyingIndex_; Handle yoyInflation_; }; @@ -333,6 +374,10 @@ namespace QuantLib { return ratio_; } + inline ext::shared_ptr YoYInflationIndex::underlyingIndex() const { + return underlyingIndex_; + } + inline Handle YoYInflationIndex::yoyInflationTermStructure() const { return yoyInflation_; diff --git a/ql/indexes/interestrateindex.cpp b/ql/indexes/interestrateindex.cpp index 088549c02f5..d4e9fab0d70 100644 --- a/ql/indexes/interestrateindex.cpp +++ b/ql/indexes/interestrateindex.cpp @@ -35,7 +35,9 @@ namespace QuantLib { : familyName_(std::move(familyName)), tenor_(tenor), fixingDays_(fixingDays), currency_(std::move(currency)), dayCounter_(std::move(dayCounter)), fixingCalendar_(std::move(fixingCalendar)) { - tenor_.normalize(); + // tenor_.normalize() does too much; we want to leave days alone + if (tenor.units() == Months && tenor.length() % 12 == 0) + tenor_ = Period(tenor.length() / 12, Years); std::ostringstream out; out << familyName_; diff --git a/ql/instrument.cpp b/ql/instrument.cpp new file mode 100644 index 00000000000..68c747df63e --- /dev/null +++ b/ql/instrument.cpp @@ -0,0 +1,49 @@ +/* -*- mode: c++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ + +/* + Copyright (C) 2000, 2001, 2002, 2003 RiskMap srl + Copyright (C) 2003, 2004, 2005, 2006, 2007 StatPro Italia srl + + This file is part of QuantLib, a free-software/open-source library + for financial quantitative analysts and developers - http://quantlib.org/ + + QuantLib is free software: you can redistribute it and/or modify it + under the terms of the QuantLib license. You should have received a + copy of the license along with this program; if not, please email + . The license is also available online at + . + + This program is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS + FOR A PARTICULAR PURPOSE. See the license for more details. +*/ + +#include +#include + +namespace QuantLib { + + Instrument::Instrument() + : NPV_(Null()), errorEstimate_(Null()) { + // this makes sense in general (if the evaluation date + // changes, you probably want to recalculate) and can also + // help avoid some edge cases when lazy objects only forward + // their first notification. + registerWith(Settings::instance().evaluationDate()); + } + + void Instrument::setPricingEngine(const ext::shared_ptr& e) { + if (engine_ != nullptr) + unregisterWith(engine_); + engine_ = e; + if (engine_ != nullptr) + registerWith(engine_); + // trigger (lazy) recalculation and notify observers + update(); + } + + void Instrument::setupArguments(PricingEngine::arguments*) const { + QL_FAIL("Instrument::setupArguments() not implemented"); + } + +} diff --git a/ql/instrument.hpp b/ql/instrument.hpp index 34112e683bd..833665bb0eb 100644 --- a/ql/instrument.hpp +++ b/ql/instrument.hpp @@ -29,7 +29,7 @@ #include #include #include -#include +#include #include #include @@ -58,7 +58,7 @@ namespace QuantLib { //! returns any additional result returned by the pricing engine. template T result(const std::string& tag) const; //! returns all additional result returned by the pricing engine. - const std::map& additionalResults() const; + const std::map& additionalResults() const; //! returns whether the instrument might have value greater than zero. virtual bool isExpired() const = 0; @@ -105,7 +105,7 @@ namespace QuantLib { //@{ mutable Real NPV_, errorEstimate_; mutable Date valuationDate_; - mutable std::map additionalResults_; + mutable std::map additionalResults_; //@} ext::shared_ptr engine_; }; @@ -120,29 +120,12 @@ namespace QuantLib { Real value; Real errorEstimate; Date valuationDate; - std::map additionalResults; + std::map additionalResults; }; // inline definitions - inline Instrument::Instrument() : NPV_(Null()), errorEstimate_(Null()) {} - - inline void Instrument::setPricingEngine( - const ext::shared_ptr& e) { - if (engine_ != nullptr) - unregisterWith(engine_); - engine_ = e; - if (engine_ != nullptr) - registerWith(engine_); - // trigger (lazy) recalculation and notify observers - update(); - } - - inline void Instrument::setupArguments(PricingEngine::arguments*) const { - QL_FAIL("Instrument::setupArguments() not implemented"); - } - inline void Instrument::calculate() const { if (!calculated_) { if (isExpired()) { @@ -204,14 +187,14 @@ namespace QuantLib { template inline T Instrument::result(const std::string& tag) const { calculate(); - std::map::const_iterator value = + std::map::const_iterator value = additionalResults_.find(tag); QL_REQUIRE(value != additionalResults_.end(), tag << " not provided"); - return boost::any_cast(value->second); + return ext::any_cast(value->second); } - inline const std::map& + inline const std::map& Instrument::additionalResults() const { calculate(); return additionalResults_; diff --git a/ql/instruments/asianoption.cpp b/ql/instruments/asianoption.cpp index e91a357208c..06390f89844 100644 --- a/ql/instruments/asianoption.cpp +++ b/ql/instruments/asianoption.cpp @@ -21,6 +21,7 @@ #include #include #include +#include #include namespace QuantLib { diff --git a/ql/instruments/bond.cpp b/ql/instruments/bond.cpp index 27ea6fe9447..8fd704807d4 100644 --- a/ql/instruments/bond.cpp +++ b/ql/instruments/bond.cpp @@ -355,9 +355,9 @@ namespace QuantLib { void Bond::deepUpdate() { for (auto& cashflow : cashflows_) { - ext::shared_ptr f = ext::dynamic_pointer_cast(cashflow); - if (f != nullptr) - f->update(); + if(auto lazy = ext::dynamic_pointer_cast(cashflow)) { + lazy->deepUpdate(); + } } update(); } diff --git a/ql/instruments/callabilityschedule.hpp b/ql/instruments/callabilityschedule.hpp index a6344f85582..c0b7e39ec50 100644 --- a/ql/instruments/callabilityschedule.hpp +++ b/ql/instruments/callabilityschedule.hpp @@ -30,7 +30,7 @@ #include #include #include -#include +#include #include namespace QuantLib { @@ -57,7 +57,7 @@ namespace QuantLib { void accept(AcyclicVisitor&) override; //@} private: - boost::optional price_; + ext::optional price_; Type type_; Date date_; }; diff --git a/ql/instruments/capfloor.cpp b/ql/instruments/capfloor.cpp index c9f549fc910..70298e10906 100644 --- a/ql/instruments/capfloor.cpp +++ b/ql/instruments/capfloor.cpp @@ -21,6 +21,7 @@ FOR A PARTICULAR PURPOSE. See the license for more details. */ +#include #include #include #include @@ -102,7 +103,7 @@ namespace QuantLib { auto vega_ = results_->additionalResults.find("vega"); QL_REQUIRE(vega_ != results_->additionalResults.end(), "vega not provided"); - return boost::any_cast(vega_->second); + return ext::any_cast(vega_->second); } } @@ -269,9 +270,8 @@ namespace QuantLib { void CapFloor::deepUpdate() { for (auto& i : floatingLeg_) { - ext::shared_ptr f = ext::dynamic_pointer_cast(i); - if (f != nullptr) - f->update(); + if(auto lazy = ext::dynamic_pointer_cast(i)) + lazy->deepUpdate(); } update(); } diff --git a/ql/instruments/creditdefaultswap.cpp b/ql/instruments/creditdefaultswap.cpp index 043dc649448..1441057e229 100644 --- a/ql/instruments/creditdefaultswap.cpp +++ b/ql/instruments/creditdefaultswap.cpp @@ -31,6 +31,7 @@ #include #include #include +#include #include namespace QuantLib { @@ -49,7 +50,7 @@ namespace QuantLib { const bool rebatesAccrual, const Date& tradeDate, Natural cashSettlementDays) - : side_(side), notional_(notional), upfront_(boost::none), runningSpread_(spread), + : side_(side), notional_(notional), upfront_(ext::nullopt), runningSpread_(spread), settlesAccrual_(settlesAccrual), paysAtDefaultTime_(paysAtDefaultTime), claim_(std::move(claim)), protectionStart_(protectionStart == Null() ? schedule[0] : protectionStart), @@ -186,7 +187,7 @@ namespace QuantLib { return runningSpread_; } - boost::optional CreditDefaultSwap::upfront() const { + ext::optional CreditDefaultSwap::upfront() const { return upfront_; } @@ -360,7 +361,7 @@ namespace QuantLib { case ISDA: engine = ext::make_shared( probability, recoveryRate, discountCurve, - boost::none, + ext::nullopt, IsdaCdsEngine::Taylor, IsdaCdsEngine::HalfDayBias, IsdaCdsEngine::Piecewise); @@ -401,7 +402,7 @@ namespace QuantLib { case ISDA: engine = ext::make_shared( probability, conventionalRecovery, discountCurve, - boost::none, + ext::nullopt, IsdaCdsEngine::Taylor, IsdaCdsEngine::HalfDayBias, IsdaCdsEngine::Piecewise); diff --git a/ql/instruments/creditdefaultswap.hpp b/ql/instruments/creditdefaultswap.hpp index 4b7fa52cbaa..6180e3dcb46 100644 --- a/ql/instruments/creditdefaultswap.hpp +++ b/ql/instruments/creditdefaultswap.hpp @@ -31,6 +31,7 @@ #include #include #include +#include namespace QuantLib { @@ -175,7 +176,7 @@ namespace QuantLib { Protection::Side side() const; Real notional() const; Rate runningSpread() const; - boost::optional upfront() const; + ext::optional upfront() const; bool settlesAccrual() const; bool paysAtDefaultTime() const; const Leg& coupons() const; @@ -281,7 +282,7 @@ namespace QuantLib { // data members Protection::Side side_; Real notional_; - boost::optional upfront_; + ext::optional upfront_; Rate runningSpread_; bool settlesAccrual_, paysAtDefaultTime_; ext::shared_ptr claim_; @@ -313,7 +314,7 @@ namespace QuantLib { arguments(); Protection::Side side; Real notional; - boost::optional upfront; + ext::optional upfront; Rate spread; Leg leg; // if not initialized by constructors means theres no flows. diff --git a/ql/instruments/equitytotalreturnswap.cpp b/ql/instruments/equitytotalreturnswap.cpp index 4c1c11b5118..c217d858e85 100644 --- a/ql/instruments/equitytotalreturnswap.cpp +++ b/ql/instruments/equitytotalreturnswap.cpp @@ -17,8 +17,8 @@ Copyright (C) 2023 Marcin Rybacki FOR A PARTICULAR PURPOSE. See the license for more details. */ +#include #include -#include #include #include #include @@ -44,8 +44,8 @@ namespace QuantLib { } Date paymentDate = cal.advance(endDate, paymentDelay, Days, paymentConvention, schedule.endOfMonth()); - return ext::make_shared(nominal, equityIndex, startDate, endDate, - paymentDate, true); + return ext::make_shared(nominal, equityIndex, startDate, endDate, + paymentDate); } template diff --git a/ql/instruments/floatfloatswap.cpp b/ql/instruments/floatfloatswap.cpp index f8ec673588d..1df6a850143 100644 --- a/ql/instruments/floatfloatswap.cpp +++ b/ql/instruments/floatfloatswap.cpp @@ -29,6 +29,7 @@ #include #include #include +#include #include namespace QuantLib { @@ -52,8 +53,8 @@ namespace QuantLib { const Real spread2, const Real cappedRate2, const Real flooredRate2, - const boost::optional& paymentConvention1, - const boost::optional& paymentConvention2) + const ext::optional& paymentConvention1, + const ext::optional& paymentConvention2) : Swap(2), type_(type), nominal1_(std::vector(schedule1.size() - 1, nominal1)), nominal2_(std::vector(schedule2.size() - 1, nominal2)), schedule1_(schedule1), schedule2_(schedule2), index1_(std::move(index1)), index2_(std::move(index2)), @@ -91,8 +92,8 @@ namespace QuantLib { std::vector spread2, std::vector cappedRate2, std::vector flooredRate2, - const boost::optional& paymentConvention1, - const boost::optional& paymentConvention2) + const ext::optional& paymentConvention1, + const ext::optional& paymentConvention2) : Swap(2), type_(type), nominal1_(std::move(nominal1)), nominal2_(std::move(nominal2)), schedule1_(std::move(schedule1)), schedule2_(std::move(schedule2)), index1_(std::move(index1)), index2_(std::move(index2)), gearing1_(std::move(gearing1)), @@ -107,8 +108,8 @@ namespace QuantLib { } void FloatFloatSwap::init( - boost::optional paymentConvention1, - boost::optional paymentConvention2) { + ext::optional paymentConvention1, + ext::optional paymentConvention2) { QL_REQUIRE(nominal1_.size() == schedule1_.size() - 1, "nominal1 size (" << nominal1_.size() diff --git a/ql/instruments/floatfloatswap.hpp b/ql/instruments/floatfloatswap.hpp index 4914c609689..8b8419ecba2 100644 --- a/ql/instruments/floatfloatswap.hpp +++ b/ql/instruments/floatfloatswap.hpp @@ -32,7 +32,7 @@ #include #include #include -#include +#include namespace QuantLib { @@ -65,8 +65,8 @@ namespace QuantLib { Real spread2 = 0.0, Real cappedRate2 = Null(), Real flooredRate2 = Null(), - const boost::optional& paymentConvention1 = boost::none, - const boost::optional& paymentConvention2 = boost::none); + const ext::optional& paymentConvention1 = ext::nullopt, + const ext::optional& paymentConvention2 = ext::nullopt); FloatFloatSwap( Swap::Type type, @@ -88,8 +88,8 @@ namespace QuantLib { std::vector spread2 = std::vector(), std::vector cappedRate2 = std::vector(), std::vector flooredRate2 = std::vector(), - const boost::optional& paymentConvention1 = boost::none, - const boost::optional& paymentConvention2 = boost::none); + const ext::optional& paymentConvention1 = ext::nullopt, + const ext::optional& paymentConvention2 = ext::nullopt); //! \name Inspectors //@{ @@ -132,8 +132,8 @@ namespace QuantLib { void fetchResults(const PricingEngine::results*) const override; private: - void init(boost::optional paymentConvention1, - boost::optional paymentConvention2); + void init(ext::optional paymentConvention1, + ext::optional paymentConvention2); void setupExpired() const override; Swap::Type type_; std::vector nominal1_, nominal2_; diff --git a/ql/instruments/floatfloatswaption.cpp b/ql/instruments/floatfloatswaption.cpp index 902f1ebbb88..cbeefe3cb96 100644 --- a/ql/instruments/floatfloatswaption.cpp +++ b/ql/instruments/floatfloatswaption.cpp @@ -30,7 +30,15 @@ namespace QuantLib { : Option(ext::shared_ptr(), exercise), swap_(std::move(swap)), settlementType_(delivery), settlementMethod_(settlementMethod) { registerWith(swap_); - registerWithObservables(swap_); + // When we ask for the NPV of an expired swaption, the + // swap is not recalculated and thus wouldn't forward + // later notifications according to the default behavior of + // LazyObject instances. This means that even if the + // evaluation date changes so that the swaption is no longer + // expired, the instrument wouldn't be notified and thus it + // wouldn't recalculate. To avoid this, we override the + // default behavior of the underlying swap. + swap_->alwaysForwardNotifications(); } bool FloatFloatSwaption::isExpired() const { diff --git a/ql/instruments/forwardrateagreement.cpp b/ql/instruments/forwardrateagreement.cpp index 51bbfc7024c..a4285414de7 100644 --- a/ql/instruments/forwardrateagreement.cpp +++ b/ql/instruments/forwardrateagreement.cpp @@ -33,8 +33,40 @@ namespace QuantLib { const ext::shared_ptr& index, Handle discountCurve, bool useIndexedCoupon) + : ForwardRateAgreement(index, valueDate, maturityDate, type, strikeForwardRate, + notionalAmount, std::move(discountCurve)) { + useIndexedCoupon_ = useIndexedCoupon; + } + + ForwardRateAgreement::ForwardRateAgreement(const Date& valueDate, + Position::Type type, + Rate strikeForwardRate, + Real notionalAmount, + const ext::shared_ptr& index, + Handle discountCurve) + : ForwardRateAgreement(index, valueDate, type, strikeForwardRate, + notionalAmount, std::move(discountCurve)) {} + + ForwardRateAgreement::ForwardRateAgreement(const ext::shared_ptr& index, + const Date& valueDate, + Position::Type type, + Rate strikeForwardRate, + Real notionalAmount, + Handle discountCurve) + : ForwardRateAgreement(index, valueDate, index->maturityDate(valueDate), type, + strikeForwardRate, notionalAmount, std::move(discountCurve)) { + useIndexedCoupon_ = true; + } + + ForwardRateAgreement::ForwardRateAgreement(const ext::shared_ptr& index, + const Date& valueDate, + const Date& maturityDate, + Position::Type type, + Rate strikeForwardRate, + Real notionalAmount, + Handle discountCurve) : fraType_(type), notionalAmount_(notionalAmount), index_(index), - useIndexedCoupon_(useIndexedCoupon), dayCounter_(index->dayCounter()), + useIndexedCoupon_(false), dayCounter_(index->dayCounter()), calendar_(index->fixingCalendar()), businessDayConvention_(index->businessDayConvention()), valueDate_(valueDate), maturityDate_(maturityDate), discountCurve_(std::move(discountCurve)) { @@ -45,6 +77,7 @@ namespace QuantLib { registerWith(discountCurve_); QL_REQUIRE(notionalAmount > 0.0, "notionalAmount must be positive"); + QL_REQUIRE(valueDate_ < maturityDate_, "valueDate must be earlier than maturityDate"); strikeForwardRate_ = InterestRate(strikeForwardRate, index->dayCounter(), @@ -52,15 +85,6 @@ namespace QuantLib { registerWith(index_); } - ForwardRateAgreement::ForwardRateAgreement(const Date& valueDate, - Position::Type type, - Rate strikeForwardRate, - Real notionalAmount, - const ext::shared_ptr& index, - Handle discountCurve) - : ForwardRateAgreement(valueDate, index->maturityDate(valueDate), type, strikeForwardRate, - notionalAmount, index, std::move(discountCurve), true) {} - Date ForwardRateAgreement::fixingDate() const { return index_->fixingDate(valueDate_); } @@ -81,16 +105,13 @@ namespace QuantLib { void ForwardRateAgreement::setupExpired() const { Instrument::setupExpired(); - calculateForwardRate(); } void ForwardRateAgreement::performCalculations() const { calculateAmount(); - Handle discount = discountCurve_.empty() ? index_->forwardingTermStructure() : discountCurve_; - NPV_ = amount_ * discount->discount(valueDate_); } @@ -111,11 +132,9 @@ namespace QuantLib { void ForwardRateAgreement::calculateAmount() const { calculateForwardRate(); Integer sign = fraType_ == Position::Long? 1 : -1; - Rate F = forwardRate_.rate(); Rate K = strikeForwardRate_.rate(); Time T = forwardRate_.dayCounter().yearFraction(valueDate_, maturityDate_); - amount_ = notionalAmount_ * sign * (F - K) * T / (1.0 + F * T); } diff --git a/ql/instruments/forwardrateagreement.hpp b/ql/instruments/forwardrateagreement.hpp index 6b86b1ae04c..c4329d43311 100644 --- a/ql/instruments/forwardrateagreement.hpp +++ b/ql/instruments/forwardrateagreement.hpp @@ -65,6 +65,10 @@ namespace QuantLib { */ class ForwardRateAgreement: public Instrument { public: + /*! \deprecated Use one of the other constructors. + Deprecated in version 1.31. + */ + QL_DEPRECATED ForwardRateAgreement( const Date& valueDate, const Date& maturityDate, @@ -72,15 +76,47 @@ namespace QuantLib { Rate strikeForwardRate, Real notionalAmount, const ext::shared_ptr& index, - Handle discountCurve = Handle(), + Handle discountCurve = {}, bool useIndexedCoupon = true); + + /*! \deprecated Use one of the other constructors. + Deprecated in version 1.31. + */ + QL_DEPRECATED + ForwardRateAgreement( + const Date& valueDate, + Position::Type type, + Rate strikeForwardRate, + Real notionalAmount, + const ext::shared_ptr& index, + Handle discountCurve = {}); + + /*! When using this constructor, the forward rate will be + forecast by the passed index. This corresponds to + useIndexedCoupon=true in the FraRateHelper class. + */ ForwardRateAgreement( + const ext::shared_ptr& index, const Date& valueDate, Position::Type type, Rate strikeForwardRate, Real notionalAmount, + Handle discountCurve = {}); + + /*! When using this constructor, a par-rate approximation will + be used, i.e., the forward rate will be forecast from + value date to maturity date by the forecast curve + contained in the index. This corresponds to + useIndexedCoupon=false in the FraRateHelper class. + */ + ForwardRateAgreement( const ext::shared_ptr& index, - Handle discountCurve = Handle()); + const Date& valueDate, + const Date& maturityDate, + Position::Type type, + Rate strikeForwardRate, + Real notionalAmount, + Handle discountCurve = {}); //! \name Calculations //@{ @@ -129,7 +165,6 @@ namespace QuantLib { mutable Real amount_; }; - inline const Calendar& ForwardRateAgreement::calendar() const { return calendar_; } inline BusinessDayConvention ForwardRateAgreement::businessDayConvention() const { diff --git a/ql/instruments/makecds.hpp b/ql/instruments/makecds.hpp index ee4e2b6e3cb..9e3a98f2e75 100644 --- a/ql/instruments/makecds.hpp +++ b/ql/instruments/makecds.hpp @@ -26,7 +26,7 @@ #define quantlib_makecds_hpp #include -#include +#include namespace QuantLib { @@ -58,8 +58,8 @@ namespace QuantLib { private: Protection::Side side_; Real nominal_; - boost::optional tenor_; - boost::optional termDate_; + ext::optional tenor_; + ext::optional termDate_; Period couponTenor_; Real couponRate_; Real upfrontRate_; diff --git a/ql/instruments/makeswaption.cpp b/ql/instruments/makeswaption.cpp index 45fbf1a06df..bbbe3736267 100644 --- a/ql/instruments/makeswaption.cpp +++ b/ql/instruments/makeswaption.cpp @@ -24,6 +24,7 @@ #include #include #include +#include #include #include @@ -145,7 +146,7 @@ namespace QuantLib { return *this; } - MakeSwaption& MakeSwaption::withIndexedCoupons(const boost::optional& b) { + MakeSwaption& MakeSwaption::withIndexedCoupons(const ext::optional& b) { useIndexedCoupons_ = b; return *this; } diff --git a/ql/instruments/makeswaption.hpp b/ql/instruments/makeswaption.hpp index 4fa1ec26ae5..08802daf7df 100644 --- a/ql/instruments/makeswaption.hpp +++ b/ql/instruments/makeswaption.hpp @@ -27,6 +27,7 @@ #include #include +#include namespace QuantLib { @@ -60,7 +61,7 @@ namespace QuantLib { MakeSwaption& withOptionConvention(BusinessDayConvention bdc); MakeSwaption& withExerciseDate(const Date&); MakeSwaption& withUnderlyingType(Swap::Type type); - MakeSwaption& withIndexedCoupons(const boost::optional& b = true); + MakeSwaption& withIndexedCoupons(const ext::optional& b = true); MakeSwaption& withAtParCoupons(bool b = true); MakeSwaption& withPricingEngine( @@ -80,7 +81,7 @@ namespace QuantLib { Rate strike_; Swap::Type underlyingType_; Real nominal_; - boost::optional useIndexedCoupons_; + ext::optional useIndexedCoupons_; ext::shared_ptr engine_; }; diff --git a/ql/instruments/makevanillaswap.cpp b/ql/instruments/makevanillaswap.cpp index 6efd9eedcf8..ed8e43accec 100644 --- a/ql/instruments/makevanillaswap.cpp +++ b/ql/instruments/makevanillaswap.cpp @@ -33,6 +33,7 @@ #include #include #include +#include namespace QuantLib { @@ -152,7 +153,7 @@ namespace QuantLib { VanillaSwap temp(type_, 100.00, fixedSchedule, 0.0, // fixed rate fixedDayCount, floatSchedule, iborIndex_, floatSpread_, floatDayCount_, - boost::none, useIndexedCoupons_); + ext::nullopt, useIndexedCoupons_); if (engine_ == nullptr) { Handle disc = iborIndex_->forwardingTermStructure(); @@ -171,7 +172,7 @@ namespace QuantLib { ext::shared_ptr swap(new VanillaSwap( type_, nominal_, fixedSchedule, usedFixedRate, fixedDayCount, floatSchedule, iborIndex_, - floatSpread_, floatDayCount_, boost::none, useIndexedCoupons_)); + floatSpread_, floatDayCount_, ext::nullopt, useIndexedCoupons_)); if (engine_ == nullptr) { Handle disc = @@ -346,7 +347,7 @@ namespace QuantLib { return *this; } - MakeVanillaSwap& MakeVanillaSwap::withIndexedCoupons(const boost::optional& b) { + MakeVanillaSwap& MakeVanillaSwap::withIndexedCoupons(const ext::optional& b) { useIndexedCoupons_ = b; return *this; } diff --git a/ql/instruments/makevanillaswap.hpp b/ql/instruments/makevanillaswap.hpp index c1466cd3588..dfa04bd4108 100644 --- a/ql/instruments/makevanillaswap.hpp +++ b/ql/instruments/makevanillaswap.hpp @@ -82,7 +82,7 @@ namespace QuantLib { const Handle& discountCurve); MakeVanillaSwap& withPricingEngine( const ext::shared_ptr& engine); - MakeVanillaSwap& withIndexedCoupons(const boost::optional& b = true); + MakeVanillaSwap& withIndexedCoupons(const ext::optional& b = true); MakeVanillaSwap& withAtParCoupons(bool b = true); private: Period swapTenor_; @@ -107,7 +107,7 @@ namespace QuantLib { Date floatFirstDate_, floatNextToLastDate_; Spread floatSpread_ = 0.0; DayCounter fixedDayCount_, floatDayCount_; - boost::optional useIndexedCoupons_; + ext::optional useIndexedCoupons_; ext::shared_ptr engine_; }; diff --git a/ql/instruments/nonstandardswap.cpp b/ql/instruments/nonstandardswap.cpp index efd9db61b43..bf7f7cfd237 100644 --- a/ql/instruments/nonstandardswap.cpp +++ b/ql/instruments/nonstandardswap.cpp @@ -28,6 +28,7 @@ #include #include #include +#include #include namespace QuantLib { @@ -67,7 +68,7 @@ namespace QuantLib { DayCounter floatingDayCount, const bool intermediateCapitalExchange, const bool finalCapitalExchange, - boost::optional paymentConvention) + ext::optional paymentConvention) : Swap(2), type_(type), fixedNominal_(std::move(fixedNominal)), floatingNominal_(floatingNominal), fixedSchedule_(std::move(fixedSchedule)), fixedRate_(std::move(fixedRate)), fixedDayCount_(std::move(fixedDayCount)), @@ -98,7 +99,7 @@ namespace QuantLib { DayCounter floatingDayCount, const bool intermediateCapitalExchange, const bool finalCapitalExchange, - boost::optional paymentConvention) + ext::optional paymentConvention) : Swap(2), type_(type), fixedNominal_(std::move(fixedNominal)), floatingNominal_(std::move(floatingNominal)), fixedSchedule_(std::move(fixedSchedule)), fixedRate_(std::move(fixedRate)), fixedDayCount_(std::move(fixedDayCount)), diff --git a/ql/instruments/nonstandardswap.hpp b/ql/instruments/nonstandardswap.hpp index 4146b073c52..e2ac0ac0dae 100644 --- a/ql/instruments/nonstandardswap.hpp +++ b/ql/instruments/nonstandardswap.hpp @@ -28,7 +28,7 @@ #include #include #include -#include +#include namespace QuantLib { @@ -56,7 +56,7 @@ namespace QuantLib { DayCounter floatingDayCount, bool intermediateCapitalExchange = false, bool finalCapitalExchange = false, - boost::optional paymentConvention = boost::none); + ext::optional paymentConvention = ext::nullopt); NonstandardSwap(Swap::Type type, std::vector fixedNominal, std::vector floatingNominal, @@ -70,7 +70,7 @@ namespace QuantLib { DayCounter floatingDayCount, bool intermediateCapitalExchange = false, bool finalCapitalExchange = false, - boost::optional paymentConvention = boost::none); + ext::optional paymentConvention = ext::nullopt); //! \name Inspectors //@{ Swap::Type type() const; diff --git a/ql/instruments/nonstandardswaption.cpp b/ql/instruments/nonstandardswaption.cpp index b9ca5ec0202..e0dc77b4343 100644 --- a/ql/instruments/nonstandardswaption.cpp +++ b/ql/instruments/nonstandardswaption.cpp @@ -32,6 +32,15 @@ namespace QuantLib { settlementMethod_(fromSwaption.settlementMethod()) { registerWith(swap_); + // When we ask for the NPV of an expired swaption, the + // swap is not recalculated and thus wouldn't forward + // later notifications according to the default behavior of + // LazyObject instances. This means that even if the + // evaluation date changes so that the swaption is no longer + // expired, the instrument wouldn't be notified and thus it + // wouldn't recalculate. To avoid this, we override the + // default behavior of the underlying swap. + swap_->alwaysForwardNotifications(); } NonstandardSwaption::NonstandardSwaption(ext::shared_ptr swap, @@ -41,7 +50,7 @@ namespace QuantLib { : Option(ext::shared_ptr(), exercise), swap_(std::move(swap)), settlementType_(delivery), settlementMethod_(settlementMethod) { registerWith(swap_); - registerWithObservables(swap_); + swap_->alwaysForwardNotifications(); } bool NonstandardSwaption::isExpired() const { diff --git a/ql/instruments/overnightindexedswap.cpp b/ql/instruments/overnightindexedswap.cpp index 406d87c1c8c..b4bf682b2bd 100644 --- a/ql/instruments/overnightindexedswap.cpp +++ b/ql/instruments/overnightindexedswap.cpp @@ -37,17 +37,20 @@ namespace QuantLib { Natural paymentLag, BusinessDayConvention paymentAdjustment, const Calendar& paymentCalendar, - bool telescopicValueDates, + bool telescopicValueDates, RateAveraging::Type averagingMethod) - : Swap(2), type_(type), nominals_(std::vector(1, nominal)), - paymentFrequency_(schedule.tenor().frequency()), - paymentCalendar_(paymentCalendar.empty() ? schedule.calendar() : paymentCalendar), - paymentAdjustment_(paymentAdjustment), paymentLag_(paymentLag), fixedRate_(fixedRate), - fixedDC_(std::move(fixedDC)), overnightIndex_(std::move(overnightIndex)), spread_(spread), - telescopicValueDates_(telescopicValueDates), averagingMethod_(averagingMethod) { - - initialize(schedule); - } + : OvernightIndexedSwap(type, + std::vector(1, nominal), + schedule, + fixedRate, + std::move(fixedDC), + std::move(overnightIndex), + spread, + paymentLag, + paymentAdjustment, + paymentCalendar, + telescopicValueDates, + averagingMethod) {} OvernightIndexedSwap::OvernightIndexedSwap(Type type, std::vector nominals, @@ -59,66 +62,116 @@ namespace QuantLib { Natural paymentLag, BusinessDayConvention paymentAdjustment, const Calendar& paymentCalendar, - bool telescopicValueDates, + bool telescopicValueDates, RateAveraging::Type averagingMethod) - : Swap(2), type_(type), nominals_(std::move(nominals)), - paymentFrequency_(schedule.tenor().frequency()), - paymentCalendar_(paymentCalendar.empty() ? schedule.calendar() : paymentCalendar), - paymentAdjustment_(paymentAdjustment), paymentLag_(paymentLag), fixedRate_(fixedRate), - fixedDC_(std::move(fixedDC)), overnightIndex_(std::move(overnightIndex)), spread_(spread), - telescopicValueDates_(telescopicValueDates), averagingMethod_(averagingMethod) { + : OvernightIndexedSwap(type, + std::move(nominals), + schedule, + fixedRate, + std::move(fixedDC), + schedule, + std::move(overnightIndex), + spread, + paymentLag, + paymentAdjustment, + paymentCalendar, + telescopicValueDates, + averagingMethod) {} - initialize(schedule); - } + OvernightIndexedSwap::OvernightIndexedSwap(Type type, + Real nominal, + const Schedule& fixedSchedule, + Rate fixedRate, + DayCounter fixedDC, + const Schedule& overnightSchedule, + ext::shared_ptr overnightIndex, + Spread spread, + Natural paymentLag, + BusinessDayConvention paymentAdjustment, + const Calendar& paymentCalendar, + bool telescopicValueDates, + RateAveraging::Type averagingMethod) + : OvernightIndexedSwap(type, + std::vector(1, nominal), + fixedSchedule, + fixedRate, + std::move(fixedDC), + overnightSchedule, + std::move(overnightIndex), + spread, + paymentLag, + paymentAdjustment, + paymentCalendar, + telescopicValueDates, + averagingMethod) {} - void OvernightIndexedSwap::initialize(const Schedule& schedule) { - if (fixedDC_==DayCounter()) + OvernightIndexedSwap::OvernightIndexedSwap(Type type, + std::vector nominals, + Schedule fixedSchedule, + Rate fixedRate, + DayCounter fixedDC, + Schedule overnightSchedule, + ext::shared_ptr overnightIndex, + Spread spread, + Natural paymentLag, + BusinessDayConvention paymentAdjustment, + const Calendar& paymentCalendar, + bool telescopicValueDates, + RateAveraging::Type averagingMethod) + : Swap(2), type_(type), nominals_(std::move(nominals)), + fixedSchedule_(std::move(fixedSchedule)), fixedRate_(fixedRate), fixedDC_(std::move(fixedDC)), + overnightSchedule_(std::move(overnightSchedule)), overnightIndex_(std::move(overnightIndex)), + spread_(spread), averagingMethod_(averagingMethod) { + if (fixedDC_ == DayCounter()) fixedDC_ = overnightIndex_->dayCounter(); - legs_[0] = FixedRateLeg(schedule) - .withNotionals(nominals_) - .withCouponRates(fixedRate_, fixedDC_) - .withPaymentLag(paymentLag_) - .withPaymentAdjustment(paymentAdjustment_) - .withPaymentCalendar(paymentCalendar_); - - legs_[1] = OvernightLeg(schedule, overnightIndex_) - .withNotionals(nominals_) - .withSpreads(spread_) - .withTelescopicValueDates(telescopicValueDates_) - .withPaymentLag(paymentLag_) - .withPaymentAdjustment(paymentAdjustment_) - .withPaymentCalendar(paymentCalendar_) - .withAveragingMethod(averagingMethod_); - - for (Size j=0; j<2; ++j) { + legs_[0] = FixedRateLeg(fixedSchedule_) + .withNotionals(nominals_) + .withCouponRates(fixedRate_, fixedDC_) + .withPaymentLag(paymentLag) + .withPaymentAdjustment(paymentAdjustment) + .withPaymentCalendar(paymentCalendar.empty() ? fixedSchedule_.calendar() : + paymentCalendar); + + legs_[1] = + OvernightLeg(overnightSchedule_, overnightIndex_) + .withNotionals(nominals_) + .withSpreads(spread_) + .withTelescopicValueDates(telescopicValueDates) + .withPaymentLag(paymentLag) + .withPaymentAdjustment(paymentAdjustment) + .withPaymentCalendar(paymentCalendar.empty() ? overnightSchedule_.calendar() : + paymentCalendar) + .withAveragingMethod(averagingMethod_); + + for (Size j = 0; j < 2; ++j) { for (auto& i : legs_[j]) registerWith(i); } switch (type_) { - case Payer: - payer_[0] = -1.0; - payer_[1] = +1.0; - break; - case Receiver: - payer_[0] = +1.0; - payer_[1] = -1.0; - break; - default: - QL_FAIL("Unknown overnight-swap type"); + case Payer: + payer_[0] = -1.0; + payer_[1] = +1.0; + break; + case Receiver: + payer_[0] = +1.0; + payer_[1] = -1.0; + break; + default: + QL_FAIL("Unknown overnight-swap type"); } } Real OvernightIndexedSwap::fairRate() const { static Spread basisPoint = 1.0e-4; calculate(); - return fixedRate_ - NPV_/(fixedLegBPS()/basisPoint); + return fixedRate_ - NPV_ / (fixedLegBPS() / basisPoint); } Spread OvernightIndexedSwap::fairSpread() const { static Spread basisPoint = 1.0e-4; calculate(); - return spread_ - NPV_/(overnightLegBPS()/basisPoint); + return spread_ - NPV_ / (overnightLegBPS() / basisPoint); } Real OvernightIndexedSwap::fixedLegBPS() const { diff --git a/ql/instruments/overnightindexedswap.hpp b/ql/instruments/overnightindexedswap.hpp index a72ad3f50e2..d38c72d5cd3 100644 --- a/ql/instruments/overnightindexedswap.hpp +++ b/ql/instruments/overnightindexedswap.hpp @@ -27,11 +27,12 @@ #ifndef quantlib_overnight_indexed_swap_hpp #define quantlib_overnight_indexed_swap_hpp -#include #include -#include +#include #include #include +#include +#include namespace QuantLib { @@ -67,17 +68,50 @@ namespace QuantLib { bool telescopicValueDates = false, RateAveraging::Type averagingMethod = RateAveraging::Compound); + OvernightIndexedSwap(Type type, + Real nominal, + const Schedule& fixedSchedule, + Rate fixedRate, + DayCounter fixedDC, + const Schedule& overnightSchedule, + ext::shared_ptr overnightIndex, + Spread spread = 0.0, + Natural paymentLag = 0, + BusinessDayConvention paymentAdjustment = Following, + const Calendar& paymentCalendar = Calendar(), + bool telescopicValueDates = false, + RateAveraging::Type averagingMethod = RateAveraging::Compound); + + OvernightIndexedSwap(Type type, + std::vector nominals, + Schedule fixedSchedule, + Rate fixedRate, + DayCounter fixedDC, + Schedule overnightSchedule, + ext::shared_ptr overnightIndex, + Spread spread = 0.0, + Natural paymentLag = 0, + BusinessDayConvention paymentAdjustment = Following, + const Calendar& paymentCalendar = Calendar(), + bool telescopicValueDates = false, + RateAveraging::Type averagingMethod = RateAveraging::Compound); + //! \name Inspectors //@{ Type type() const { return type_; } Real nominal() const; std::vector nominals() const { return nominals_; } - Frequency paymentFrequency() const { return paymentFrequency_; } + Frequency paymentFrequency() const { + return std::max(fixedSchedule_.tenor().frequency(), + overnightSchedule_.tenor().frequency()); + } + const Schedule& fixedSchedule() const { return fixedSchedule_; } Rate fixedRate() const { return fixedRate_; } const DayCounter& fixedDayCount() const { return fixedDC_; } + const Schedule& overnightSchedule() const { return overnightSchedule_; } const ext::shared_ptr& overnightIndex() const { return overnightIndex_; } Spread spread() const { return spread_; } @@ -98,23 +132,16 @@ namespace QuantLib { Spread fairSpread() const; //@} private: - void initialize(const Schedule& schedule); Type type_; std::vector nominals_; - Frequency paymentFrequency_; - Calendar paymentCalendar_; - BusinessDayConvention paymentAdjustment_; - Natural paymentLag_; - - //Schedule schedule_; - + Schedule fixedSchedule_; Rate fixedRate_; DayCounter fixedDC_; + Schedule overnightSchedule_; ext::shared_ptr overnightIndex_; Spread spread_; - bool telescopicValueDates_; RateAveraging::Type averagingMethod_; }; @@ -122,7 +149,7 @@ namespace QuantLib { // inline inline Real OvernightIndexedSwap::nominal() const { - QL_REQUIRE(nominals_.size()==1, "varying nominals"); + QL_REQUIRE(nominals_.size() == 1, "varying nominals"); return nominals_[0]; } diff --git a/ql/instruments/swap.cpp b/ql/instruments/swap.cpp index 0116830ae96..e9e299f766f 100644 --- a/ql/instruments/swap.cpp +++ b/ql/instruments/swap.cpp @@ -65,7 +65,6 @@ namespace QuantLib { startDiscounts_(legs, 0.0), endDiscounts_(legs, 0.0), npvDateDiscount_(0.0) {} - bool Swap::isExpired() const { for (const auto& leg : legs_) { Leg::const_iterator i; @@ -161,9 +160,8 @@ namespace QuantLib { void Swap::deepUpdate() { for (auto& leg : legs_) { for (auto& k : leg) { - ext::shared_ptr f = ext::dynamic_pointer_cast(k); - if (f != nullptr) - f->update(); + if (auto lazy = ext::dynamic_pointer_cast(k)) + lazy->deepUpdate(); } } update(); diff --git a/ql/instruments/swaption.cpp b/ql/instruments/swaption.cpp index e8b8fbe6586..2e41c685df6 100644 --- a/ql/instruments/swaption.cpp +++ b/ql/instruments/swaption.cpp @@ -22,6 +22,7 @@ FOR A PARTICULAR PURPOSE. See the license for more details. */ +#include #include #include #include @@ -98,7 +99,7 @@ namespace QuantLib { auto vega_ = results_->additionalResults.find("vega"); QL_REQUIRE(vega_ != results_->additionalResults.end(), "vega not provided"); - return boost::any_cast(vega_->second); + return ext::any_cast(vega_->second); } } @@ -136,7 +137,20 @@ namespace QuantLib { : Option(ext::shared_ptr(), exercise), swap_(std::move(swap)), settlementType_(delivery), settlementMethod_(settlementMethod) { registerWith(swap_); - registerWithObservables(swap_); + // When we ask for the NPV of an expired swaption, the + // swap is not recalculated and thus wouldn't forward + // later notifications according to the default behavior of + // LazyObject instances. This means that even if the + // evaluation date changes so that the swaption is no longer + // expired, the instrument wouldn't be notified and thus it + // wouldn't recalculate. To avoid this, we override the + // default behavior of the underlying swap. + swap_->alwaysForwardNotifications(); + } + + void Swaption::deepUpdate() { + swap_->deepUpdate(); + update(); } bool Swaption::isExpired() const { diff --git a/ql/instruments/swaption.hpp b/ql/instruments/swaption.hpp index 4c5fd4e42d4..adf9478fca9 100644 --- a/ql/instruments/swaption.hpp +++ b/ql/instruments/swaption.hpp @@ -86,6 +86,10 @@ namespace QuantLib { const ext::shared_ptr& exercise, Settlement::Type delivery = Settlement::Physical, Settlement::Method settlementMethod = Settlement::PhysicalOTC); + //! \name Observer interface + //@{ + void deepUpdate() override; + //@} //! \name Instrument interface //@{ bool isExpired() const override; diff --git a/ql/instruments/vanillaswap.cpp b/ql/instruments/vanillaswap.cpp index e7bcbc4fd11..ff1489b8224 100644 --- a/ql/instruments/vanillaswap.cpp +++ b/ql/instruments/vanillaswap.cpp @@ -27,6 +27,7 @@ #include #include #include +#include #include namespace QuantLib { @@ -40,8 +41,8 @@ namespace QuantLib { ext::shared_ptr iborIndex, Spread spread, DayCounter floatingDayCount, - boost::optional paymentConvention, - boost::optional useIndexedCoupons) + ext::optional paymentConvention, + ext::optional useIndexedCoupons) : Swap(2), type_(type), nominal_(nominal), fixedSchedule_(std::move(fixedSchedule)), fixedRate_(fixedRate), fixedDayCount_(std::move(fixedDayCount)), floatingSchedule_(std::move(floatSchedule)), iborIndex_(std::move(iborIndex)), diff --git a/ql/instruments/vanillaswap.hpp b/ql/instruments/vanillaswap.hpp index 60fdf947aeb..3515da552a1 100644 --- a/ql/instruments/vanillaswap.hpp +++ b/ql/instruments/vanillaswap.hpp @@ -29,7 +29,7 @@ #include #include #include -#include +#include namespace QuantLib { @@ -76,8 +76,8 @@ namespace QuantLib { ext::shared_ptr iborIndex, Spread spread, DayCounter floatingDayCount, - boost::optional paymentConvention = boost::none, - boost::optional useIndexedCoupons = boost::none); + ext::optional paymentConvention = ext::nullopt, + ext::optional useIndexedCoupons = ext::nullopt); //! \name Inspectors //@{ Type type() const; diff --git a/ql/legacy/libormarketmodels/lfmcovarproxy.cpp b/ql/legacy/libormarketmodels/lfmcovarproxy.cpp index d3b01af208a..1d573dc313e 100644 --- a/ql/legacy/libormarketmodels/lfmcovarproxy.cpp +++ b/ql/legacy/libormarketmodels/lfmcovarproxy.cpp @@ -51,7 +51,7 @@ namespace QuantLib { for (Size i=0; i Real { return x * vol[i]; }); } return pca; diff --git a/ql/math/Makefile.am b/ql/math/Makefile.am index b55899427c8..f7c8778f873 100644 --- a/ql/math/Makefile.am +++ b/ql/math/Makefile.am @@ -23,7 +23,6 @@ this_include_HEADERS = \ generallinearleastsquares.hpp \ kernelfunctions.hpp \ incompletegamma.hpp \ - initializers.hpp \ interpolation.hpp \ lexicographicalview.hpp \ linearleastsquaresregression.hpp \ @@ -93,7 +92,7 @@ all.hpp: Makefile.am echo "/* This file is automatically generated; do not edit. */" > ${srcdir}/$@ echo "/* Add the files to be included into Makefile.am instead. */" >> ${srcdir}/$@ echo >> ${srcdir}/$@ - for i in $(filter-out all.hpp initializers.hpp, $(this_include_HEADERS)); do \ + for i in $(filter-out all.hpp curve.hpp lexicographicalview.hpp, $(this_include_HEADERS)); do \ echo "#include <${subdir}/$$i>" >> ${srcdir}/$@; \ done echo >> ${srcdir}/$@ diff --git a/ql/math/all.hpp b/ql/math/all.hpp index be17d090c8b..e724b24b3ce 100644 --- a/ql/math/all.hpp +++ b/ql/math/all.hpp @@ -8,7 +8,6 @@ #include #include #include -#include #include #include #include @@ -17,7 +16,6 @@ #include #include #include -#include #include #include #include diff --git a/ql/math/array.hpp b/ql/math/array.hpp index c969c343f24..7d0df626c0f 100644 --- a/ql/math/array.hpp +++ b/ql/math/array.hpp @@ -29,8 +29,7 @@ #include #include #include -#include -#include +#include #include #include #include @@ -38,6 +37,7 @@ #include #include #include +#include namespace QuantLib { @@ -69,6 +69,7 @@ namespace QuantLib { //! creates the array from an iterable sequence template Array(ForwardIterator begin, ForwardIterator end); + ~Array() = default; Array& operator=(const Array&); Array& operator=(Array&&) noexcept; @@ -121,8 +122,8 @@ namespace QuantLib { typedef Real value_type; typedef Real* iterator; typedef const Real* const_iterator; - typedef boost::reverse_iterator reverse_iterator; - typedef boost::reverse_iterator const_reverse_iterator; + typedef std::reverse_iterator reverse_iterator; + typedef std::reverse_iterator const_reverse_iterator; //! \name Iterator access //@{ const_iterator begin() const; @@ -137,7 +138,7 @@ namespace QuantLib { //! \name Utilities //@{ void resize(Size n); - void swap(Array&); // never throws + void swap(Array&) noexcept; //@} private: @@ -271,7 +272,7 @@ namespace QuantLib { // utilities /*! \relates Array */ - void swap(Array&, Array&); + void swap(Array&, Array&) noexcept; // format /*! \relates Array */ @@ -312,7 +313,7 @@ namespace QuantLib { std::unique_ptr& data_, Size& n_, I begin, I end, - const boost::true_type&) { + const std::true_type&) { // we got redirected here from a call like Array(3, 4) // because it matched the constructor below exactly with // ForwardIterator = int. What we wanted was fill an @@ -329,7 +330,7 @@ namespace QuantLib { std::unique_ptr& data_, Size& n_, I begin, I end, - const boost::false_type&) { + const std::false_type&) { // true iterators Size n = std::distance(begin, end); data_.reset(n ? new Real[n] : (Real*)nullptr); @@ -344,7 +345,7 @@ namespace QuantLib { inline Array::Array(std::initializer_list init) { detail::_fill_array_(*this, data_, n_, init.begin(), init.end(), - boost::false_type()); + std::false_type()); } template @@ -352,7 +353,7 @@ namespace QuantLib { // Unfortunately, calls such as Array(3, 4) match this constructor. // We have to detect integral types and dispatch. detail::_fill_array_(*this, data_, n_, begin, end, - boost::is_integral()); + std::is_integral()); } inline Array& Array::operator=(const Array& from) { @@ -542,10 +543,9 @@ namespace QuantLib { } } - inline void Array::swap(Array& from) { - using std::swap; + inline void Array::swap(Array& from) noexcept { data_.swap(from.data_); - swap(n_,from.n_); + std::swap(n_, from.n_); } // dot product and norm @@ -615,7 +615,7 @@ namespace QuantLib { return result; } - inline Array operator+(Array&& v1, Array&& v2) { + inline Array operator+(Array&& v1, Array&& v2) { // NOLINT(cppcoreguidelines-rvalue-reference-param-not-moved) QL_REQUIRE(v1.size() == v2.size(), "arrays with different sizes (" << v1.size() << ", " << v2.size() << ") cannot be added"); @@ -675,7 +675,7 @@ namespace QuantLib { return result; } - inline Array operator-(Array&& v1, Array&& v2) { + inline Array operator-(Array&& v1, Array&& v2) { // NOLINT(cppcoreguidelines-rvalue-reference-param-not-moved) QL_REQUIRE(v1.size() == v2.size(), "arrays with different sizes (" << v1.size() << ", " << v2.size() << ") cannot be subtracted"); @@ -735,7 +735,7 @@ namespace QuantLib { return result; } - inline Array operator*(Array&& v1, Array&& v2) { + inline Array operator*(Array&& v1, Array&& v2) { // NOLINT(cppcoreguidelines-rvalue-reference-param-not-moved) QL_REQUIRE(v1.size() == v2.size(), "arrays with different sizes (" << v1.size() << ", " << v2.size() << ") cannot be multiplied"); @@ -795,7 +795,7 @@ namespace QuantLib { return result; } - inline Array operator/(Array&& v1, Array&& v2) { + inline Array operator/(Array&& v1, Array&& v2) { // NOLINT(cppcoreguidelines-rvalue-reference-param-not-moved) QL_REQUIRE(v1.size() == v2.size(), "arrays with different sizes (" << v1.size() << ", " << v2.size() << ") cannot be divided"); @@ -900,7 +900,7 @@ namespace QuantLib { return result; } - inline void swap(Array& v, Array& w) { + inline void swap(Array& v, Array& w) noexcept { v.swap(w); } diff --git a/ql/math/curve.hpp b/ql/math/curve.hpp index bec736d145f..c1214daa896 100644 --- a/ql/math/curve.hpp +++ b/ql/math/curve.hpp @@ -17,31 +17,5 @@ FOR A PARTICULAR PURPOSE. See the license for more details. */ -/*! \file curve.hpp - \brief Curve -*/ - -#ifndef quantlib_curve_hpp -#define quantlib_curve_hpp - -#include -#include - -namespace QuantLib { - - /*! \deprecated To be removed as unused. - Copy it in your codebase if you need it. - Deprecated in version 1.26. - */ - class QL_DEPRECATED Curve { - public: - typedef Real argument_type; - typedef Real result_type; - virtual ~Curve() = default; - virtual Real operator()(Real x) const = 0; - }; - -} - - -#endif +// Deprecated in version 1.31 +#pragma message("Warning: this file is empty and will disappear in a future release. Do not include it.") diff --git a/ql/math/functional.hpp b/ql/math/functional.hpp index 280073ca7ef..441a95de047 100644 --- a/ql/math/functional.hpp +++ b/ql/math/functional.hpp @@ -33,392 +33,9 @@ namespace QuantLib { // functions - /*! \deprecated Use a lambda instead. - Deprecated in version 1.27. - */ - template - class QL_DEPRECATED constant { - public: - typedef T argument_type; - typedef U result_type; - QL_DEPRECATED_DISABLE_WARNING - explicit constant(const U& u) : u_(u) {} - QL_DEPRECATED_ENABLE_WARNING - U operator()(const T&) const { return u_; } - private: - U u_; - }; - - /*! \deprecated Use a lambda instead. - Deprecated in version 1.27. - */ - template - class QL_DEPRECATED identity { - public: - typedef T argument_type; - typedef T result_type; - T operator()(const T& t) const { return t; } - }; - template inline T squared(T x) { return x * x; } - /*! \deprecated Use squared or a lambda instead. - Deprecated in version 1.27. - */ - template - class QL_DEPRECATED square { - public: - typedef T argument_type; - typedef T result_type; - T operator()(const T& t) const { return t*t; } - }; - - /*! \deprecated Use a lambda instead. - Deprecated in version 1.27. - */ - template - class QL_DEPRECATED cube { - public: - typedef T argument_type; - typedef T result_type; - T operator()(const T& t) const { return t*t*t; } - }; - - /*! \deprecated Use a lambda instead. - Deprecated in version 1.27. - */ - template - class QL_DEPRECATED fourth_power { - public: - typedef T argument_type; - typedef T result_type; - T operator()(const T& t) const { T t2 = t*t; return t2*t2; } - }; - - // a few shortcuts for common binders - - /*! \deprecated Use a lambda instead. - Deprecated in version 1.27. - */ - template - class QL_DEPRECATED add { - T y; - public: - typedef T argument_type; - typedef Real result_type; - QL_DEPRECATED_DISABLE_WARNING - explicit add(Real y) : y(y) {} - QL_DEPRECATED_ENABLE_WARNING - Real operator()(T x) const { return x + y; } - }; - - /*! \deprecated Use a lambda instead. - Deprecated in version 1.27. - */ - template - class QL_DEPRECATED subtract { - T y; - public: - typedef T argument_type; - typedef Real result_type; - QL_DEPRECATED_DISABLE_WARNING - explicit subtract(Real y) : y(y) {} - QL_DEPRECATED_ENABLE_WARNING - Real operator()(T x) const { return x - y; } - }; - - /*! \deprecated Use a lambda instead. - Deprecated in version 1.27. - */ - template - class QL_DEPRECATED subtract_from { - T y; - public: - typedef T argument_type; - typedef Real result_type; - QL_DEPRECATED_DISABLE_WARNING - explicit subtract_from(Real y) : y(y) {} - QL_DEPRECATED_ENABLE_WARNING - Real operator()(T x) const { return y - x; } - }; - - /*! \deprecated Use a lambda instead. - Deprecated in version 1.27. - */ - template - class QL_DEPRECATED multiply_by { - T y; - public: - typedef T argument_type; - typedef Real result_type; - QL_DEPRECATED_DISABLE_WARNING - explicit multiply_by(Real y) : y(y) {} - QL_DEPRECATED_ENABLE_WARNING - Real operator()(T x) const { return x * y; } - }; - - /*! \deprecated Use a lambda instead. - Deprecated in version 1.27. - */ - template - class QL_DEPRECATED divide { - T y; - public: - typedef T argument_type; - typedef Real result_type; - QL_DEPRECATED_DISABLE_WARNING - explicit divide(Real y) : y(y) {} - QL_DEPRECATED_ENABLE_WARNING - Real operator()(T x) const { return y / x; } - }; - - /*! \deprecated Use a lambda instead. - Deprecated in version 1.27. - */ - template - class QL_DEPRECATED divide_by { - T y; - public: - typedef T argument_type; - typedef Real result_type; - QL_DEPRECATED_DISABLE_WARNING - explicit divide_by(Real y) : y(y) {} - QL_DEPRECATED_ENABLE_WARNING - Real operator()(T x) const { return x / y; } - }; - - /*! \deprecated Use a lambda instead. - Deprecated in version 1.27. - */ - template - class QL_DEPRECATED less_than { - T y; - public: - typedef T argument_type; - typedef bool result_type; - QL_DEPRECATED_DISABLE_WARNING - explicit less_than(Real y) : y(y) {} - QL_DEPRECATED_ENABLE_WARNING - bool operator()(T x) const { return x < y; } - }; - - /*! \deprecated Use a lambda instead. - Deprecated in version 1.27. - */ - template - class QL_DEPRECATED greater_than { - T y; - public: - typedef T argument_type; - typedef bool result_type; - QL_DEPRECATED_DISABLE_WARNING - explicit greater_than(Real y) : y(y) {} - QL_DEPRECATED_ENABLE_WARNING - bool operator()(T x) const { return x > y; } - }; - - /*! \deprecated Use a lambda instead. - Deprecated in version 1.27. - */ - template - class QL_DEPRECATED greater_or_equal_to { - T y; - public: - typedef T argument_type; - typedef bool result_type; - QL_DEPRECATED_DISABLE_WARNING - explicit greater_or_equal_to(Real y) : y(y) {} - QL_DEPRECATED_ENABLE_WARNING - bool operator()(T x) const { return x >= y; } - }; - - /*! \deprecated Use a lambda instead. - Deprecated in version 1.27. - */ - template - class QL_DEPRECATED not_zero { - public: - typedef T argument_type; - typedef bool result_type; - bool operator()(T x) const { return x != T(); } - }; - - /*! \deprecated Use a lambda instead. - Deprecated in version 1.27. - */ - template - class QL_DEPRECATED not_null { - T null; - public: - typedef T argument_type; - typedef bool result_type; - QL_DEPRECATED_DISABLE_WARNING - not_null() : null(Null()) {} - QL_DEPRECATED_ENABLE_WARNING - bool operator()(T x) const { return x != null; } - }; - - // predicates - - /*! \deprecated Use a lambda instead. - Deprecated in version 1.27. - */ - class QL_DEPRECATED everywhere { - public: - typedef Real argument_type; - typedef bool result_type; - bool operator()(Real) const { return true; } - }; - - /*! \deprecated Use a lambda instead. - Deprecated in version 1.27. - */ - class QL_DEPRECATED nowhere { - public: - typedef Real argument_type; - typedef bool result_type; - bool operator()(Real) const { return false; } - }; - - /*! \deprecated Use a lambda instead. - Deprecated in version 1.27. - */ - template - class QL_DEPRECATED equal_within { - public: - typedef T first_argument_type; - typedef T second_argument_type; - typedef bool result_type; - QL_DEPRECATED_DISABLE_WARNING - explicit equal_within(const T& eps) : eps_(eps) {} - QL_DEPRECATED_ENABLE_WARNING - bool operator()(const T& a, const T& b) const { - return std::fabs(a-b) <= eps_; - } - private: - const T eps_; - }; - - // combinators - - /*! \deprecated Use a lambda instead. - Deprecated in version 1.27. - */ - template - class QL_DEPRECATED clipped_function { - public: - typedef typename F::argument_type argument_type; - typedef typename F::result_type result_type; - QL_DEPRECATED_DISABLE_WARNING - clipped_function(const F& f, const R& r) : f_(f), r_(r) {} - QL_DEPRECATED_ENABLE_WARNING - result_type operator()(const argument_type& x) const { - return r_(x) ? f_(x) : result_type(); - } - private: - F f_; - R r_; - }; - - /*! \deprecated Use a lambda instead. - Deprecated in version 1.27. - */ -#if __cplusplus >= 201402L || _MSVC_LANG >= 201402L - template - QL_DEPRECATED - auto clip(F&& f, R&& r) { - return [f_ = std::forward(f), r_ = std::forward(r)](const auto& x) { return r_(x) ? f_(x) : decltype(f_(x)){}; }; - } -#else - QL_DEPRECATED_DISABLE_WARNING - template - QL_DEPRECATED - clipped_function clip(const F& f, const R& r) { - return clipped_function(f,r); - } - QL_DEPRECATED_ENABLE_WARNING -#endif - - /*! \deprecated Use a lambda instead. - Deprecated in version 1.27. - */ - template - class QL_DEPRECATED composed_function { - public: - typedef typename G::argument_type argument_type; - typedef typename F::result_type result_type; - QL_DEPRECATED_DISABLE_WARNING - composed_function(const F& f, G g) : f_(f), g_(std::move(g)) {} - QL_DEPRECATED_ENABLE_WARNING - result_type operator()(const argument_type& x) const { - return f_(g_(x)); - } - private: - F f_; - G g_; - }; - - /*! \deprecated Use a lambda instead. - Deprecated in version 1.27. - */ -#if __cplusplus >= 201402L || _MSVC_LANG >= 201402L - template - QL_DEPRECATED - auto compose(F&& f, G&& g) { - return [f_ = std::forward(f), g_ = std::forward(g)](const auto& x) { return f_(g_(x)); }; - } -#else - QL_DEPRECATED_DISABLE_WARNING - template - QL_DEPRECATED - composed_function compose(const F& f, const G& g) { - return composed_function(f,g); - } - QL_DEPRECATED_ENABLE_WARNING -#endif - - /*! \deprecated Use a lambda instead. - Deprecated in version 1.27. - */ - template - class QL_DEPRECATED binary_compose3_function { - public: - typedef typename G::argument_type first_argument_type; - typedef typename H::argument_type second_argument_type; - typedef typename F::result_type result_type; - QL_DEPRECATED_DISABLE_WARNING - binary_compose3_function(const F& f, const G& g, const H& h) - : f_(f), g_(g), h_(h) {} - QL_DEPRECATED_ENABLE_WARNING - result_type operator()(const first_argument_type& x, - const second_argument_type& y) const { - return f_(g_(x), h_(y)); - } - private: - F f_; - G g_; - H h_; - }; - - /*! \deprecated Use a lambda instead. - Deprecated in version 1.27. - */ -#if __cplusplus >= 201402L || _MSVC_LANG >= 201402L - template - QL_DEPRECATED - auto compose3(F&& f, G&& g, H&& h) { - return [f_ = std::forward(f), g_ = std::forward(g), h_ = std::forward(h)](const auto& x, const auto& y) { return f_(g_(x), h_(y)); }; - } -#else - QL_DEPRECATED_DISABLE_WARNING - template binary_compose3_function - QL_DEPRECATED - compose3(const F& f, const G& g, const H& h) { - return binary_compose3_function(f, g, h); - } - QL_DEPRECATED_ENABLE_WARNING -#endif } diff --git a/ql/math/generallinearleastsquares.hpp b/ql/math/generallinearleastsquares.hpp index 4b325c79c69..48586f4f50f 100644 --- a/ql/math/generallinearleastsquares.hpp +++ b/ql/math/generallinearleastsquares.hpp @@ -30,7 +30,6 @@ #include #include #include -#include #include namespace QuantLib { diff --git a/ql/math/interpolations/abcdinterpolation.hpp b/ql/math/interpolations/abcdinterpolation.hpp index 6bce3271842..205189865eb 100644 --- a/ql/math/interpolations/abcdinterpolation.hpp +++ b/ql/math/interpolations/abcdinterpolation.hpp @@ -76,8 +76,8 @@ namespace QuantLib { }; template - class AbcdInterpolationImpl : public Interpolation::templateImpl, - public AbcdCoeffHolder { + class AbcdInterpolationImpl final : public Interpolation::templateImpl, + public AbcdCoeffHolder { public: AbcdInterpolationImpl(const I1& xBegin, const I1& xEnd, diff --git a/ql/math/interpolations/convexmonotoneinterpolation.hpp b/ql/math/interpolations/convexmonotoneinterpolation.hpp index 205eebeb174..8f74cc052b2 100644 --- a/ql/math/interpolations/convexmonotoneinterpolation.hpp +++ b/ql/math/interpolations/convexmonotoneinterpolation.hpp @@ -171,7 +171,7 @@ namespace QuantLib { //the first value in the y-vector is ignored. template - class ConvexMonotoneImpl : public Interpolation::templateImpl { + class ConvexMonotoneImpl final : public Interpolation::templateImpl { typedef std::map > helper_map; public: diff --git a/ql/math/interpolations/cubicinterpolation.hpp b/ql/math/interpolations/cubicinterpolation.hpp index b4c6ee2dbf3..0bb40efbfd4 100644 --- a/ql/math/interpolations/cubicinterpolation.hpp +++ b/ql/math/interpolations/cubicinterpolation.hpp @@ -360,8 +360,8 @@ namespace QuantLib { namespace detail { template - class CubicInterpolationImpl : public CoefficientHolder, - public Interpolation::templateImpl { + class CubicInterpolationImpl final : public CoefficientHolder, + public Interpolation::templateImpl { public: CubicInterpolationImpl(const I1& xBegin, const I1& xEnd, diff --git a/ql/math/interpolations/multicubicspline.hpp b/ql/math/interpolations/multicubicspline.hpp index 93a5f14d05e..3e1039c9f20 100644 --- a/ql/math/interpolations/multicubicspline.hpp +++ b/ql/math/interpolations/multicubicspline.hpp @@ -93,7 +93,7 @@ namespace QuantLib { : first(*i), second(i + 1) {} Data(const SplineGrid &v) : first(v[0]), second(v.begin()+1) {} - void swap(Data &d) { + void swap(Data &d) noexcept { first.swap(d.first); second.swap(d.second); } @@ -108,7 +108,7 @@ namespace QuantLib { Data(const SplineGrid &v) : first(v[0]) {} Data(std::vector v) : first(std::move(v)) {} - void swap(Data, EmptyArg> &d) { + void swap(Data, EmptyArg> &d) noexcept { first.swap(d.first); } Real operator[](Size n) const {return first[n];} diff --git a/ql/math/interpolations/xabrinterpolation.hpp b/ql/math/interpolations/xabrinterpolation.hpp index 6b36b1908cc..035b86ad7dd 100644 --- a/ql/math/interpolations/xabrinterpolation.hpp +++ b/ql/math/interpolations/xabrinterpolation.hpp @@ -99,8 +99,8 @@ template class XABRCoeffHolder { }; template -class XABRInterpolationImpl : public Interpolation::templateImpl, - public XABRCoeffHolder { +class XABRInterpolationImpl final : public Interpolation::templateImpl, + public XABRCoeffHolder { public: XABRInterpolationImpl(const I1& xBegin, const I1& xEnd, @@ -190,7 +190,7 @@ class XABRInterpolationImpl : public Interpolation::templateImpl, do { if (iterations > 0) { - HaltonRsg::sample_type s = halton.nextSequence(); + const auto& s = halton.nextSequence(); Model().guess(guess, this->paramIsFixed_, this->forward_, this->t_, s.value, this->addParams_); for (Size i = 0; i < this->paramIsFixed_.size(); ++i) diff --git a/ql/math/lexicographicalview.hpp b/ql/math/lexicographicalview.hpp index 9ed2193ac20..ab0219f6303 100644 --- a/ql/math/lexicographicalview.hpp +++ b/ql/math/lexicographicalview.hpp @@ -17,155 +17,5 @@ FOR A PARTICULAR PURPOSE. See the license for more details. */ -/*! \file lexicographicalview.hpp - \brief Lexicographical 2-D view of a contiguous set of data. -*/ - -#ifndef quantlib_lexicographical_view_hpp -#define quantlib_lexicographical_view_hpp - -#include -#include - -namespace QuantLib { - - /*! \deprecated To be removed as unused. - Copy it in your codebase if you need it. - Deprecated in version 1.26. - */ - template - class QL_DEPRECATED LexicographicalView { - public: - //! attaches the view with the given dimension to a sequence - LexicographicalView(const RandomAccessIterator& begin, - const RandomAccessIterator& end, Size xSize); - //! iterates over \f$ v_{ij} \f$ with \f$ j \f$ fixed. - typedef RandomAccessIterator x_iterator; - //! iterates backwards over \f$ v_{ij} \f$ with \f$ j \f$ fixed. - typedef boost::reverse_iterator - reverse_x_iterator; - //! iterates over \f$ v_{ij} \f$ with \f$ i \f$ fixed. - typedef step_iterator y_iterator; - //! iterates backwards over \f$ v_{ij} \f$ with \f$ i \f$ fixed. - typedef boost::reverse_iterator reverse_y_iterator; - - //! \name Element access - //@{ - y_iterator operator[](Size i); - //@} - - //! \name Iterator access - //@{ - x_iterator xbegin (Size j); - x_iterator xend (Size j); - reverse_x_iterator rxbegin(Size j); - reverse_x_iterator rxend (Size j); - y_iterator ybegin (Size i); - y_iterator yend (Size i); - reverse_y_iterator rybegin(Size i); - reverse_y_iterator ryend (Size i); - //@} - - //! \name Inspectors - //@{ - //! dimension of the array along x - Size xSize() const; - //! dimension of the array along y - Size ySize() const; - //@} - private: - RandomAccessIterator begin_, end_; - Size xSize_, ySize_; - }; - - - // inline definitions - - QL_DEPRECATED_DISABLE_WARNING - - template - inline - LexicographicalView::LexicographicalView( - const RandomAccessIterator& begin, - const RandomAccessIterator& end, - Size xSize) - : begin_(begin), end_(end), xSize_(xSize), - ySize_((end-begin)/xSize) { - QL_REQUIRE((end_-begin_) % xSize_ == 0, - "The x size of the view is not an exact divisor" - "of the size of the underlying sequence"); - } - - template - inline typename LexicographicalView::x_iterator - LexicographicalView::xbegin(Size j) { - return begin_+j*xSize_; - } - - template - inline typename LexicographicalView::x_iterator - LexicographicalView::xend(Size j) { - return begin_+(j+1)*xSize_; - } - - template - inline - typename LexicographicalView::reverse_x_iterator - LexicographicalView::rxbegin(Size j) { - return reverse_x_iterator(xend(j)); - } - - template - inline - typename LexicographicalView::reverse_x_iterator - LexicographicalView::rxend(Size j) { - return reverse_x_iterator(xbegin(j)); - } - - template - inline typename LexicographicalView::y_iterator - LexicographicalView::ybegin(Size i) { - return y_iterator(begin_+i,xSize_); - } - - template - inline typename LexicographicalView::y_iterator - LexicographicalView::yend(Size i) { - return y_iterator(begin_+i,xSize_)+ySize_; - } - - template - inline - typename LexicographicalView::reverse_y_iterator - LexicographicalView::rybegin(Size i) { - return reverse_y_iterator(yend(i)); - } - - template - inline - typename LexicographicalView::reverse_y_iterator - LexicographicalView::ryend(Size i) { - return reverse_y_iterator(ybegin(i)); - } - - template - inline typename LexicographicalView::y_iterator - LexicographicalView::operator[](Size i) { - return y_iterator(begin_+i,xSize_); - } - - template - inline Size LexicographicalView::xSize() const { - return xSize_; - } - - template - inline Size LexicographicalView::ySize() const { - return ySize_; - } - - QL_DEPRECATED_ENABLE_WARNING -} - - -#endif +// Deprecated in version 1.31 +#pragma message("Warning: this file is empty and will disappear in a future release. Do not include it.") diff --git a/ql/math/linearleastsquaresregression.hpp b/ql/math/linearleastsquaresregression.hpp index c73d1ae8598..425173bc634 100644 --- a/ql/math/linearleastsquaresregression.hpp +++ b/ql/math/linearleastsquaresregression.hpp @@ -29,6 +29,7 @@ #include #include +#include namespace QuantLib { @@ -116,7 +117,7 @@ namespace QuantLib { const yContainer& y, Real intercept) : GeneralLinearLeastSquares(x, y, details::LinearFcts::value> + std::is_arithmetic::value> (x, intercept).fcts()) { } diff --git a/ql/math/matrix.hpp b/ql/math/matrix.hpp index fb080dead13..bfa4e210e6c 100644 --- a/ql/math/matrix.hpp +++ b/ql/math/matrix.hpp @@ -29,6 +29,7 @@ #include #include #include +#include namespace QuantLib { @@ -57,6 +58,7 @@ namespace QuantLib { Matrix(const Matrix&); Matrix(Matrix&&) noexcept; Matrix(std::initializer_list>); + ~Matrix() = default; Matrix& operator=(const Matrix&); Matrix& operator=(Matrix&&) noexcept; @@ -78,18 +80,18 @@ namespace QuantLib { typedef Real* iterator; typedef const Real* const_iterator; - typedef boost::reverse_iterator reverse_iterator; - typedef boost::reverse_iterator const_reverse_iterator; + typedef std::reverse_iterator reverse_iterator; + typedef std::reverse_iterator const_reverse_iterator; typedef Real* row_iterator; typedef const Real* const_row_iterator; - typedef boost::reverse_iterator reverse_row_iterator; - typedef boost::reverse_iterator + typedef std::reverse_iterator reverse_row_iterator; + typedef std::reverse_iterator const_reverse_row_iterator; typedef step_iterator column_iterator; typedef step_iterator const_column_iterator; - typedef boost::reverse_iterator + typedef std::reverse_iterator reverse_column_iterator; - typedef boost::reverse_iterator + typedef std::reverse_iterator const_reverse_column_iterator; //! \name Iterator access //@{ @@ -140,7 +142,7 @@ namespace QuantLib { //! \name Utilities //@{ - void swap(Matrix&); + void swap(Matrix&) noexcept; //@} private: std::unique_ptr data_; @@ -152,16 +154,35 @@ namespace QuantLib { /*! \relates Matrix */ Matrix operator+(const Matrix&, const Matrix&); /*! \relates Matrix */ + Matrix operator+(const Matrix&, Matrix&&); + /*! \relates Matrix */ + Matrix operator+(Matrix&&, const Matrix&); + /*! \relates Matrix */ + Matrix operator+(Matrix&&, Matrix&&); + /*! \relates Matrix */ Matrix operator-(const Matrix&); /*! \relates Matrix */ + Matrix operator-(Matrix&&); + /*! \relates Matrix */ Matrix operator-(const Matrix&, const Matrix&); /*! \relates Matrix */ + Matrix operator-(const Matrix&, Matrix&&); + /*! \relates Matrix */ + Matrix operator-(Matrix&&, const Matrix&); + /*! \relates Matrix */ + Matrix operator-(Matrix&&, Matrix&&); + /*! \relates Matrix */ Matrix operator*(const Matrix&, Real); /*! \relates Matrix */ + Matrix operator*(Matrix&&, Real); + /*! \relates Matrix */ Matrix operator*(Real, const Matrix&); /*! \relates Matrix */ + Matrix operator*(Real, Matrix&&); + /*! \relates Matrix */ Matrix operator/(const Matrix&, Real); - + /*! \relates Matrix */ + Matrix operator/(Matrix&&, Real); // vectorial products @@ -185,7 +206,7 @@ namespace QuantLib { Matrix outerProduct(Iterator1 v1begin, Iterator1 v1end, Iterator2 v2begin, Iterator2 v2end); /*! \relates Matrix */ - void swap(Matrix&, Matrix&); + void swap(Matrix&, Matrix&) noexcept; /*! \relates Matrix */ std::ostream& operator<<(std::ostream&, const Matrix&); @@ -267,11 +288,10 @@ namespace QuantLib { return !this->operator==(to); } - inline void Matrix::swap(Matrix& from) { - using std::swap; + inline void Matrix::swap(Matrix& from) noexcept { data_.swap(from.data_); - swap(rows_,from.rows_); - swap(columns_,from.columns_); + std::swap(rows_, from.rows_); + std::swap(columns_, from.columns_); } inline const Matrix& Matrix::operator+=(const Matrix& m) { @@ -513,12 +533,50 @@ namespace QuantLib { return temp; } + inline Matrix operator+(const Matrix& m1, Matrix&& m2) { + QL_REQUIRE(m1.rows() == m2.rows() && + m1.columns() == m2.columns(), + "matrices with different sizes (" << + m1.rows() << "x" << m1.columns() << ", " << + m2.rows() << "x" << m2.columns() << ") cannot be " + "added"); + std::transform(m1.begin(), m1.end(), m2.begin(), m2.begin(), std::plus<>()); + return std::move(m2); + } + + inline Matrix operator+(Matrix&& m1, const Matrix& m2) { + QL_REQUIRE(m1.rows() == m2.rows() && + m1.columns() == m2.columns(), + "matrices with different sizes (" << + m1.rows() << "x" << m1.columns() << ", " << + m2.rows() << "x" << m2.columns() << ") cannot be " + "added"); + std::transform(m1.begin(), m1.end(), m2.begin(), m1.begin(), std::plus<>()); + return std::move(m1); + } + + inline Matrix operator+(Matrix&& m1, Matrix&& m2) { // NOLINT(cppcoreguidelines-rvalue-reference-param-not-moved) + QL_REQUIRE(m1.rows() == m2.rows() && + m1.columns() == m2.columns(), + "matrices with different sizes (" << + m1.rows() << "x" << m1.columns() << ", " << + m2.rows() << "x" << m2.columns() << ") cannot be " + "added"); + std::transform(m1.begin(), m1.end(), m2.begin(), m1.begin(), std::plus<>()); + return std::move(m1); + } + inline Matrix operator-(const Matrix& m1) { Matrix temp(m1.rows(), m1.columns()); std::transform(m1.begin(), m1.end(), temp.begin(), std::negate<>()); return temp; } + inline Matrix operator-(Matrix&& m1) { + std::transform(m1.begin(), m1.end(), m1.begin(), std::negate<>()); + return std::move(m1); + } + inline Matrix operator-(const Matrix& m1, const Matrix& m2) { QL_REQUIRE(m1.rows() == m2.rows() && m1.columns() == m2.columns(), @@ -531,24 +589,72 @@ namespace QuantLib { return temp; } + inline Matrix operator-(const Matrix& m1, Matrix&& m2) { + QL_REQUIRE(m1.rows() == m2.rows() && + m1.columns() == m2.columns(), + "matrices with different sizes (" << + m1.rows() << "x" << m1.columns() << ", " << + m2.rows() << "x" << m2.columns() << ") cannot be " + "subtracted"); + std::transform(m1.begin(), m1.end(), m2.begin(), m2.begin(), std::minus<>()); + return std::move(m2); + } + + inline Matrix operator-(Matrix&& m1, const Matrix& m2) { + QL_REQUIRE(m1.rows() == m2.rows() && + m1.columns() == m2.columns(), + "matrices with different sizes (" << + m1.rows() << "x" << m1.columns() << ", " << + m2.rows() << "x" << m2.columns() << ") cannot be " + "subtracted"); + std::transform(m1.begin(), m1.end(), m2.begin(), m1.begin(), std::minus<>()); + return std::move(m1); + } + + inline Matrix operator-(Matrix&& m1, Matrix&& m2) { // NOLINT(cppcoreguidelines-rvalue-reference-param-not-moved) + QL_REQUIRE(m1.rows() == m2.rows() && + m1.columns() == m2.columns(), + "matrices with different sizes (" << + m1.rows() << "x" << m1.columns() << ", " << + m2.rows() << "x" << m2.columns() << ") cannot be " + "subtracted"); + std::transform(m1.begin(), m1.end(), m2.begin(), m1.begin(), std::minus<>()); + return std::move(m1); + } + inline Matrix operator*(const Matrix& m, Real x) { Matrix temp(m.rows(),m.columns()); std::transform(m.begin(), m.end(), temp.begin(), [=](Real y) -> Real { return y * x; }); return temp; } + inline Matrix operator*(Matrix&& m, Real x) { + std::transform(m.begin(), m.end(), m.begin(), [=](Real y) -> Real { return y * x; }); + return std::move(m); + } + inline Matrix operator*(Real x, const Matrix& m) { Matrix temp(m.rows(),m.columns()); std::transform(m.begin(), m.end(), temp.begin(), [=](Real y) -> Real { return x * y; }); return temp; } + inline Matrix operator*(Real x, Matrix&& m) { + std::transform(m.begin(), m.end(), m.begin(), [=](Real y) -> Real { return x * y; }); + return std::move(m); + } + inline Matrix operator/(const Matrix& m, Real x) { Matrix temp(m.rows(),m.columns()); std::transform(m.begin(), m.end(), temp.begin(), [=](Real y) -> Real { return y / x; }); return temp; } + inline Matrix operator/(Matrix&& m, Real x) { + std::transform(m.begin(), m.end(), m.begin(), [=](Real y) -> Real { return y / x; }); + return std::move(m); + } + inline Array operator*(const Array& v, const Matrix& m) { QL_REQUIRE(v.size() == m.rows(), "vectors and matrices with different sizes (" @@ -623,7 +729,7 @@ namespace QuantLib { return result; } - inline void swap(Matrix& m1, Matrix& m2) { + inline void swap(Matrix& m1, Matrix& m2) noexcept { m1.swap(m2); } diff --git a/ql/math/matrixutilities/bicgstab.cpp b/ql/math/matrixutilities/bicgstab.cpp index 6e420f19950..41bf4b40354 100644 --- a/ql/math/matrixutilities/bicgstab.cpp +++ b/ql/math/matrixutilities/bicgstab.cpp @@ -64,7 +64,7 @@ namespace QuantLib { p = r; } - pTld = (M_ == QL_NULL_FUNCTION ? p : M_(p)); + pTld = (!M_ ? p : M_(p)); v = A_(pTld); alpha = rho/DotProduct(rTld, v); @@ -75,7 +75,7 @@ namespace QuantLib { break; } - sTld = (M_ == QL_NULL_FUNCTION ? s : M_(s)); + sTld = (!M_ ? s : M_(s)); t = A_(sTld); omega = DotProduct(t,s)/DotProduct(t,t); x += alpha*pTld + omega*sTld; diff --git a/ql/math/matrixutilities/gmres.cpp b/ql/math/matrixutilities/gmres.cpp index c17f17babd8..b318b5ec932 100644 --- a/ql/math/matrixutilities/gmres.cpp +++ b/ql/math/matrixutilities/gmres.cpp @@ -89,7 +89,7 @@ namespace QuantLib { for (Size j=0; j < maxIter_ && errors.back() >= relTol_; ++j) { h.emplace_back(maxIter_, 0.0); - Array w = A_(M_ == QL_NULL_FUNCTION ? v[j] : M_(v[j])); + Array w = A_(!M_ ? v[j] : M_(v[j])); for (Size i=0; i <= j; ++i) { h[i][j] = DotProduct(w, v[i]); @@ -138,7 +138,7 @@ namespace QuantLib { Array xm = std::inner_product( v.begin(), v.begin()+k, y.begin(), Array(x.size(), Real(0.0))); - xm = x + (M_ == QL_NULL_FUNCTION ? xm : M_(xm)); + xm = x + (!M_ ? xm : M_(xm)); GMRESResult result = { errors, xm }; return result; diff --git a/ql/math/matrixutilities/svd.cpp b/ql/math/matrixutilities/svd.cpp index 6e6484953e9..e0cb8ade70c 100644 --- a/ql/math/matrixutilities/svd.cpp +++ b/ql/math/matrixutilities/svd.cpp @@ -326,7 +326,7 @@ namespace QuantLib { // Perform the task indicated by kase. - switch (kase) { + switch (kase) { // NOLINT(bugprone-switch-missing-default-case) // Deflate negligible s(p). diff --git a/ql/math/ode/adaptiverungekutta.hpp b/ql/math/ode/adaptiverungekutta.hpp index a2a175db2b0..23d64458ab3 100644 --- a/ql/math/ode/adaptiverungekutta.hpp +++ b/ql/math/ode/adaptiverungekutta.hpp @@ -32,6 +32,7 @@ #include #include #include +#include namespace QuantLib { diff --git a/ql/math/optimization/constraint.hpp b/ql/math/optimization/constraint.hpp index 258a9012356..ddbaef85da3 100644 --- a/ql/math/optimization/constraint.hpp +++ b/ql/math/optimization/constraint.hpp @@ -78,7 +78,7 @@ namespace QuantLib { //! No constraint class NoConstraint : public Constraint { private: - class Impl : public Constraint::Impl { + class Impl final : public Constraint::Impl { public: bool test(const Array&) const override { return true; } }; @@ -91,7 +91,7 @@ namespace QuantLib { //! %Constraint imposing positivity to all arguments class PositiveConstraint : public Constraint { private: - class Impl : public Constraint::Impl { + class Impl final : public Constraint::Impl { public: bool test(const Array& params) const override { return std::all_of(params.begin(), params.end(), [](Real p) { return p > 0.0; }); @@ -113,7 +113,7 @@ namespace QuantLib { //! %Constraint imposing all arguments to be in [low,high] class BoundaryConstraint : public Constraint { private: - class Impl : public Constraint::Impl { + class Impl final : public Constraint::Impl { public: Impl(Real low, Real high) : low_(low), high_(high) {} @@ -139,7 +139,7 @@ namespace QuantLib { //! %Constraint enforcing both given sub-constraints class CompositeConstraint : public Constraint { private: - class Impl : public Constraint::Impl { + class Impl final : public Constraint::Impl { public: Impl(Constraint c1, Constraint c2) : c1_(std::move(c1)), c2_(std::move(c2)) {} bool test(const Array& params) const override { @@ -176,7 +176,7 @@ namespace QuantLib { //! %Constraint imposing i-th argument to be in [low_i,high_i] for all i class NonhomogeneousBoundaryConstraint: public Constraint { private: - class Impl: public Constraint::Impl { + class Impl final : public Constraint::Impl { public: Impl(Array low, Array high) : low_(std::move(low)), high_(std::move(high)) { QL_ENSURE(low_.size()==high_.size(), diff --git a/ql/math/optimization/lmdif.cpp b/ql/math/optimization/lmdif.cpp index 8e394cb1ac7..61f17f813dd 100644 --- a/ql/math/optimization/lmdif.cpp +++ b/ql/math/optimization/lmdif.cpp @@ -1375,9 +1375,9 @@ iter = 1; * calculate the jacobian matrix. */ iflag = 2; -if (jacFcn == QL_NULL_FUNCTION) // use user supplied jacobian calculation +if (!jacFcn) fdjac2(m,n,x,fvec,fjac,ldfjac,&iflag,epsfcn,wa4, fcn); -else +else // use user supplied jacobian calculation jacFcn(m,n,x,fjac,&iflag); *nfev += n; if(iflag < 0) diff --git a/ql/math/optimization/projectedconstraint.hpp b/ql/math/optimization/projectedconstraint.hpp index 76f043c490a..b06f8920859 100644 --- a/ql/math/optimization/projectedconstraint.hpp +++ b/ql/math/optimization/projectedconstraint.hpp @@ -34,7 +34,7 @@ namespace QuantLib { private: - class Impl : public Constraint::Impl { + class Impl final : public Constraint::Impl { public: Impl(Constraint constraint, const Array& parameterValues, diff --git a/ql/math/sampledcurve.hpp b/ql/math/sampledcurve.hpp index 89d97832fd5..fc756104596 100644 --- a/ql/math/sampledcurve.hpp +++ b/ql/math/sampledcurve.hpp @@ -30,9 +30,10 @@ namespace QuantLib { - //! This class contains a sampled curve. - /*! Initially the class will contain one indexed curve */ - class SampledCurve { + /*! \deprecated Use the new finite-differences framework instead. + Deprecated in version 1.32. + */ + class [[deprecated("Use the new finite-differences framework instead")]] SampledCurve { public: SampledCurve(Size gridSize = 0); SampledCurve(const Array &grid); @@ -82,7 +83,9 @@ namespace QuantLib { //! \name utilities //@{ - void swap(SampledCurve&); + QL_DEPRECATED_DISABLE_WARNING + void swap(SampledCurve&) noexcept; + QL_DEPRECATED_ENABLE_WARNING void setLogGrid(Real min, Real max) { setGrid(BoundedLogGrid(min, max, size()-1)); } @@ -133,6 +136,7 @@ namespace QuantLib { #pragma GCC diagnostic pop #endif + QL_DEPRECATED_DISABLE_WARNING template inline const SampledCurve& transform(T x) { std::transform(values_.begin(), values_.end(), @@ -146,20 +150,31 @@ namespace QuantLib { grid_.begin(), x); return *this; } + QL_DEPRECATED_ENABLE_WARNING //@} private: Array grid_; Array values_; }; + QL_DEPRECATED_DISABLE_WARNING + /* \relates SampledCurve */ - void swap(SampledCurve&, SampledCurve&); + void swap(SampledCurve&, SampledCurve&) noexcept; + /*! \deprecated Use the new finite-differences framework instead. + Deprecated in version 1.32. + */ + [[deprecated("Use the new finite-differences framework instead")]] typedef SampledCurve SampledCurveSet; + QL_DEPRECATED_ENABLE_WARNING + // inline definitions + QL_DEPRECATED_DISABLE_WARNING + inline SampledCurve::SampledCurve(Size gridSize) : grid_(gridSize), values_(gridSize) {} @@ -214,13 +229,12 @@ namespace QuantLib { values_ = g; } - inline void SampledCurve::swap(SampledCurve& from) { - using std::swap; + inline void SampledCurve::swap(SampledCurve& from) noexcept { grid_.swap(from.grid_); values_.swap(from.values_); } - inline void swap(SampledCurve& c1, SampledCurve& c2) { + inline void swap(SampledCurve& c1, SampledCurve& c2) noexcept { c1.swap(c2); } @@ -230,6 +244,9 @@ namespace QuantLib { << a.values() << " ]"; return out; } + + QL_DEPRECATED_ENABLE_WARNING + } diff --git a/ql/methods/finitedifferences/Makefile.am b/ql/methods/finitedifferences/Makefile.am index 2302384dcae..c6a4f056e92 100644 --- a/ql/methods/finitedifferences/Makefile.am +++ b/ql/methods/finitedifferences/Makefile.am @@ -6,7 +6,6 @@ AM_CPPFLAGS = -I${top_builddir} -I${top_srcdir} this_includedir=${includedir}/${subdir} this_include_HEADERS = \ all.hpp \ - americancondition.hpp \ boundarycondition.hpp \ bsmoperator.hpp \ bsmtermoperator.hpp \ @@ -20,7 +19,6 @@ this_include_HEADERS = \ finitedifferencemodel.hpp \ impliciteuler.hpp \ mixedscheme.hpp\ - onefactoroperator.hpp \ operatortraits.hpp \ parallelevolver.hpp \ pde.hpp \ @@ -71,7 +69,7 @@ all.hpp: Makefile.am echo "/* This file is automatically generated; do not edit. */" > ${srcdir}/$@ echo "/* Add the files to be included into Makefile.am instead. */" >> ${srcdir}/$@ echo >> ${srcdir}/$@ - for i in $(filter-out all.hpp americancondition.hpp onefactoroperator.hpp, $(this_include_HEADERS)); do \ + for i in $(filter-out all.hpp shoutcondition.hpp pdeshortrate.hpp, $(this_include_HEADERS)); do \ echo "#include <${subdir}/$$i>" >> ${srcdir}/$@; \ done echo >> ${srcdir}/$@ diff --git a/ql/methods/finitedifferences/all.hpp b/ql/methods/finitedifferences/all.hpp index 243fa369e30..872f8b6b9cc 100644 --- a/ql/methods/finitedifferences/all.hpp +++ b/ql/methods/finitedifferences/all.hpp @@ -18,8 +18,6 @@ #include #include #include -#include -#include #include #include #include diff --git a/ql/methods/finitedifferences/bsmtermoperator.hpp b/ql/methods/finitedifferences/bsmtermoperator.hpp index 4609b8cb01f..e47f8c38a6c 100644 --- a/ql/methods/finitedifferences/bsmtermoperator.hpp +++ b/ql/methods/finitedifferences/bsmtermoperator.hpp @@ -31,11 +31,10 @@ namespace QuantLib { - //! Black-Scholes-Merton differential operator - /*! \ingroup findiff - - \test coefficients are tested against constant BSM operator + /*! \deprecated Use the new finite-differences framework instead. + Deprecated in version 1.32. */ + [[deprecated("Use the new finite-differences framework instead")]] typedef PdeOperator BSMTermOperator; } diff --git a/ql/methods/finitedifferences/fdtypedefs.hpp b/ql/methods/finitedifferences/fdtypedefs.hpp index 0699a3dbfe6..01bd49b51ec 100644 --- a/ql/methods/finitedifferences/fdtypedefs.hpp +++ b/ql/methods/finitedifferences/fdtypedefs.hpp @@ -29,17 +29,30 @@ namespace QuantLib { - //! default choice for finite-difference model + /*! \deprecated Define your typedef if needed. + Deprecated in version 1.32. + */ + [[deprecated("Define your typedef if needed")]] typedef FiniteDifferenceModel< CrankNicolson > StandardFiniteDifferenceModel; - //! default choice for parallel finite-difference model + QL_DEPRECATED_DISABLE_WARNING + + /*! \deprecated Define your typedef if needed. + Deprecated in version 1.32. + */ + [[deprecated("Define your typedef if needed")]] typedef FiniteDifferenceModel > > StandardSystemFiniteDifferenceModel; - //! default choice for step condition + QL_DEPRECATED_ENABLE_WARNING + + /*! \deprecated Define your typedef if needed. + Deprecated in version 1.32. + */ + [[deprecated("Define your typedef if needed")]] typedef StepCondition StandardStepCondition; } diff --git a/ql/methods/finitedifferences/meshers/concentrating1dmesher.cpp b/ql/methods/finitedifferences/meshers/concentrating1dmesher.cpp index e2730100166..dabc7782301 100644 --- a/ql/methods/finitedifferences/meshers/concentrating1dmesher.cpp +++ b/ql/methods/finitedifferences/meshers/concentrating1dmesher.cpp @@ -162,7 +162,7 @@ namespace QuantLib { OdeIntegrationFct fct(points, betas, tol); const Real a = Brent().solve( - [&](Real x) { return fct.solve(x, start, 0.0, 1.0) - end; }, + [&](Real x) -> Real { return fct.solve(x, start, 0.0, 1.0) - end; }, tol, aInit, 0.1*aInit); // solve ODE for all grid points @@ -192,7 +192,7 @@ namespace QuantLib { std::lower_bound(y.begin(), y.end(), points[i])); const Real e = Brent().solve( - [&](Real x){ return odeSolution(x, true) - points[i]; }, + [&](Real x) -> Real { return odeSolution(x, true) - points[i]; }, QL_EPSILON, x[j], 0.5/size); w.emplace_back(std::min(x[size - 2], x[j]), e); diff --git a/ql/methods/finitedifferences/meshers/fdmmeshercomposite.cpp b/ql/methods/finitedifferences/meshers/fdmmeshercomposite.cpp index 96dc0582e4d..ece9d144505 100644 --- a/ql/methods/finitedifferences/meshers/fdmmeshercomposite.cpp +++ b/ql/methods/finitedifferences/meshers/fdmmeshercomposite.cpp @@ -33,7 +33,7 @@ namespace QuantLib { for (Size i=0; i < dim.size(); ++i) { dim[i] = meshers[i]->size(); } - return ext::make_shared(dim); + return ext::make_shared(std::move(dim)); } } @@ -101,9 +101,7 @@ namespace QuantLib { Array FdmMesherComposite::locations(Size direction) const { Array retVal(layout_->size()); - const FdmLinearOpIterator endIter = layout_->end(); - for (FdmLinearOpIterator iter = layout_->begin(); - iter != endIter; ++iter) { + for (const auto& iter : *layout_) { retVal[iter.index()] = mesher_[direction]->locations()[iter.coordinates()[direction]]; } diff --git a/ql/methods/finitedifferences/meshers/uniformgridmesher.cpp b/ql/methods/finitedifferences/meshers/uniformgridmesher.cpp index e8bb40cb0de..e5a47e988d2 100644 --- a/ql/methods/finitedifferences/meshers/uniformgridmesher.cpp +++ b/ql/methods/finitedifferences/meshers/uniformgridmesher.cpp @@ -48,9 +48,7 @@ namespace QuantLib { Array UniformGridMesher::locations(Size d) const { Array retVal(layout_->size()); - const FdmLinearOpIterator endIter = layout_->end(); - for (FdmLinearOpIterator iter = layout_->begin(); - iter != endIter; ++iter) { + for (const auto& iter : *layout_) { retVal[iter.index()] = locations_[d][iter.coordinates()[d]]; } diff --git a/ql/methods/finitedifferences/operators/fdm2dblackscholesop.cpp b/ql/methods/finitedifferences/operators/fdm2dblackscholesop.cpp index ce3808ed370..f968e49d8a3 100644 --- a/ql/methods/finitedifferences/operators/fdm2dblackscholesop.cpp +++ b/ql/methods/finitedifferences/operators/fdm2dblackscholesop.cpp @@ -69,12 +69,8 @@ namespace QuantLib { opY_.setTime(t1, t2); if (localVol1_ != nullptr) { - const ext::shared_ptr layout=mesher_->layout(); - const FdmLinearOpIterator endIter = layout->end(); - - Array vol1(layout->size()), vol2(layout->size()); - for (FdmLinearOpIterator iter = layout->begin(); - iter!=endIter; ++iter) { + Array vol1(mesher_->layout()->size()), vol2(mesher_->layout()->size()); + for (const auto& iter : *mesher_->layout()) { const Size i = iter.index(); if (illegalLocalVolOverwrite_ < 0.0) { diff --git a/ql/methods/finitedifferences/operators/fdmbatesop.cpp b/ql/methods/finitedifferences/operators/fdmbatesop.cpp index ca0653ffdef..54dfb780987 100644 --- a/ql/methods/finitedifferences/operators/fdmbatesop.cpp +++ b/ql/methods/finitedifferences/operators/fdmbatesop.cpp @@ -87,16 +87,12 @@ namespace QuantLib { } Array FdmBatesOp::integro(const Array& r) const { - const ext::shared_ptr layout = mesher_->layout(); - - QL_REQUIRE(layout->dim().size() == 2, "invalid layout dimension"); + QL_REQUIRE(mesher_->layout()->dim().size() == 2, "invalid layout dimension"); - Array x(layout->dim()[0]); - Matrix f(layout->dim()[1], layout->dim()[0]); + Array x(mesher_->layout()->dim()[0]); + Matrix f(mesher_->layout()->dim()[1], mesher_->layout()->dim()[0]); - const FdmLinearOpIterator endIter = layout->end(); - for (FdmLinearOpIterator iter = layout->begin(); iter != endIter; - ++iter) { + for (const auto& iter : *mesher_->layout()) { const Size i = iter.coordinates()[0]; const Size j = iter.coordinates()[1]; @@ -111,7 +107,7 @@ namespace QuantLib { } Array integral(r.size()); - for (FdmLinearOpIterator iter=layout->begin(); iter!=endIter; ++iter) { + for (const auto& iter : *mesher_->layout()) { const Size i = iter.coordinates()[0]; const Size j = iter.coordinates()[1]; diff --git a/ql/methods/finitedifferences/operators/fdmblackscholesfwdop.cpp b/ql/methods/finitedifferences/operators/fdmblackscholesfwdop.cpp index 35a75cc5f37..c503752ec76 100644 --- a/ql/methods/finitedifferences/operators/fdmblackscholesfwdop.cpp +++ b/ql/methods/finitedifferences/operators/fdmblackscholesfwdop.cpp @@ -53,12 +53,8 @@ namespace QuantLib { const Rate q = qTS_->forwardRate(t1, t2, Continuous).rate(); if (localVol_ != nullptr) { - const ext::shared_ptr layout=mesher_->layout(); - const FdmLinearOpIterator endIter = layout->end(); - - Array v(layout->size()); - for (FdmLinearOpIterator iter = layout->begin(); - iter != endIter; ++iter) { + Array v(mesher_->layout()->size()); + for (const auto& iter : *mesher_->layout()) { const Size i = iter.index(); if (illegalLocalVolOverwrite_ < 0.0) { diff --git a/ql/methods/finitedifferences/operators/fdmblackscholesop.cpp b/ql/methods/finitedifferences/operators/fdmblackscholesop.cpp index 5ffffd8bad7..25e69de2afb 100644 --- a/ql/methods/finitedifferences/operators/fdmblackscholesop.cpp +++ b/ql/methods/finitedifferences/operators/fdmblackscholesop.cpp @@ -53,12 +53,8 @@ namespace QuantLib { const Rate q = qTS_->forwardRate(t1, t2, Continuous).rate(); if (localVol_ != nullptr) { - const ext::shared_ptr layout=mesher_->layout(); - const FdmLinearOpIterator endIter = layout->end(); - - Array v(layout->size()); - for (FdmLinearOpIterator iter = layout->begin(); - iter!=endIter; ++iter) { + Array v(mesher_->layout()->size()); + for (const auto& iter : *mesher_->layout()) { const Size i = iter.index(); if (illegalLocalVolOverwrite_ < 0.0) { diff --git a/ql/methods/finitedifferences/operators/fdmhestonfwdop.cpp b/ql/methods/finitedifferences/operators/fdmhestonfwdop.cpp index d7d44ea49a3..341a5a9d15f 100644 --- a/ql/methods/finitedifferences/operators/fdmhestonfwdop.cpp +++ b/ql/methods/finitedifferences/operators/fdmhestonfwdop.cpp @@ -61,9 +61,8 @@ namespace QuantLib { SecondOrderMixedDerivativeOp(0, 1, mesher) .mult(rho_ * mixedSigma_ * mesher->locations(1)))), leverageFct_(std::move(leverageFct)), mesher_(mesher) { - const ext::shared_ptr layout = mesher->layout(); // zero flux boundary condition - const Size n = layout->dim()[1]; + const Size n = mesher->layout()->dim()[1]; const Real lowerBoundaryFactor = mapY_->lowerBoundaryFactor(type); const Real upperBoundaryFactor = mapY_->upperBoundaryFactor(type); @@ -75,8 +74,7 @@ namespace QuantLib { ModTripleBandLinearOp fDx(FirstDerivativeOp(0, mesher)); - const FdmLinearOpIterator endIter = layout->end(); - for (FdmLinearOpIterator iter = layout->begin(); iter != endIter; ++iter) { + for (const auto& iter : *mesher->layout()) { if (iter.coordinates()[1] == 0) { const Size idx = iter.index(); if (!leverageFct_) { @@ -193,8 +191,7 @@ namespace QuantLib { } Array FdmHestonFwdOp::getLeverageFctSlice(Time t1, Time t2) const { - const ext::shared_ptr layout=mesher_->layout(); - Array v(layout->size(), 1.0); + Array v(mesher_->layout()->size(), 1.0); if (!leverageFct_) return v; @@ -203,9 +200,7 @@ namespace QuantLib { const Time time = std::min(leverageFct_->maxTime(), t); //std::max(leverageFct_->minTime(), t)); - const FdmLinearOpIterator endIter = layout->end(); - for (FdmLinearOpIterator iter = layout->begin(); - iter!=endIter; ++iter) { + for (const auto& iter : *mesher_->layout()) { const Size nx = iter.coordinates()[0]; if (iter.coordinates()[1] == 0) { diff --git a/ql/methods/finitedifferences/operators/fdmhestonhullwhiteop.cpp b/ql/methods/finitedifferences/operators/fdmhestonhullwhiteop.cpp index 47e29bac107..9d3f97027dc 100644 --- a/ql/methods/finitedifferences/operators/fdmhestonhullwhiteop.cpp +++ b/ql/methods/finitedifferences/operators/fdmhestonhullwhiteop.cpp @@ -41,12 +41,9 @@ namespace QuantLib { // on the boundary s_min and s_max the second derivative // d²V/dS² is zero and due to Ito's Lemma the variance term // in the drift should vanish. - const ext::shared_ptr layout = mesher_->layout(); - const FdmLinearOpIterator endIter = layout->end(); - for (FdmLinearOpIterator iter = layout->begin(); iter != endIter; - ++iter) { + for (const auto& iter : *mesher_->layout()) { if ( iter.coordinates()[0] == 0 - || iter.coordinates()[0] == layout->dim()[0]-1) { + || iter.coordinates()[0] == mesher_->layout()->dim()[0]-1) { varianceValues_[iter.index()] = 0.0; } } diff --git a/ql/methods/finitedifferences/operators/fdmhestonop.cpp b/ql/methods/finitedifferences/operators/fdmhestonop.cpp index 2baa32b2896..6d52cdb795d 100644 --- a/ql/methods/finitedifferences/operators/fdmhestonop.cpp +++ b/ql/methods/finitedifferences/operators/fdmhestonop.cpp @@ -42,12 +42,9 @@ namespace QuantLib { // on the boundary s_min and s_max the second derivative // d^2V/dS^2 is zero and due to Ito's Lemma the variance term // in the drift should vanish. - ext::shared_ptr layout = mesher_->layout(); - FdmLinearOpIterator endIter = layout->end(); - for (FdmLinearOpIterator iter = layout->begin(); iter != endIter; - ++iter) { + for (const auto& iter : *mesher_->layout()) { if ( iter.coordinates()[0] == 0 - || iter.coordinates()[0] == layout->dim()[0]-1) { + || iter.coordinates()[0] == mesher_->layout()->dim()[0]-1) { varianceValues_[iter.index()] = 0.0; } } @@ -74,8 +71,7 @@ namespace QuantLib { Array FdmHestonEquityPart::getLeverageFctSlice(Time t1, Time t2) const { - const ext::shared_ptr layout=mesher_->layout(); - Array v(layout->size(), 1.0); + Array v(mesher_->layout()->size(), 1.0); if (!leverageFct_) { return v; @@ -83,9 +79,7 @@ namespace QuantLib { const Real t = 0.5*(t1+t2); const Time time = std::min(leverageFct_->maxTime(), t); - const FdmLinearOpIterator endIter = layout->end(); - for (FdmLinearOpIterator iter = layout->begin(); - iter!=endIter; ++iter) { + for (const auto& iter : *mesher_->layout()) { const Size nx = iter.coordinates()[0]; if (iter.coordinates()[1] == 0) { diff --git a/ql/methods/finitedifferences/operators/fdmlinearopiterator.hpp b/ql/methods/finitedifferences/operators/fdmlinearopiterator.hpp index 6c67cf19739..ecc3e462a95 100644 --- a/ql/methods/finitedifferences/operators/fdmlinearopiterator.hpp +++ b/ql/methods/finitedifferences/operators/fdmlinearopiterator.hpp @@ -75,7 +75,7 @@ namespace QuantLib { return coordinates_; } - void swap(FdmLinearOpIterator& iter) { + void swap(FdmLinearOpIterator& iter) noexcept { std::swap(iter.index_, index_); dim_.swap(iter.dim_); coordinates_.swap(iter.coordinates_); diff --git a/ql/methods/finitedifferences/operators/fdmlinearoplayout.hpp b/ql/methods/finitedifferences/operators/fdmlinearoplayout.hpp index 1188df2105e..fd39fc38be2 100644 --- a/ql/methods/finitedifferences/operators/fdmlinearoplayout.hpp +++ b/ql/methods/finitedifferences/operators/fdmlinearoplayout.hpp @@ -33,13 +33,13 @@ namespace QuantLib { class FdmLinearOpLayout { public: - explicit FdmLinearOpLayout(const std::vector& dim) - : dim_(dim), spacing_(dim.size()) { + explicit FdmLinearOpLayout(std::vector dim) + : dim_(std::move(dim)), spacing_(dim_.size()) { spacing_[0] = 1; - std::partial_sum(dim.begin(), dim.end()-1, + std::partial_sum(dim_.begin(), dim_.end()-1, spacing_.begin()+1, std::multiplies<>()); - size_ = spacing_.back()*dim.back(); + size_ = spacing_.back()*dim_.back(); } FdmLinearOpIterator begin() const { diff --git a/ql/methods/finitedifferences/operators/fdmlocalvolfwdop.cpp b/ql/methods/finitedifferences/operators/fdmlocalvolfwdop.cpp index 58a39c8c7eb..8865ae9606f 100644 --- a/ql/methods/finitedifferences/operators/fdmlocalvolfwdop.cpp +++ b/ql/methods/finitedifferences/operators/fdmlocalvolfwdop.cpp @@ -42,12 +42,8 @@ namespace QuantLib { const Rate r = rTS_->forwardRate(t1, t2, Continuous).rate(); const Rate q = qTS_->forwardRate(t1, t2, Continuous).rate(); - const ext::shared_ptr layout=mesher_->layout(); - const FdmLinearOpIterator endIter = layout->end(); - - Array v(layout->size()); - for (FdmLinearOpIterator iter = layout->begin(); - iter != endIter; ++iter) { + Array v(mesher_->layout()->size()); + for (const auto& iter : *mesher_->layout()) { const Size i = iter.index(); v[i] = squared(localVol_->localVol(0.5*(t1+t2), x_[i], true)); diff --git a/ql/methods/finitedifferences/operators/fdmornsteinuhlenbeckop.cpp b/ql/methods/finitedifferences/operators/fdmornsteinuhlenbeckop.cpp index c94e87224bb..21267a72782 100644 --- a/ql/methods/finitedifferences/operators/fdmornsteinuhlenbeckop.cpp +++ b/ql/methods/finitedifferences/operators/fdmornsteinuhlenbeckop.cpp @@ -39,13 +39,10 @@ namespace QuantLib { : mesher_(mesher), process_(std::move(process)), rTS_(std::move(rTS)), direction_(direction), m_(direction, mesher), mapX_(direction, mesher) { - const ext::shared_ptr layout=mesher_->layout(); - - Array drift(layout->size()); + Array drift(mesher_->layout()->size()); const Array x(mesher_->locations(direction)); - for (FdmLinearOpIterator iter=layout->begin(), endIter=layout->end(); - iter!=endIter; ++iter) { + for (const auto& iter : *mesher_->layout()) { const Size i = iter.index(); drift[i] = process_->drift(0.0, x[i]); } diff --git a/ql/methods/finitedifferences/operators/fdmsquarerootfwdop.cpp b/ql/methods/finitedifferences/operators/fdmsquarerootfwdop.cpp index 3723ced84a9..5aa68b8e4a2 100644 --- a/ql/methods/finitedifferences/operators/fdmsquarerootfwdop.cpp +++ b/ql/methods/finitedifferences/operators/fdmsquarerootfwdop.cpp @@ -65,9 +65,7 @@ namespace QuantLib { ), v_ (mesher->layout()->dim()[direction_]) { - const FdmLinearOpIterator endIter = mesher->layout()->end(); - for (FdmLinearOpIterator iter = mesher->layout()->begin(); - iter != endIter; ++iter) { + for (const auto& iter : *mesher->layout()) { const Real v = mesher->location(iter, direction_); v_[iter.coordinates()[direction_]] = v; } @@ -88,9 +86,7 @@ namespace QuantLib { const Real b = -(h(n-1)+h(n))/zeta(n); const Real c = h(n-1)/zetap(n); - const FdmLinearOpIterator endIter = mesher->layout()->end(); - for (FdmLinearOpIterator iter = mesher->layout()->begin(); - iter != endIter; ++iter) { + for (const auto& iter : *mesher->layout()) { if (iter.coordinates()[direction_] == 0) { const Size idx = iter.index(); mapX_->diag(idx) = beta + f*b; //*v(n-1); @@ -110,9 +106,7 @@ namespace QuantLib { const Real b = (h(n)+h(n-1))/zeta(n); const Real c = -h(n)/zetam(n); - const FdmLinearOpIterator endIter = mesher->layout()->end(); - for (FdmLinearOpIterator iter = mesher->layout()->begin(); - iter != endIter; ++iter) { + for (const auto& iter : *mesher->layout()) { if (iter.coordinates()[direction_] == n-1) { const Size idx = iter.index(); mapX_->diag(idx) = beta + f*b; //*v(n+1); diff --git a/ql/methods/finitedifferences/operators/firstderivativeop.cpp b/ql/methods/finitedifferences/operators/firstderivativeop.cpp index 547c13dd876..f642c8740ba 100644 --- a/ql/methods/finitedifferences/operators/firstderivativeop.cpp +++ b/ql/methods/finitedifferences/operators/firstderivativeop.cpp @@ -30,10 +30,7 @@ namespace QuantLib { const ext::shared_ptr& mesher) : TripleBandLinearOp(direction, mesher) { - const ext::shared_ptr layout = mesher->layout(); - const FdmLinearOpIterator endIter = layout->end(); - - for (FdmLinearOpIterator iter = layout->begin(); iter!=endIter; ++iter) { + for (const auto& iter : *mesher->layout()) { const Size i = iter.index(); const Real hm = mesher->dminus(iter, direction_); const Real hp = mesher->dplus(iter, direction_); @@ -48,7 +45,7 @@ namespace QuantLib { diag_[i] = -(upper_[i] = 1/hp); } else if ( iter.coordinates()[direction_] - == layout->dim()[direction]-1) { + == mesher->layout()->dim()[direction]-1) { // downwinding scheme lower_[i] = -(diag_[i] = 1/hm); upper_[i] = 0.0; diff --git a/ql/methods/finitedifferences/operators/ninepointlinearop.cpp b/ql/methods/finitedifferences/operators/ninepointlinearop.cpp index fd0dd1ef822..e4089163e8d 100644 --- a/ql/methods/finitedifferences/operators/ninepointlinearop.cpp +++ b/ql/methods/finitedifferences/operators/ninepointlinearop.cpp @@ -53,20 +53,17 @@ namespace QuantLib { && d1_ < mesher->layout()->dim().size(), "inconsistent derivative directions"); - const ext::shared_ptr layout = mesher->layout(); - const FdmLinearOpIterator endIter = layout->end(); - - for (FdmLinearOpIterator iter = layout->begin(); iter!=endIter; ++iter) { + for (const auto& iter : *mesher->layout()) { const Size i = iter.index(); - i10_[i] = layout->neighbourhood(iter, d1_, -1); - i01_[i] = layout->neighbourhood(iter, d0_, -1); - i21_[i] = layout->neighbourhood(iter, d0_, 1); - i12_[i] = layout->neighbourhood(iter, d1_, 1); - i00_[i] = layout->neighbourhood(iter, d0_, -1, d1_, -1); - i20_[i] = layout->neighbourhood(iter, d0_, 1, d1_, -1); - i02_[i] = layout->neighbourhood(iter, d0_, -1, d1_, 1); - i22_[i] = layout->neighbourhood(iter, d0_, 1, d1_, 1); + i10_[i] = mesher->layout()->neighbourhood(iter, d1_, -1); + i01_[i] = mesher->layout()->neighbourhood(iter, d0_, -1); + i21_[i] = mesher->layout()->neighbourhood(iter, d0_, 1); + i12_[i] = mesher->layout()->neighbourhood(iter, d1_, 1); + i00_[i] = mesher->layout()->neighbourhood(iter, d0_, -1, d1_, -1); + i20_[i] = mesher->layout()->neighbourhood(iter, d0_, 1, d1_, -1); + i02_[i] = mesher->layout()->neighbourhood(iter, d0_, -1, d1_, 1); + i22_[i] = mesher->layout()->neighbourhood(iter, d0_, 1, d1_, 1); } } @@ -112,9 +109,8 @@ namespace QuantLib { Array NinePointLinearOp::apply(const Array& u) const { - const ext::shared_ptr index=mesher_->layout(); - QL_REQUIRE(u.size() == index->size(),"inconsistent length of r " - << u.size() << " vs " << index->size()); + QL_REQUIRE(u.size() == mesher_->layout()->size(),"inconsistent length of r " + << u.size() << " vs " << mesher_->layout()->size()); Array retVal(u.size()); // direct access to make the following code faster. @@ -141,11 +137,10 @@ namespace QuantLib { } SparseMatrix NinePointLinearOp::toMatrix() const { - const ext::shared_ptr index = mesher_->layout(); - const Size n = index->size(); + const Size n = mesher_->layout()->size(); SparseMatrix retVal(n, n, 9*n); - for (Size i=0; i < index->size(); ++i) { + for (Size i=0; i < mesher_->layout()->size(); ++i) { retVal(i, i00_[i]) += a00_[i]; retVal(i, i01_[i]) += a01_[i]; retVal(i, i02_[i]) += a02_[i]; @@ -179,7 +174,7 @@ namespace QuantLib { return retVal; } - void NinePointLinearOp::swap(NinePointLinearOp& m) { + void NinePointLinearOp::swap(NinePointLinearOp& m) noexcept { std::swap(d0_, m.d0_); std::swap(d1_, m.d1_); @@ -190,6 +185,6 @@ namespace QuantLib { a01_.swap(m.a01_); a21_.swap(m.a21_); a02_.swap(m.a02_); a12_.swap(m.a12_); a22_.swap(m.a22_); a11_.swap(m.a11_); - std::swap(mesher_, m.mesher_); + mesher_.swap(m.mesher_); } } diff --git a/ql/methods/finitedifferences/operators/ninepointlinearop.hpp b/ql/methods/finitedifferences/operators/ninepointlinearop.hpp index 4eb24c48908..8da0ae1bbac 100644 --- a/ql/methods/finitedifferences/operators/ninepointlinearop.hpp +++ b/ql/methods/finitedifferences/operators/ninepointlinearop.hpp @@ -42,11 +42,12 @@ namespace QuantLib { NinePointLinearOp(NinePointLinearOp&& m) noexcept; NinePointLinearOp& operator=(const NinePointLinearOp& m); NinePointLinearOp& operator=(NinePointLinearOp&& m) noexcept; + ~NinePointLinearOp() override = default; Array apply(const Array& r) const override; NinePointLinearOp mult(const Array& u) const; - void swap(NinePointLinearOp& m); + void swap(NinePointLinearOp& m) noexcept; SparseMatrix toMatrix() const override; diff --git a/ql/methods/finitedifferences/operators/nthorderderivativeop.cpp b/ql/methods/finitedifferences/operators/nthorderderivativeop.cpp index 96d0083f504..6c73bd57b45 100644 --- a/ql/methods/finitedifferences/operators/nthorderderivativeop.cpp +++ b/ql/methods/finitedifferences/operators/nthorderderivativeop.cpp @@ -37,14 +37,11 @@ namespace QuantLib { const Integer hPoints = nPoints/2; const bool isEven = (nPoints == 2*hPoints); - const ext::shared_ptr layout = mesher->layout(); - const FdmLinearOpIterator endIter = layout->end(); - Array xValues = mesher->locations(direction); std::set tmp(xValues.begin(), xValues.end()); xValues = Array(tmp.begin(), tmp.end()); //unique vector - const Integer nx(layout->dim()[direction]); + const Integer nx(mesher->layout()->dim()[direction]); QL_REQUIRE(Integer(xValues.size()) == nx, "inconsistent set of grid values in direction " << direction); @@ -55,7 +52,7 @@ namespace QuantLib { Array xOffsets(nPoints); const ext::function emptyFct; - for (FdmLinearOpIterator iter = layout->begin(); iter!=endIter; ++iter) { + for (const auto& iter : *mesher->layout()) { const auto ix = Integer(iter.coordinates()[direction]); const Integer offset = std::max(0, hPoints - ix) - std::max(0, hPoints - (nx-((isEven)? 0 : 1) - ix)); @@ -72,7 +69,7 @@ namespace QuantLib { const Size i = iter.index(); for (Integer j=0; j < nPoints; ++j) { - const Size k = layout->neighbourhood(iter, direction, ilx - ix + j); + const Size k = mesher->layout()->neighbourhood(iter, direction, ilx - ix + j); m_(i, k) = weights[j]; } diff --git a/ql/methods/finitedifferences/operators/secondderivativeop.cpp b/ql/methods/finitedifferences/operators/secondderivativeop.cpp index 1f5c34e4241..66acdc1ee21 100644 --- a/ql/methods/finitedifferences/operators/secondderivativeop.cpp +++ b/ql/methods/finitedifferences/operators/secondderivativeop.cpp @@ -30,10 +30,7 @@ namespace QuantLib { const ext::shared_ptr& mesher) : TripleBandLinearOp(direction, mesher) { - const ext::shared_ptr layout = mesher->layout(); - const FdmLinearOpIterator endIter = layout->end(); - - for (FdmLinearOpIterator iter = layout->begin(); iter!=endIter; ++iter) { + for (const auto& iter : *mesher->layout()) { const Size i = iter.index(); const Real hm = mesher->dminus(iter, direction_); const Real hp = mesher->dplus(iter, direction_); @@ -43,7 +40,7 @@ namespace QuantLib { const Real zetap1 = hp*(hm+hp); const Size co = iter.coordinates()[direction_]; - if (co == 0 || co == layout->dim()[direction]-1) { + if (co == 0 || co == mesher->layout()->dim()[direction]-1) { lower_[i] = diag_[i] = upper_[i] = 0.0; } else { diff --git a/ql/methods/finitedifferences/operators/secondordermixedderivativeop.cpp b/ql/methods/finitedifferences/operators/secondordermixedderivativeop.cpp index e2628480e2d..824ae5cdb69 100644 --- a/ql/methods/finitedifferences/operators/secondordermixedderivativeop.cpp +++ b/ql/methods/finitedifferences/operators/secondordermixedderivativeop.cpp @@ -28,10 +28,7 @@ namespace QuantLib { const ext::shared_ptr& mesher) : NinePointLinearOp(d0, d1, mesher) { - const ext::shared_ptr layout = mesher->layout(); - const FdmLinearOpIterator endIter = layout->end(); - - for (FdmLinearOpIterator iter = layout->begin(); iter!=endIter; ++iter) { + for (const auto& iter : *mesher->layout()) { const Size i = iter.index(); const Real hm_d0 = mesher->dminus(iter, d0_); const Real hp_d0 = mesher->dplus(iter, d0_); @@ -52,17 +49,17 @@ namespace QuantLib { a00_[i] = a01_[i] = a02_[i] = a10_[i] = a20_[i] = 0.0; a21_[i] = a12_[i] = -(a11_[i] = a22_[i] = 1.0/(hp_d0*hp_d1)); } - else if (c0 == layout->dim()[d0_]-1 && c1 == 0) { + else if (c0 == mesher->layout()->dim()[d0_]-1 && c1 == 0) { // upper left corner a22_[i] = a21_[i] = a20_[i] = a10_[i] = a00_[i] = 0.0; a11_[i] = a02_[i] = -(a01_[i] = a12_[i] = 1.0/(hm_d0*hp_d1)); } - else if (c0 == 0 && c1 == layout->dim()[d1_]-1) { + else if (c0 == 0 && c1 == mesher->layout()->dim()[d1_]-1) { // lower right corner a00_[i] = a01_[i] = a02_[i] = a12_[i] = a22_[i] = 0.0; a20_[i] = a11_[i] = -(a10_[i] = a21_[i] = 1.0/(hp_d0*hm_d1)); } - else if (c0 == layout->dim()[d0_]-1 && c1 == layout->dim()[d1_]-1) { + else if (c0 == mesher->layout()->dim()[d0_]-1 && c1 == mesher->layout()->dim()[d1_]-1) { // upper right corner a20_[i] = a21_[i] = a22_[i] = a12_[i] = a02_[i] = 0.0; a10_[i] = a01_[i] = -(a00_[i] = a11_[i] = 1.0/(hm_d0*hm_d1)); @@ -75,7 +72,7 @@ namespace QuantLib { a11_[i] = -(a21_[i] = (hp_d1-hm_d1)/(hp_d0*phi0)); a12_[i] = -(a22_[i] = hm_d1/(hp_d0*phip1)); } - else if (c0 == layout->dim()[d0_]-1) { + else if (c0 == mesher->layout()->dim()[d0_]-1) { // upper side a20_[i] = a21_[i] = a22_[i] = 0.0; @@ -91,7 +88,7 @@ namespace QuantLib { a11_[i] = -(a12_[i] = (hp_d0-hm_d0)/(zeta0*hp_d1)); a21_[i] = -(a22_[i] = hm_d0/(zetap1*hp_d1)); } - else if (c1 == layout->dim()[d1_]-1) { + else if (c1 == mesher->layout()->dim()[d1_]-1) { // right side a22_[i] = a12_[i] = a02_[i] = 0.0; diff --git a/ql/methods/finitedifferences/operators/triplebandlinearop.cpp b/ql/methods/finitedifferences/operators/triplebandlinearop.cpp index 15879763a2e..9847e960a01 100644 --- a/ql/methods/finitedifferences/operators/triplebandlinearop.cpp +++ b/ql/methods/finitedifferences/operators/triplebandlinearop.cpp @@ -39,19 +39,16 @@ namespace QuantLib { upper_ (new Real[mesher->layout()->size()]), mesher_(mesher) { - const ext::shared_ptr layout = mesher->layout(); - const FdmLinearOpIterator endIter = layout->end(); - - std::vector newDim(layout->dim()); + std::vector newDim(mesher->layout()->dim()); std::iter_swap(newDim.begin(), newDim.begin()+direction_); std::vector newSpacing = FdmLinearOpLayout(newDim).spacing(); std::iter_swap(newSpacing.begin(), newSpacing.begin()+direction_); - for (FdmLinearOpIterator iter = layout->begin(); iter!=endIter; ++iter) { + for (const auto& iter : *mesher->layout()) { const Size i = iter.index(); - i0_[i] = layout->neighbourhood(iter, direction, -1); - i2_[i] = layout->neighbourhood(iter, direction, 1); + i0_[i] = mesher->layout()->neighbourhood(iter, direction, -1); + i2_[i] = mesher->layout()->neighbourhood(iter, direction, 1); const std::vector& coordinates = iter.coordinates(); const Size newIndex = @@ -80,8 +77,8 @@ namespace QuantLib { std::copy(m.upper_.get(), m.upper_.get() + len, upper_.get()); } - void TripleBandLinearOp::swap(TripleBandLinearOp& m) { - std::swap(mesher_, m.mesher_); + void TripleBandLinearOp::swap(TripleBandLinearOp& m) noexcept { + mesher_.swap(m.mesher_); std::swap(direction_, m.direction_); i0_.swap(m.i0_); i2_.swap(m.i2_); @@ -192,8 +189,7 @@ namespace QuantLib { } TripleBandLinearOp TripleBandLinearOp::multR(const Array& u) const { - const ext::shared_ptr layout = mesher_->layout(); - const Size size = layout->size(); + const Size size = mesher_->layout()->size(); QL_REQUIRE(u.size() == size, "inconsistent size of rhs"); TripleBandLinearOp retVal(direction_, mesher_); @@ -226,9 +222,7 @@ namespace QuantLib { } Array TripleBandLinearOp::apply(const Array& r) const { - const ext::shared_ptr index = mesher_->layout(); - - QL_REQUIRE(r.size() == index->size(), "inconsistent length of r"); + QL_REQUIRE(r.size() == mesher_->layout()->size(), "inconsistent length of r"); const Real* lptr = lower_.get(); const Real* dptr = diag_.get(); @@ -238,7 +232,7 @@ namespace QuantLib { array_type retVal(r.size()); //#pragma omp parallel for - for (Size i=0; i < index->size(); ++i) { + for (Size i=0; i < mesher_->layout()->size(); ++i) { retVal[i] = r[i0ptr[i]]*lptr[i]+r[i]*dptr[i]+r[i2ptr[i]]*uptr[i]; } @@ -246,8 +240,7 @@ namespace QuantLib { } SparseMatrix TripleBandLinearOp::toMatrix() const { - const ext::shared_ptr index = mesher_->layout(); - const Size n = index->size(); + const Size n = mesher_->layout()->size(); SparseMatrix retVal(n, n, 3*n); for (Size i=0; i < n; ++i) { @@ -261,16 +254,14 @@ namespace QuantLib { Array TripleBandLinearOp::solve_splitting(const Array& r, Real a, Real b) const { - const ext::shared_ptr layout = mesher_->layout(); - QL_REQUIRE(r.size() == layout->size(), "inconsistent size of rhs"); + QL_REQUIRE(r.size() == mesher_->layout()->size(), "inconsistent size of rhs"); #ifdef QL_EXTRA_SAFETY_CHECKS - for (FdmLinearOpIterator iter = layout->begin(); - iter!=layout->end(); ++iter) { + for (const auto& iter : *mesher_->layout()) { const std::vector& coordinates = iter.coordinates(); QL_REQUIRE( coordinates[direction_] != 0 || lower_[iter.index()] == 0,"removing non zero entry!"); - QL_REQUIRE( coordinates[direction_] != layout->dim()[direction_]-1 + QL_REQUIRE( coordinates[direction_] != mesher_->layout()->dim()[direction_]-1 || upper_[iter.index()] == 0,"removing non zero entry!"); } #endif @@ -289,7 +280,7 @@ namespace QuantLib { QL_REQUIRE(bet != 0.0, "division by zero"); retVal[reverseIndex_[0]] = r[rim1]*bet; - for (Size j=1; j<=layout->size()-1; j++){ + for (Size j=1; j<=mesher_->layout()->size()-1; j++){ const Size ri = reverseIndex_[j]; tmp[j] = a*uptr[rim1]*bet; @@ -301,7 +292,7 @@ namespace QuantLib { rim1 = ri; } // cannot be j>=0 with Size j - for (Size j=layout->size()-2; j>0; --j) + for (Size j=mesher_->layout()->size()-2; j>0; --j) retVal[reverseIndex_[j]] -= tmp[j+1]*retVal[reverseIndex_[j+1]]; retVal[reverseIndex_[0]] -= tmp[1]*retVal[reverseIndex_[1]]; diff --git a/ql/methods/finitedifferences/operators/triplebandlinearop.hpp b/ql/methods/finitedifferences/operators/triplebandlinearop.hpp index 1fbb5693a39..25def57fcb6 100644 --- a/ql/methods/finitedifferences/operators/triplebandlinearop.hpp +++ b/ql/methods/finitedifferences/operators/triplebandlinearop.hpp @@ -43,6 +43,7 @@ namespace QuantLib { TripleBandLinearOp(TripleBandLinearOp&& m) noexcept; TripleBandLinearOp& operator=(const TripleBandLinearOp& m); TripleBandLinearOp& operator=(TripleBandLinearOp&& m) noexcept; + ~TripleBandLinearOp() override = default; Array apply(const Array& r) const override; Array solve_splitting(const Array& r, Real a, Real b = 1.0) const; @@ -58,7 +59,7 @@ namespace QuantLib { void axpyb(const Array& a, const TripleBandLinearOp& x, const TripleBandLinearOp& y, const Array& b); - void swap(TripleBandLinearOp& m); + void swap(TripleBandLinearOp& m) noexcept; SparseMatrix toMatrix() const override; diff --git a/ql/methods/finitedifferences/parallelevolver.hpp b/ql/methods/finitedifferences/parallelevolver.hpp index d22741aac49..a293267df8c 100644 --- a/ql/methods/finitedifferences/parallelevolver.hpp +++ b/ql/methods/finitedifferences/parallelevolver.hpp @@ -39,11 +39,11 @@ namespace QuantLib { - //! Parallel evolver for multiple arrays - /*! \ingroup findiff */ - + /*! \deprecated Use the new finite-differences framework instead. + Deprecated in version 1.32. + */ template - class StepConditionSet { + class [[deprecated("Use the new finite-differences framework instead")]] StepConditionSet { typedef ext::shared_ptr > itemType; std::vector stepConditions_; public: @@ -70,21 +70,31 @@ namespace QuantLib { } }; + /*! \deprecated Use the new finite-differences framework instead. + Deprecated in version 1.32. + */ template - class ParallelEvolverTraits { + class [[deprecated("Use the new finite-differences framework instead")]] ParallelEvolverTraits { public: typedef std::vector array_type; typedef std::vector operator_type; typedef std::vector bc_type; typedef BoundaryConditionSet bc_set; + QL_DEPRECATED_DISABLE_WARNING typedef StepConditionSet condition_type; + QL_DEPRECATED_ENABLE_WARNING }; + /*! \deprecated Use the new finite-differences framework instead. + Deprecated in version 1.32. + */ template - class ParallelEvolver { + class [[deprecated("Use the new finite-differences framework instead")]] ParallelEvolver { public: // typedefs + QL_DEPRECATED_DISABLE_WARNING typedef ParallelEvolverTraits traits; + QL_DEPRECATED_ENABLE_WARNING typedef typename traits::operator_type operator_type; typedef typename traits::array_type array_type; typedef typename traits::bc_set bc_set; diff --git a/ql/methods/finitedifferences/pdeshortrate.hpp b/ql/methods/finitedifferences/pdeshortrate.hpp index f94e6dfdcf7..5ccc4745c7a 100644 --- a/ql/methods/finitedifferences/pdeshortrate.hpp +++ b/ql/methods/finitedifferences/pdeshortrate.hpp @@ -17,40 +17,11 @@ FOR A PARTICULAR PURPOSE. See the license for more details. */ -/*! \file pdeshortrate.hpp - \brief adapter to short rate -*/ - #ifndef quantlib_pdeshortrate_hpp #define quantlib_pdeshortrate_hpp -#include -#include -#include -#include - -namespace QuantLib { - - /*! \deprecated Use the new finite-differences framework instead. - Deprecated in version 1.27. - */ - class QL_DEPRECATED PdeShortRate : public PdeSecondOrderParabolic { - public: - typedef ext::shared_ptr - argument_type; - typedef TransformedGrid grid_type; - PdeShortRate(argument_type d) : dynamics_(std::move(d)) {} - Real diffusion(Time t, Real x) const override { - return dynamics_->process()->diffusion(t, x); - } - Real drift(Time t, Real x) const override { return dynamics_->process()->drift(t, x); } - Real discount(Time t, Real x) const override { return dynamics_->shortRate(t, x); } - - private: - const argument_type dynamics_; - }; - -} +// Deprecated in version 1.32 +#pragma message("Warning: this file is empty and will disappear in a future release; do not include it.") #endif diff --git a/ql/methods/finitedifferences/shoutcondition.hpp b/ql/methods/finitedifferences/shoutcondition.hpp index 0b5d0420246..28f16eaa156 100644 --- a/ql/methods/finitedifferences/shoutcondition.hpp +++ b/ql/methods/finitedifferences/shoutcondition.hpp @@ -18,69 +18,11 @@ FOR A PARTICULAR PURPOSE. See the license for more details. */ -/*! \file shoutcondition.hpp - \brief shout option exercise condition -*/ - #ifndef quantlib_fd_shout_condition_hpp #define quantlib_fd_shout_condition_hpp -#include -#include -#include -#include - -namespace QuantLib { - - //! Shout option condition - /*! \deprecated Use the new finite-differences framework instead. - Deprecated in version 1.27. - */ - class QL_DEPRECATED ShoutCondition : public StandardStepCondition { - public: - ShoutCondition(const Array& intrinsicValues, - Time resTime, - Rate rate) - : resTime_(resTime), rate_(rate), - impl_(new ArrayImpl(intrinsicValues)) {} - - void applyTo(Array& a, Time t) const override { - DiscountFactor B = std::exp(-rate_ * (t - resTime_)); - //#pragma omp parallel for - for (Size i = 0; i < a.size(); i++) { - a[i] = std::max(a[i], B * impl_->getValue(a, i)); - } - } - - private: - Time resTime_; - Rate rate_; - - // This part should be removed and the array-based implementation - // inlined once the payoff-based constructor is removed. - - class Impl; - - ext::shared_ptr impl_; - - class Impl { - public: - virtual ~Impl() = default; - virtual Real getValue(const Array &a, - int i) = 0; - }; - - class ArrayImpl : public Impl { - private: - Array intrinsicValues_; - public: - explicit ArrayImpl(Array a) : intrinsicValues_(std::move(a)) {} - - Real getValue(const Array&, int i) override { return intrinsicValues_[i]; } - }; - }; - -} +// Deprecated in version 1.32 +#pragma message("Warning: this file is empty and will disappear in a future release; do not include it.") #endif diff --git a/ql/methods/finitedifferences/solvers/fdm1dimsolver.cpp b/ql/methods/finitedifferences/solvers/fdm1dimsolver.cpp index a0f4577ddc9..be2e9748ef6 100644 --- a/ql/methods/finitedifferences/solvers/fdm1dimsolver.cpp +++ b/ql/methods/finitedifferences/solvers/fdm1dimsolver.cpp @@ -42,16 +42,11 @@ namespace QuantLib { x_(solverDesc.mesher->layout()->size()), initialValues_(solverDesc.mesher->layout()->size()), resultValues_(solverDesc.mesher->layout()->size()) { - const ext::shared_ptr mesher = solverDesc.mesher; - const ext::shared_ptr layout = mesher->layout(); - - const FdmLinearOpIterator endIter = layout->end(); - for (FdmLinearOpIterator iter = layout->begin(); iter != endIter; - ++iter) { + for (const auto& iter : *solverDesc.mesher->layout()) { initialValues_[iter.index()] = solverDesc_.calculator->avgInnerValue(iter, solverDesc.maturity); - x_[iter.index()] = mesher->location(iter, 0); + x_[iter.index()] = solverDesc.mesher->location(iter, 0); } } diff --git a/ql/methods/finitedifferences/solvers/fdm2dimsolver.cpp b/ql/methods/finitedifferences/solvers/fdm2dimsolver.cpp index 3efc99b69ec..85370fc6f59 100644 --- a/ql/methods/finitedifferences/solvers/fdm2dimsolver.cpp +++ b/ql/methods/finitedifferences/solvers/fdm2dimsolver.cpp @@ -42,24 +42,19 @@ namespace QuantLib { initialValues_(solverDesc.mesher->layout()->size()), resultValues_(solverDesc.mesher->layout()->dim()[1], solverDesc.mesher->layout()->dim()[0]) { - const ext::shared_ptr mesher = solverDesc.mesher; - const ext::shared_ptr layout = mesher->layout(); + x_.reserve(solverDesc.mesher->layout()->dim()[0]); + y_.reserve(solverDesc.mesher->layout()->dim()[1]); - x_.reserve(layout->dim()[0]); - y_.reserve(layout->dim()[1]); - - const FdmLinearOpIterator endIter = layout->end(); - for (FdmLinearOpIterator iter = layout->begin(); iter != endIter; - ++iter) { + for (const auto& iter : *solverDesc.mesher->layout()) { initialValues_[iter.index()] = solverDesc_.calculator->avgInnerValue(iter, solverDesc.maturity); if (iter.coordinates()[1] == 0U) { - x_.push_back(mesher->location(iter, 0)); + x_.push_back(solverDesc.mesher->location(iter, 0)); } if (iter.coordinates()[0] == 0U) { - y_.push_back(mesher->location(iter, 1)); + y_.push_back(solverDesc.mesher->location(iter, 1)); } } } diff --git a/ql/methods/finitedifferences/solvers/fdm3dimsolver.cpp b/ql/methods/finitedifferences/solvers/fdm3dimsolver.cpp index 7437e0ba95a..f2a70b58890 100644 --- a/ql/methods/finitedifferences/solvers/fdm3dimsolver.cpp +++ b/ql/methods/finitedifferences/solvers/fdm3dimsolver.cpp @@ -46,29 +46,24 @@ namespace QuantLib { Matrix(solverDesc.mesher->layout()->dim()[1], solverDesc.mesher->layout()->dim()[0])), interpolation_(solverDesc.mesher->layout()->dim()[2]) { - const ext::shared_ptr mesher = solverDesc.mesher; - const ext::shared_ptr layout = mesher->layout(); + x_.reserve(solverDesc.mesher->layout()->dim()[0]); + y_.reserve(solverDesc.mesher->layout()->dim()[1]); + z_.reserve(solverDesc.mesher->layout()->dim()[2]); - x_.reserve(layout->dim()[0]); - y_.reserve(layout->dim()[1]); - z_.reserve(layout->dim()[2]); - - const FdmLinearOpIterator endIter = layout->end(); - for (FdmLinearOpIterator iter = layout->begin(); iter != endIter; - ++iter) { + for (const auto& iter : *solverDesc.mesher->layout()) { initialValues_[iter.index()] = solverDesc.calculator->avgInnerValue(iter, solverDesc.maturity); if ((iter.coordinates()[1] == 0U) && (iter.coordinates()[2] == 0U)) { - x_.push_back(mesher->location(iter, 0)); + x_.push_back(solverDesc.mesher->location(iter, 0)); } if ((iter.coordinates()[0] == 0U) && (iter.coordinates()[2] == 0U)) { - y_.push_back(mesher->location(iter, 1)); + y_.push_back(solverDesc.mesher->location(iter, 1)); } if ((iter.coordinates()[0] == 0U) && (iter.coordinates()[1] == 0U)) { - z_.push_back(mesher->location(iter, 2)); + z_.push_back(solverDesc.mesher->location(iter, 2)); } } } diff --git a/ql/methods/finitedifferences/solvers/fdmndimsolver.hpp b/ql/methods/finitedifferences/solvers/fdmndimsolver.hpp index dfec376dca5..7d5db0c8279 100644 --- a/ql/methods/finitedifferences/solvers/fdmndimsolver.hpp +++ b/ql/methods/finitedifferences/solvers/fdmndimsolver.hpp @@ -87,27 +87,21 @@ namespace QuantLib { initialValues_(solverDesc.mesher->layout()->size()), extrapolation_(std::vector(N, false)) { - const ext::shared_ptr mesher = solverDesc.mesher; - const ext::shared_ptr layout = mesher->layout(); - - QL_REQUIRE(layout->dim().size() == N, "solver dim " << N - << "does not fit to layout dim " << layout->size()); + QL_REQUIRE(solverDesc.mesher->layout()->dim().size() == N, "solver dim " << N + << "does not fit to layout dim " << solverDesc.mesher->layout()->size()); for (Size i=0; i < N; ++i) { - x_[i].reserve(layout->dim()[i]); + x_[i].reserve(solverDesc.mesher->layout()->dim()[i]); } - const FdmLinearOpIterator endIter = layout->end(); - for (FdmLinearOpIterator iter = layout->begin(); iter != endIter; - ++iter) { - + for (const auto& iter : *solverDesc.mesher->layout()) { initialValues_[iter.index()] = solverDesc_.calculator ->avgInnerValue(iter, solverDesc.maturity); const std::vector& c = iter.coordinates(); for (Size i=0; i < N; ++i) { if ((std::accumulate(c.begin(), c.end(), 0UL) - c[i]) == 0U) { - x_[i].push_back(mesher->location(iter, i)); + x_[i].push_back(solverDesc.mesher->location(iter, i)); } } } @@ -125,12 +119,7 @@ namespace QuantLib { .rollback(rhs, solverDesc_.maturity, 0.0, solverDesc_.timeSteps, solverDesc_.dampingSteps); - const ext::shared_ptr layout - = solverDesc_.mesher->layout(); - - const FdmLinearOpIterator endIter = layout->end(); - for (FdmLinearOpIterator iter = layout->begin(); iter != endIter; - ++iter) { + for (const auto& iter : *solverDesc_.mesher->layout()) { setValue(*f_, iter.coordinates(), rhs[iter.index()]); } @@ -146,14 +135,10 @@ namespace QuantLib { calculate(); const Array& rhs = thetaCondition_->getValues(); - const ext::shared_ptr layout - = solverDesc_.mesher->layout(); data_table f(x_); - const FdmLinearOpIterator endIter = layout->end(); - for (FdmLinearOpIterator iter = layout->begin(); iter != endIter; - ++iter) { + for (const auto& iter : *solverDesc_.mesher->layout()) { setValue(f, iter.coordinates(), rhs[iter.index()]); } diff --git a/ql/methods/finitedifferences/stepconditions/fdmamericanstepcondition.cpp b/ql/methods/finitedifferences/stepconditions/fdmamericanstepcondition.cpp index e3e0f0b082e..a9e35d25203 100644 --- a/ql/methods/finitedifferences/stepconditions/fdmamericanstepcondition.cpp +++ b/ql/methods/finitedifferences/stepconditions/fdmamericanstepcondition.cpp @@ -30,15 +30,10 @@ namespace QuantLib { : mesher_(std::move(mesher)), calculator_(std::move(calculator)) {} void FdmAmericanStepCondition::applyTo(Array& a, Time t) const { - ext::shared_ptr layout = mesher_->layout(); - - QL_REQUIRE(layout->size() == a.size(), + QL_REQUIRE(mesher_->layout()->size() == a.size(), "inconsistent array dimensions"); - const FdmLinearOpIterator endIter = layout->end(); - - for (FdmLinearOpIterator iter = layout->begin(); iter != endIter; - ++iter) { + for (const auto& iter : *mesher_->layout()) { const Real innerValue = calculator_->innerValue(iter, t); if (innerValue > a[iter.index()]) { a[iter.index()] = innerValue; diff --git a/ql/methods/finitedifferences/stepconditions/fdmbermudanstepcondition.cpp b/ql/methods/finitedifferences/stepconditions/fdmbermudanstepcondition.cpp index 4006fae75e2..a0f66ffca9f 100644 --- a/ql/methods/finitedifferences/stepconditions/fdmbermudanstepcondition.cpp +++ b/ql/methods/finitedifferences/stepconditions/fdmbermudanstepcondition.cpp @@ -46,18 +46,13 @@ namespace QuantLib { if (std::find(exerciseTimes_.begin(), exerciseTimes_.end(), t) != exerciseTimes_.end()) { - ext::shared_ptr layout = mesher_->layout(); - - QL_REQUIRE(layout->size() == a.size(), + QL_REQUIRE(mesher_->layout()->size() == a.size(), "inconsistent array dimensions"); - const FdmLinearOpIterator endIter = layout->end(); - - const Size dims = layout->dim().size(); + const Size dims = mesher_->layout()->dim().size(); Array locations(dims); - for (FdmLinearOpIterator iter = layout->begin(); iter != endIter; - ++iter) { + for (const auto& iter : *mesher_->layout()) { for (Size i=0; i < dims; ++i) locations[i] = mesher_->location(iter, i); diff --git a/ql/methods/finitedifferences/stepconditions/fdmsimplestoragecondition.cpp b/ql/methods/finitedifferences/stepconditions/fdmsimplestoragecondition.cpp index 1a4b37f19bc..0e80b7b8c20 100644 --- a/ql/methods/finitedifferences/stepconditions/fdmsimplestoragecondition.cpp +++ b/ql/methods/finitedifferences/stepconditions/fdmsimplestoragecondition.cpp @@ -33,14 +33,10 @@ namespace QuantLib { : exerciseTimes_(std::move(exerciseTimes)), mesher_(std::move(mesher)), calculator_(std::move(calculator)), changeRate_(changeRate) { - const ext::shared_ptr layout = mesher_->layout(); + x_.reserve(mesher_->layout()->dim()[0]); + y_.reserve(mesher_->layout()->dim()[1]); - x_.reserve(layout->dim()[0]); - y_.reserve(layout->dim()[1]); - - const FdmLinearOpIterator endIter = layout->end(); - for (FdmLinearOpIterator iter = layout->begin(); iter != endIter; - ++iter) { + for (const auto& iter : *mesher_->layout()) { if (iter.coordinates()[1] == 0U) { x_.push_back(mesher_->location(iter, 0)); } @@ -62,16 +58,10 @@ namespace QuantLib { BilinearInterpolation interpl(x_.begin(), x_.end(), y_.begin(), y_.end(), m); - const ext::shared_ptr layout=mesher_->layout(); - - QL_REQUIRE(layout->size() == a.size(), + QL_REQUIRE(mesher_->layout()->size() == a.size(), "inconsistent array dimensions"); - const FdmLinearOpIterator endIter = layout->end(); - - for (FdmLinearOpIterator iter = layout->begin(); iter != endIter; - ++iter) { - + for (const auto& iter : *mesher_->layout()) { const std::vector& coor = iter.coordinates(); const Real x = x_[coor[0]]; const Real y = y_[coor[1]]; diff --git a/ql/methods/finitedifferences/stepconditions/fdmsimpleswingcondition.cpp b/ql/methods/finitedifferences/stepconditions/fdmsimpleswingcondition.cpp index 7010ced29b4..d2487418c54 100644 --- a/ql/methods/finitedifferences/stepconditions/fdmsimpleswingcondition.cpp +++ b/ql/methods/finitedifferences/stepconditions/fdmsimpleswingcondition.cpp @@ -44,15 +44,10 @@ namespace QuantLib { const Size d = std::distance(iter, exerciseTimes_.end()); - const ext::shared_ptr layout=mesher_->layout(); - - QL_REQUIRE(layout->size() == a.size(), + QL_REQUIRE(mesher_->layout()->size() == a.size(), "inconsistent array dimensions"); - const FdmLinearOpIterator endIter = layout->end(); - - for (FdmLinearOpIterator iter = layout->begin(); iter != endIter; - ++iter) { + for (const auto& iter : *mesher_->layout()) { const std::vector& coor = iter.coordinates(); @@ -62,7 +57,7 @@ namespace QuantLib { const Real cashflow = calculator_->innerValue(iter, t); const Real currentValue = a[iter.index()]; const Real valuePlusOneExercise - = a[layout->neighbourhood(iter, swingDirection_, 1)]; + = a[mesher_->layout()->neighbourhood(iter, swingDirection_, 1)]; if ( currentValue < valuePlusOneExercise + cashflow || exercisesUsed + d <= minExercises_) { diff --git a/ql/methods/finitedifferences/tridiagonaloperator.hpp b/ql/methods/finitedifferences/tridiagonaloperator.hpp index f69154b79c1..36d44267d1b 100644 --- a/ql/methods/finitedifferences/tridiagonaloperator.hpp +++ b/ql/methods/finitedifferences/tridiagonaloperator.hpp @@ -65,6 +65,7 @@ namespace QuantLib { TridiagonalOperator(TridiagonalOperator&&) noexcept; TridiagonalOperator& operator=(const TridiagonalOperator&); TridiagonalOperator& operator=(TridiagonalOperator&&) noexcept; + ~TridiagonalOperator() = default; //! \name Operator interface //@{ //! apply operator to a given array @@ -101,7 +102,7 @@ namespace QuantLib { //@} //! \name Utilities //@{ - void swap(TridiagonalOperator&); + void swap(TridiagonalOperator&) noexcept; //@} //! encapsulation of time-setting logic class TimeSetter { @@ -118,7 +119,7 @@ namespace QuantLib { }; /* \relates TridiagonalOperator */ - void swap(TridiagonalOperator&, TridiagonalOperator&); + void swap(TridiagonalOperator&, TridiagonalOperator&) noexcept; // inline definitions @@ -178,14 +179,13 @@ namespace QuantLib { timeSetter_->setTime(t, *this); } - inline void TridiagonalOperator::swap(TridiagonalOperator& from) { - using std::swap; - swap(n_, from.n_); + inline void TridiagonalOperator::swap(TridiagonalOperator& from) noexcept { + std::swap(n_, from.n_); diagonal_.swap(from.diagonal_); lowerDiagonal_.swap(from.lowerDiagonal_); upperDiagonal_.swap(from.upperDiagonal_); temp_.swap(from.temp_); - swap(timeSetter_, from.timeSetter_); + timeSetter_.swap(from.timeSetter_); } @@ -250,7 +250,7 @@ namespace QuantLib { } inline void swap(TridiagonalOperator& L1, - TridiagonalOperator& L2) { + TridiagonalOperator& L2) noexcept { L1.swap(L2); } diff --git a/ql/methods/finitedifferences/utilities/fdmhestongreensfct.cpp b/ql/methods/finitedifferences/utilities/fdmhestongreensfct.cpp index 89a2fec81ce..9ee7ec4502f 100644 --- a/ql/methods/finitedifferences/utilities/fdmhestongreensfct.cpp +++ b/ql/methods/finitedifferences/utilities/fdmhestongreensfct.cpp @@ -52,12 +52,8 @@ namespace QuantLib { const Real kappa = process_->kappa(); const Real sigma = process_->sigma(); - const ext::shared_ptr layout = mesher_->layout(); - const FdmLinearOpIterator endIter = layout->end(); - Array p(mesher_->layout()->size()); - for (FdmLinearOpIterator iter = layout->begin(); iter != endIter; - ++iter) { + for (const auto& iter : *mesher_->layout()) { const Real x = mesher_->location(iter, 0); const Real v = (trafoType_ != FdmSquareRootFwdOp::Log) ? mesher_->location(iter, 1) diff --git a/ql/methods/finitedifferences/utilities/fdmindicesonboundary.cpp b/ql/methods/finitedifferences/utilities/fdmindicesonboundary.cpp index dc23f61742e..5e165a31ebb 100644 --- a/ql/methods/finitedifferences/utilities/fdmindicesonboundary.cpp +++ b/ql/methods/finitedifferences/utilities/fdmindicesonboundary.cpp @@ -35,9 +35,7 @@ namespace QuantLib { indices_.resize(hyperSize); Size i=0; - const FdmLinearOpIterator endIter = layout->end(); - for (FdmLinearOpIterator iter = layout->begin(); iter != endIter; - ++iter) { + for (const auto& iter : *layout) { if ( ( side == FdmDirichletBoundary::Lower && iter.coordinates()[direction] == 0) || ( side == FdmDirichletBoundary::Upper diff --git a/ql/methods/finitedifferences/utilities/fdminnervaluecalculator.cpp b/ql/methods/finitedifferences/utilities/fdminnervaluecalculator.cpp index b3394054917..1e78bbf9dff 100644 --- a/ql/methods/finitedifferences/utilities/fdminnervaluecalculator.cpp +++ b/ql/methods/finitedifferences/utilities/fdminnervaluecalculator.cpp @@ -66,10 +66,7 @@ namespace QuantLib { avgInnerValues_.resize(mesher_->layout()->dim()[direction_]); std::deque initialized(avgInnerValues_.size(), false); - const ext::shared_ptr layout = - mesher_->layout(); - const FdmLinearOpIterator endIter = layout->end(); - for (FdmLinearOpIterator i = layout->begin(); i != endIter; ++i) { + for (const auto& i : *mesher_->layout()) { const Size xn = i.coordinates()[direction_]; if (!initialized[xn]) { initialized[xn] = true; diff --git a/ql/methods/finitedifferences/utilities/fdmtimedepdirichletboundary.cpp b/ql/methods/finitedifferences/utilities/fdmtimedepdirichletboundary.cpp index c878e5b750f..4f10025df8f 100644 --- a/ql/methods/finitedifferences/utilities/fdmtimedepdirichletboundary.cpp +++ b/ql/methods/finitedifferences/utilities/fdmtimedepdirichletboundary.cpp @@ -47,9 +47,9 @@ namespace QuantLib { valuesOnBoundary_(std::move(valuesOnBoundary)), values_(indices_.size()) {} void FdmTimeDepDirichletBoundary::setTime(Time t) { - if (!(valueOnBoundary_ == QL_NULL_FUNCTION)) { + if (valueOnBoundary_) { std::fill(values_.begin(), values_.end(), valueOnBoundary_(t)); - } else if (!(valuesOnBoundary_ == QL_NULL_FUNCTION)) { + } else if (valuesOnBoundary_) { values_ = valuesOnBoundary_(t); } else { QL_FAIL("no boundary values defined"); diff --git a/ql/methods/finitedifferences/utilities/gbsmrndcalculator.cpp b/ql/methods/finitedifferences/utilities/gbsmrndcalculator.cpp index 58383ee727d..d56504007f5 100644 --- a/ql/methods/finitedifferences/utilities/gbsmrndcalculator.cpp +++ b/ql/methods/finitedifferences/utilities/gbsmrndcalculator.cpp @@ -96,7 +96,7 @@ namespace QuantLib { << cdf(lower, t) << ", " << cdf(upper, t) << ")"); return Brent().solve( - [&](Real _k){ return cdf(_k, t) - q; }, + [&](Real _k) -> Real { return cdf(_k, t) - q; }, 1e-10, 0.5*(lower+upper), lower, upper); } } diff --git a/ql/methods/finitedifferences/utilities/riskneutraldensitycalculator.cpp b/ql/methods/finitedifferences/utilities/riskneutraldensitycalculator.cpp index c3816dca47a..7d426c16e48 100644 --- a/ql/methods/finitedifferences/utilities/riskneutraldensitycalculator.cpp +++ b/ql/methods/finitedifferences/utilities/riskneutraldensitycalculator.cpp @@ -36,7 +36,7 @@ namespace QuantLib { Real RiskNeutralDensityCalculator::InvCDFHelper::inverseCDF(Real p, Time t) const { Brent solver; solver.setMaxEvaluations(maxEvaluations_); - return solver.solve([&](Real _x){ return calculator_->cdf(_x, t) - p; }, + return solver.solve([&](Real _x) -> Real { return calculator_->cdf(_x, t) - p; }, accuracy_, guess_, stepSize_); } diff --git a/ql/methods/montecarlo/lsmbasissystem.hpp b/ql/methods/montecarlo/lsmbasissystem.hpp index daa2fb697e1..66e5a010cbb 100644 --- a/ql/methods/montecarlo/lsmbasissystem.hpp +++ b/ql/methods/montecarlo/lsmbasissystem.hpp @@ -41,12 +41,6 @@ namespace QuantLib { Legendre, Chebyshev, Chebyshev2nd }; - /*! \deprecated Renamed to PolynomialType. - Deprecated in version 1.26. - */ - QL_DEPRECATED - typedef PolynomialType PolynomType; - static std::vector > pathBasisSystem(Size order, PolynomialType type); diff --git a/ql/models/equity/gjrgarchmodel.cpp b/ql/models/equity/gjrgarchmodel.cpp index 5aaa93f3041..5abf9c1ef8d 100644 --- a/ql/models/equity/gjrgarchmodel.cpp +++ b/ql/models/equity/gjrgarchmodel.cpp @@ -24,7 +24,7 @@ namespace QuantLib { class GJRGARCHModel::VolatilityConstraint : public Constraint { private: - class Impl : public Constraint::Impl { + class Impl final : public Constraint::Impl { public: bool test(const Array& params) const override { const Real beta = params[2]; diff --git a/ql/models/equity/hestonmodel.hpp b/ql/models/equity/hestonmodel.hpp index d31e86a320f..97502882641 100644 --- a/ql/models/equity/hestonmodel.hpp +++ b/ql/models/equity/hestonmodel.hpp @@ -65,7 +65,7 @@ namespace QuantLib { class HestonModel::FellerConstraint : public Constraint { private: - class Impl : public Constraint::Impl { + class Impl final : public Constraint::Impl { public: bool test(const Array& params) const override { const Real theta = params[0]; diff --git a/ql/models/equity/hestonslvfdmmodel.cpp b/ql/models/equity/hestonslvfdmmodel.cpp index 1dc78f83cd9..47ffa8fa889 100644 --- a/ql/models/equity/hestonslvfdmmodel.cpp +++ b/ql/models/equity/hestonslvfdmmodel.cpp @@ -81,9 +81,9 @@ namespace QuantLib { const Real v0Center = std::log(v0); cPoints = { - {lowerBound, lowerBoundDensity, false}, - {v0Center, v0Density, true}, - {upperBound, upperBoundDensity, false} + ext::make_tuple(lowerBound, lowerBoundDensity, false), + ext::make_tuple(v0Center, v0Density, true), + ext::make_tuple(upperBound, upperBoundDensity, false) }; return ext::make_shared( @@ -95,9 +95,9 @@ namespace QuantLib { const Real v0Center = v0; cPoints = { - {lowerBound, lowerBoundDensity, false}, - {v0Center, v0Density, true}, - {upperBound, upperBoundDensity, false} + ext::make_tuple(lowerBound, lowerBoundDensity, false), + ext::make_tuple(v0Center, v0Density, true), + ext::make_tuple(upperBound, upperBoundDensity, false) }; return ext::make_shared( @@ -109,9 +109,9 @@ namespace QuantLib { const Real v0Center = v0; cPoints = { - {lowerBound, lowerBoundDensity, false}, - {v0Center, v0Density, true}, - {upperBound, upperBoundDensity, false} + ext::make_tuple(lowerBound, lowerBoundDensity, false), + ext::make_tuple(v0Center, v0Density, true), + ext::make_tuple(upperBound, upperBoundDensity, false) }; return ext::make_shared( @@ -134,9 +134,7 @@ namespace QuantLib { } else { Array tp(p.size()); - const FdmLinearOpIterator end = mesher->layout()->end(); - for (FdmLinearOpIterator iter = mesher->layout()->begin(); - iter != end; ++iter) { + for (const auto& iter : *mesher->layout()) { const Size idx = iter.index(); const Real nu = mesher->location(iter, 1); @@ -165,16 +163,11 @@ namespace QuantLib { const ext::shared_ptr& newMesher, const Interpolator& interp = Interpolator()) { - const ext::shared_ptr oldLayout - = oldMesher->layout(); - const ext::shared_ptr newLayout - = newMesher->layout(); - - QL_REQUIRE( oldLayout->size() == newLayout->size() - && oldLayout->size() == p.size(), + QL_REQUIRE( oldMesher->layout()->size() == newMesher->layout()->size() + && oldMesher->layout()->size() == p.size(), "inconsistent mesher or vector size given"); - Matrix m(oldLayout->dim()[1], oldLayout->dim()[0]); + Matrix m(oldMesher->layout()->dim()[1], oldMesher->layout()->dim()[0]); for (Size i=0; i < m.rows(); ++i) { std::copy(p.begin() + i*m.columns(), p.begin() + (i+1)*m.columns(), m.row_begin(i)); @@ -186,9 +179,7 @@ namespace QuantLib { oldMesher->getFdm1dMeshers()[1]->locations().end(), m); Array pNew(p.size()); - const FdmLinearOpIterator endIter = newLayout->end(); - for (FdmLinearOpIterator iter = newLayout->begin(); - iter != endIter; ++iter) { + for (const auto& iter : *newMesher->layout()) { const Real x = newMesher->location(iter, 0); const Real v = newMesher->location(iter, 1); diff --git a/ql/models/marketmodels/Makefile.am b/ql/models/marketmodels/Makefile.am index f8b49654e6a..701c5075664 100644 --- a/ql/models/marketmodels/Makefile.am +++ b/ql/models/marketmodels/Makefile.am @@ -80,7 +80,7 @@ all.hpp: Makefile.am echo "/* This file is automatically generated; do not edit. */" > ${srcdir}/$@ echo "/* Add the files to be included into Makefile.am instead. */" >> ${srcdir}/$@ echo >> ${srcdir}/$@ - for i in $(filter-out all.hpp, $(this_include_HEADERS)); do \ + for i in $(filter-out all.hpp duffsdeviceinnerproduct.hpp, $(this_include_HEADERS)); do \ echo "#include <${subdir}/$$i>" >> ${srcdir}/$@; \ done echo >> ${srcdir}/$@ diff --git a/ql/models/marketmodels/all.hpp b/ql/models/marketmodels/all.hpp index b265d4bfbb7..ede3ba0c6d1 100644 --- a/ql/models/marketmodels/all.hpp +++ b/ql/models/marketmodels/all.hpp @@ -6,7 +6,6 @@ #include #include #include -#include #include #include #include diff --git a/ql/models/marketmodels/duffsdeviceinnerproduct.hpp b/ql/models/marketmodels/duffsdeviceinnerproduct.hpp index 6f0ca7f49e5..90325dc6aa3 100644 --- a/ql/models/marketmodels/duffsdeviceinnerproduct.hpp +++ b/ql/models/marketmodels/duffsdeviceinnerproduct.hpp @@ -21,76 +21,8 @@ #ifndef quantlib_duffs_device_inner_product_hpp #define quantlib_duffs_device_inner_product_hpp -#include -#include +// Deprecated in version 1.32 +#pragma message("Warning: this file is empty and will disappear in a future release; do not include it.") -namespace QuantLib { - - namespace dsd { - - //! inner_product implementation using Duff's device - /*! See http://www.lysator.liu.se/c/duffs-device.html - and http://en.wikipedia.org/wiki/Duff's_device - - \todo investigate the possible advantages of using - boost implementation, see: - - - - - - \deprecated To be removed as unused. - Copy it in your codebase if you need it. - Deprecated in version 1.27. - - */ - template - QL_DEPRECATED - inline T inner_product(InputIterator1 f1, InputIterator1 l1, - InputIterator2 f2, T init) { - - switch ((l1-f1) % 8) { - case 0: while (f1 != l1) { init = init + *f1 * *f2; ++f1; ++f2; - case 7: init = init + *f1 * *f2; ++f1; ++f2; - case 6: init = init + *f1 * *f2; ++f1; ++f2; - case 5: init = init + *f1 * *f2; ++f1; ++f2; - case 4: init = init + *f1 * *f2; ++f1; ++f2; - case 3: init = init + *f1 * *f2; ++f1; ++f2; - case 2: init = init + *f1 * *f2; ++f1; ++f2; - case 1: init = init + *f1 * *f2; ++f1; ++f2; - } - } - - // slightly different implementation - //switch ( (l1-f1) % 8 ) while ( f1 != l1 ) { - //case 8: init = init + *f1 * *f2; ++f1; ++f2; - //case 7: init = init + *f1 * *f2; ++f1; ++f2; - //case 6: init = init + *f1 * *f2; ++f1; ++f2; - //case 5: init = init + *f1 * *f2; ++f1; ++f2; - //case 4: init = init + *f1 * *f2; ++f1; ++f2; - //case 3: init = init + *f1 * *f2; ++f1; ++f2; - //case 2: init = init + *f1 * *f2; ++f1; ++f2; - //case 1: init = init + *f1 * *f2; ++f1; ++f2; - //case 0: ; - //} - - // the following implementation crashes (probably when l1==f1) - //switch ((l1-f1) % 8) { - //case 0: do { init = init + *f1 * *f2; ++f1; ++f2; - //case 7: init = init + *f1 * *f2; ++f1; ++f2; - //case 6: init = init + *f1 * *f2; ++f1; ++f2; - //case 5: init = init + *f1 * *f2; ++f1; ++f2; - //case 4: init = init + *f1 * *f2; ++f1; ++f2; - //case 3: init = init + *f1 * *f2; ++f1; ++f2; - //case 2: init = init + *f1 * *f2; ++f1; ++f2; - //case 1: init = init + *f1 * *f2; ++f1; ++f2; - // } while (f1 != l1); - //} - - return init; - } - - } -} #endif diff --git a/ql/models/model.hpp b/ql/models/model.hpp index 8c05e777f45..4aa7e9f87f7 100644 --- a/ql/models/model.hpp +++ b/ql/models/model.hpp @@ -163,7 +163,7 @@ namespace QuantLib { class CalibratedModel::PrivateConstraint : public Constraint { private: - class Impl : public Constraint::Impl { + class Impl final : public Constraint::Impl { public: explicit Impl(const std::vector& arguments) : arguments_(arguments) {} diff --git a/ql/models/parameter.hpp b/ql/models/parameter.hpp index 6b8c07f10fc..ac126f86044 100644 --- a/ql/models/parameter.hpp +++ b/ql/models/parameter.hpp @@ -70,7 +70,7 @@ namespace QuantLib { //! Standard constant parameter \f$ a(t) = a \f$ class ConstantParameter : public Parameter { private: - class Impl : public Parameter::Impl { + class Impl final : public Parameter::Impl { public: Real value(const Array& params, Time) const override { return params[0]; } }; @@ -98,7 +98,7 @@ namespace QuantLib { //! %Parameter which is always zero \f$ a(t) = 0 \f$ class NullParameter : public Parameter { private: - class Impl : public Parameter::Impl { + class Impl final : public Parameter::Impl { public: Real value(const Array&, Time) const override { return 0.0; } }; @@ -118,7 +118,7 @@ namespace QuantLib { */ class PiecewiseConstantParameter : public Parameter { private: - class Impl : public Parameter::Impl { + class Impl final : public Parameter::Impl { public: explicit Impl(std::vector