32 const Date& referenceDate,
36 transitionMatrix_(matrixType ==
MatrixType::Transition ? matrix : Matrix()),
37 generator_(matrixType ==
MatrixType::Generator ? matrix : Matrix()) {
39 QL_REQUIRE(matrix.rows() == matrix.columns(),
"input matrix is not square");
51 QL_REQUIRE(t >= 0.0,
"non-negative time required");
54 "initial state " <<
initialState_ <<
" out of range [0," << Q.rows() - 1 <<
"]");
55 Size lastState = Q.columns() - 1;
GeneratorDefaultProbabilityTermStructure(MatrixType matrixType, Matrix matrix, Size initialState, const Date &referenceDate, const Calendar &cal=NullCalendar(), const DayCounter &dc=Actual365Fixed())
Constructor using a single (annual!) transition matrix or a generator matrix.
Probability survivalProbabilityImpl(Time) const override
Default curve implied from a single generator matrix.
QuantLib::Matrix Expm(const QuantLib::Matrix &m)
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)
utility functions for transition matrices and generators