24#pragma GCC diagnostic push
25#pragma GCC diagnostic ignored "-Wfloat-conversion"
26#pragma GCC diagnostic ignored "-Wunused-variable"
29#include <unsupported/Eigen/MatrixFunctions>
32#pragma GCC diagnostic pop
33#pragma GCC diagnostic pop
40inline Eigen::MatrixXd ql2eigen(
const QuantLib::Matrix& m) {
41 Eigen::MatrixXd res(m.rows(), m.columns());
42 for (
size_t i = 0; i < m.rows(); ++i)
43 for (
size_t j = 0; j < m.columns(); ++j)
48inline QuantLib::Matrix eigen2ql(
const Eigen::MatrixXd& m) {
49 QuantLib::Matrix res(m.rows(), m.cols());
50 for (
long i = 0; i < m.rows(); ++i)
51 for (
long j = 0; j < m.cols(); ++j)
61QuantLib::Matrix
Logm(
const QuantLib::Matrix& m) {
62 QuantLib::Matrix res = eigen2ql(ql2eigen(m).
log());
66QuantLib::Matrix
Expm(
const QuantLib::Matrix& m) {
67 QuantLib::Matrix res = eigen2ql(ql2eigen(m).
exp());
74#include <ql/math/matrixutilities/expm.hpp>
81QuantLib::Matrix
Logm(
const QuantLib::Matrix& m) {
82 QL_FAIL(
"Logm(): no implementation provided, you can e.g. install Eigen and rebuild ORE to enable this function.");
85QuantLib::Matrix
Expm(
const QuantLib::Matrix& m) {
return QuantLib::Expm(m); }
QuantLib::Matrix Logm(const QuantLib::Matrix &m)
QuantLib::Matrix Expm(const QuantLib::Matrix &m)
CompiledFormula exp(CompiledFormula x)
CompiledFormula log(CompiledFormula x)