Boost logo

Ublas :

From: é×ÏÌÇÉÎ áÒÄÁÌÉÏÎ (comaMM_at_[hidden])
Date: 2008-08-24 16:39:54


You are right. There is an assertion in function lu_factorize() to check if the matrix is singular.

But the thing is that even with non-degenerated matrix I get the same thing again and again. So the trouble is with another condition (I mean this one: detail::expression_type_check(…)). I tried to find where this detail::expression_type_check() grows from, but the roots are too deep.

I’m afraid that I made a stupid mistake somewhere, but I can’t find where.)

> Karl Meerbergen wrote:
> It is possible that ublas' lu_factorize does not factor singular matrices.
> Are you sure you want to solve a singular system.
> Karl
>> ??????? ???????? wrote:
>> Nope. I get a run-time assertion from function lu_factorize. Besides that I tried different matrixes.
>>
>> Anyway. Thanks for the reaction.)
>>
>>
>>> Karl Meerbergen wrote:
>>> Hi,
>>> I guess your matrix is
>>> 1 2 3
>>> 4 5 6
>>> 7 8 9
>>> This is a singular matrix. You can do a factorization but not a solve
>>> afterwards.
>>> Best regards,
>>> Karl
>>>> ??????? ???????? wrote:
>>>>
>>>> Hello, everybody!
>>>>
>>>> I found a page about LU-decomposition on Effective uBLAS wiki. Everything looked neat, and I decided to write simple example like this below:
>>>>
>>>> #include <boost/numeric/ublas/io.hpp>
>>>> #include <boost/numeric/ublas/lu.hpp>
>>>>
>>>> using namespace boost::numeric::ublas;
>>>>
>>>> int main () {
>>>> matrix<int> A(3,3), B(identity_matrix<int>(3));
>>>> for (int i=0; i<3; ++i)
>>>> for (int j=0; j<3; ++j)
>>>> A(i,j)=3*i+j+1;
>>>>
>>>> std::cout << A << std::endl;
>>>> std::cout << B << std::endl;
>>>>
>>>> permutation_matrix<> pm(3);
>>>>
>>>> lu_factorize<matrix<int>, permutation_matrix<> >(A, pm);
>>>> lu_substitute(A, pm, B);
>>>>
>>>> std::cout << A << std::endl;
>>>> std::cout << B << std::endl;
>>>>
>>>> return EXIT_SUCCESS;
>>>> }
>>>>
>>>> But when I try to run the compiled executable, I got a run-time assertion with this text:
>>>>
>>>> Check failed in .../include/boost/numeric/ublas/lu.hpp at line 157:
>>>> singular != 0 || detail::expression_type_check (prod (triangular_adaptor<matrix_type, unit_lower> (m), triangular_adaptor<matrix_type, upper> (m)), cm)
>>>>
>>>> Maybe someone had already faced this problem?
>>>>
>>>> P.S. On the page about LU-decomposition there was something about getting recent version of lu.hpp from Boost CVS. But the link in Boost::uBLAS documentation seems to be broken.
>>>>
>>>> P.P.S. I have: MS Windows Vista 32-bit with MinGW g++ 3.4.5 compiler. (Boost version is 1.36.0).