Logo
Fully annotated reference manual - version 1.8.12
Loading...
Searching...
No Matches
transitionmatrix.hpp
Go to the documentation of this file.
1/*
2 Copyright (C) 2017 Quaternion Risk Management Ltd
3 All rights reserved.
4
5 This file is part of ORE, a free-software/open-source library
6 for transparent pricing and risk analysis - http://opensourcerisk.org
7
8 ORE is free software: you can redistribute it and/or modify it
9 under the terms of the Modified BSD License. You should have received a
10 copy of the license along with this program.
11 The license is also available online at <http://opensourcerisk.org>
12
13 This program is distributed on the basis that it will form a useful
14 contribution to risk analytics and model standardisation, but WITHOUT
15 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
16 FITNESS FOR A PARTICULAR PURPOSE. See the license for more details.
17*/
18
19/*! \file models/transitionmatrix.hpp
20 \brief utility functions for transition matrices and generators
21 \ingroup models
22*/
23
24#pragma once
25
26#include <ql/math/matrix.hpp>
27
28namespace QuantExt {
29using namespace QuantLib;
30
31/*! cap / floor elements at 1 / 0, adjust diagonal elements so that row sums are 1, or if that is not possible, divide
32 the row elements by the row sum */
33void sanitiseTransitionMatrix(Matrix& m);
34
35//! check if the matrix is a transition matrix, i.e. row sums are 1 and entries are non-negative
36void checkTransitionMatrix(const Matrix& t);
37
38//! check if the matrix is a generator matirx, i.e. row sums are 0 and non-diagonal elements are non-negative
39void checkGeneratorMatrix(const Matrix& g);
40
41/*! build generator from transition matrix
42 cf. Alexander Kreinin and Marina Sidelnikova, "Regularization Algorithms for Transition Matrices", Algorithm QOG */
43Matrix generator(const Matrix& t, const Real horizon = 1.0);
44
45//! compute N(0,1) credit state boundaries
46template <class I> std::vector<Real> creditStateBoundaries(const I& begin, const I& end);
47
48} // namespace QuantExt
std::vector< Real > creditStateBoundaries(const I &begin, const I &end)
compute N(0,1) credit state boundaries
void checkTransitionMatrix(const Matrix &t)
check if the matrix is a transition matrix, i.e. row sums are 1 and entries are non-negative
void checkGeneratorMatrix(const Matrix &g)
check if the matrix is a generator matirx, i.e. row sums are 0 and non-diagonal elements are non-nega...
Matrix generator(const Matrix &t, const Real horizon)
void sanitiseTransitionMatrix(Matrix &m)