Search code examples
c++boostboost-ublas

Disable warning log in boost::ublas


While inverting a matrix with boost::ublas I sometimes get this error in the log:

Check failed in file /usr/include/boost/numeric/ublas/lu.hpp at line 298: detail::expression_type_check (prod (triangular_adaptor (m), e), cm2)

I am aware this is generally useful information, but not in my case. Is there any way to suppress that message (somehow configuring boost, or using a compiler flag)? BOOST_UBLAS_NDEBUG doesn't cut it.


Solution

  • Looking at that header reveals:

    #if BOOST_UBLAS_TYPE_CHECK
            BOOST_UBLAS_CHECK (detail::expression_type_check (prod (triangular_adaptor<const_matrix_type, upper> (m), e), cm2), internal_logic ());
    #endif
    

    It's even documented:

    BOOST_UBLAS_TYPE_CHECK

    When BOOST_UBLAS_TYPE_CHECK is enabled then all possibly expensive structure checks are enabled. If this is not desireable then use #define BOOST_UBLAS_TYPE_CHECK 0 before including any uBLAS header. The define BOOST_UBLAS_TYPE_CHECK_EPSILON can be used to control the acceptable tolerance, see detail/matrix_assign.hpp for implementation details of this check.