Hi Peter,
IMO the condition number of your matrix is very large (matrix is singular or computationally singular) and the ublas check for numerical stability is raising an alert here.
http://stackoverflow.com/questions/17240624/matrix-inversion-in-boost
BOOST_UBLAS_TYPE_CHECK_EPSILON default: sqrt(epsilon), controls how large the difference between the expected result and the computed result may become. Increase this value if you are going to use near singular or badly scaled matrices.
Tuning this epsilon doesn't help. If I'm making epsilon big enough so that the exception disappears then the outcome is flat wrong due to the very large condition number.
regards
Klaus
On Dienstag, 11. April 2017 20:59:11 CEST Peter Caspers wrote:
> Hi,
>
> the following Code
>
> #include <ql/math/matrix.hpp>
> #include <iostream>
> using namespace QuantLib;
> int main() {
> Real data[8][8] = {{0.0006474874439615692, 0.002486659100900001,
> 0.0006628267415236041, 0.04673067750857564, 0.1685162462417822,
> 0.1516341778778243, 0.1219910757564679, 0.507330849328965},
> {5.165711089877979e-06, 0.001690175534926361, 2.136045858343317e-05,
> 0.04475379133340539, 0.1394666326109254, 0.1636645892860261,
> 0.12811590642367, 0.5222823786413735}, {4.3468717221017e-07,
> 3.324472127119397e-05, 1.632530899871639e-05, 0.0473437145861729,
> 0.09087902924968709, 0.1932661669150169, 0.1257053481714577,
> 0.5427557363602231}, {3.883601299340593e-07, 5.96026473031791e-06,
> 1.108224823791975e-05, 0.05269312648895734, 0.1170973364539729,
> 0.2225313741567021, 0.08459583680146567, 0.5230648952258039},
> {1.311427219168951e-07, 1.451479950650993e-06, 9.870251521216817e-06,
> 0.002430611065235592, 0.1217894913776252, 0.2748389234300169,
> 0.07704266870962403, 0.5238868525433042}, {3.858458712871179e-08,
> 6.299157109034205e-07, 9.478963012990911e-06, 0.0006947826112014794,
> 0.007430976289762706, 0.2725490552732179, 0.07467942912312821,
> 0.6446356092393787}, {8.037084743179829e-09, 1.06623621797325e-07,
> 7.740443849605495e-06, 0.0005175216683466955, 0.004174347052491365,
> 0.02170492331427787, 0.06116825771382062, 0.9124270951465073}, {0, 0, 0, 0,
> 0, 0, 0, 1}};
> Matrix m(8, 8);
> for (Size i = 0; i < 8; ++i)
> for (Size j = 0; j < 8; ++j)
> m(i, j) = data[i][j];
> std::clog << inverse(m) << std::endl;
> return 0;
> }
>
> results in
>
> Check failed in file /usr/local/include/boost/numeric/ublas/lu.hpp at line
> 298: detail::expression_type_check (prod
> (triangular_adaptor<const_matrix_type, upper> (m), e), cm2)
> libc++abi.dylib: terminating with uncaught exception of type
> boost::numeric::ublas::internal_logic: internal logic
>
> for me. Does anyone have an idea what might go wrong here?
>
> I am using Boost 1.59 + a recent QL version on OSX with clang 4.0.0. I
> believe QuantLib only wraps ublas functions here, so probably I should
> create a ticket in the boost project?
>
> Thanks a lot
> Peter
> ----------------------------------------------------------------------------
> -- Check out the vibrant tech community on one of the world's most
> engaging tech sites, Slashdot.org! http://sdm.link/slashdot
> _______________________________________________
> QuantLib-dev mailing list
> https://lists.sourceforge.net/lists/listinfo/quantlib-dev
Free forum by Nabble | Disable Popup Ads | Edit this page |